CharBuffer cb = ascii.decode(bb);
Matcher m = requestPattern.matcher(cb);
if (!m.matches())
throw new MalformedRequestException();
Action a;
try {
a = Action.parse(m.group(1));
} catch (IllegalArgumentException x) {
throw new MalformedRequestException();
}
URI u;
try {
u = new URI("http://"
+ m.group(4)
+ m.group(2));
} catch (URISyntaxException x) {
throw new MalformedRequestException();
}
return new Request(a, m.group(3), u);