use of org.httpkit.HttpMethod in project http-kit by http-kit.
the class HttpDecoder method createRequest.
private void createRequest(String sb) throws ProtocolException {
int aStart;
int aEnd;
int bStart;
int bEnd;
int cStart;
int cEnd;
aStart = findNonWhitespace(sb, 0);
aEnd = findWhitespace(sb, aStart);
bStart = findNonWhitespace(sb, aEnd);
bEnd = findWhitespace(sb, bStart);
cStart = findNonWhitespace(sb, bEnd);
cEnd = findEndOfString(sb, cStart);
if (cStart < cEnd) {
try {
HttpMethod method = HttpMethod.valueOf(sb.substring(aStart, aEnd).toUpperCase());
HttpVersion version = HTTP_1_1;
if ("HTTP/1.0".equals(sb.substring(cStart, cEnd))) {
version = HTTP_1_0;
}
request = new HttpRequest(method, sb.substring(bStart, bEnd), version);
} catch (Exception e) {
throw new ProtocolException("method not understand");
}
} else {
throw new ProtocolException("not http?");
}
}
Aggregations