HttpResponse response = null;
context.setAttribute(HttpExecutionContext.HTTP_REQ_SENT, Boolean.FALSE);
conn.sendRequestHeader(request);
if (request instanceof HttpEntityEnclosingRequest) {
HttpEntityEnclosingRequest entityEnclRequest =
(HttpEntityEnclosingRequest) request;
// Check for expect-continue handshake. We have to flush the
// headers and wait for an 100-continue response to handle it.
// If we get a different response, we must not send the entity.
boolean sendentity = true;
final HttpVersion ver = request.getRequestLine().getHttpVersion();
if (entityEnclRequest.expectContinue() &&
ver.greaterEquals(HttpVersion.HTTP_1_1)) {
conn.flush();
// As suggested by RFC 2616 section 8.2.3, we don't wait for a
// 100-continue response forever. On timeout, send the entity.