return null;
}
public IMessageHandler onMessageHeaderReceived(IHttpMessage message) throws IOException {
final IHttpRequest request = (IHttpRequest) message;
if (transactionMonitor != null) {
transactionMonitor.registerMessageHeaderReceived(HttpServerConnection.this, request.getRequestHeader());
}
// handle Connection header
handleLifeCycleHeaders(request);
if (LOG.isLoggable(Level.FINE)) {
if (request.hasBody()) {
String body = "";
String contentType = request.getContentType();
if ((contentType != null) && (contentType.startsWith("application/x-www-form-urlencode"))) {
body = request.getNonBlockingBody().toString() + "\n";
}
LOG.fine("[" + getId() + "] request received from " + getRemoteAddress() +
":" + getRemotePort() +
" (" + getCountMessagesReceived() + ". request) " + request.getRequestHeader().toString() + body);
} else {
LOG.fine("[" + getId() + "] bodyless request received from " + getRemoteAddress() +
":" + getRemotePort() +
" (" + getCountMessagesReceived() + ". request) " + request.getRequestHeader().toString());
}
}
// handle upgrade header
if (isAutohandleUpgadeHeader) {
String upgrade = request.getRequestHeader().getUpgrade();
if ((upgrade != null) && upgrade.equalsIgnoreCase("TLS/1.0")) {
if (getUnderlyingTcpConnection().isSecuredModeActivateable()) {
suspendReceiving();
HttpResponse response = new HttpResponse(101);
response.setHeader("Connection", "Upgrade");
response.setHeader("Upgrade", "TLS/1.0, HTTP/1.1");
writeMessage(response);
getUnderlyingTcpConnection().activateSecuredMode();
resumeReceiving();
} else {
sendResponseMessage(new HttpResponse(400, "text/html", generateErrorMessageHtml(400, "upgrade TLS is not supported", getId())));
return this;
}
return this;
}
}
boolean isFormUrlEncoded = isContentTypeFormUrlencoded(request);
if (message.hasBody()) {
// handle 100 continue header
if (HttpUtils.hasExpectContinueHeader(request.getRequestHeader())) {
if (isFormUrlEncoded || requestHandlerAdapter.isInvokeOnMessageReceived()) {
if (LOG.isLoggable(Level.FINE)) {
if (requestHandlerAdapter.isInvokeOnMessageReceived()) {
LOG.fine("request handler (chain) will be invoked onMessageReceived -> autohandle 100-continue");
} else if (isFormUrlEncoded) {
LOG.fine("request contains FormUrlEncoded body -> autohandle 100-continue");
}
}
request.setAttribute("org.xlightweb.100-continue-has-been-sent", "true");
writeMessageSilence(new HttpResponse(100));
}
}