HTTPProtocol::HTTPConnection::HTTPConnection(Protocol &proto,
const HostTarget &hostTarget)
: TCPConnection(proto, hostTarget),
HTTPProtocol::HTTPConnection::HTTPConnection(Protocol &proto,
const HostTarget &hostTarget)
: TCPConnection(proto, hostTarget),
state(errorState), deferSendRequest(false)
{
const HostTarget &host = proxyHostTarget();
state(errorState), deferSendRequest(false)
{
const HostTarget &host = proxyHostTarget();
flushOutput(false); // hold output until we're done
const Target &target = this->target();
if (transfer().useProxyHeaders()) {
flushOutput(false); // hold output until we're done
const Target &target = this->target();
if (transfer().useProxyHeaders()) {
- printfe("%s %s HTTP/1.1",
- mOperation.c_str(), target.urlForm().c_str());
+ printfe("%s %s HTTP/1.%d", mOperation.c_str(), target.urlForm().c_str(), subVersion);
authorizationHeader("Proxy-Authorization", hostTarget,
kNetworkGenericProxyUsername, kNetworkGenericProxyPassword);
} else {
authorizationHeader("Proxy-Authorization", hostTarget,
kNetworkGenericProxyUsername, kNetworkGenericProxyPassword);
} else {
- printfe("%s %s HTTP/1.1", mOperation.c_str(), target.path.c_str());
+ printfe("%s %s HTTP/1.%d", mOperation.c_str(), target.path.c_str(), subVersion);
} else { // end of headers
// we are now handling the transition from response headers to response body
observe(Observer::protocolReceive, "** END OF HEADER **");
} else { // end of headers
// we are now handling the transition from response headers to response body
observe(Observer::protocolReceive, "** END OF HEADER **");
// Transfer-Encoding overrides Content-Length as per RFC2616 p.34
if (const char *encoding = headers().find("Transfer-Encoding")) {
// Transfer-Encoding overrides Content-Length as per RFC2616 p.34
if (const char *encoding = headers().find("Transfer-Encoding")) {
if (const char *lengthArg = headers().find("Content-Length")) {
size_t length = strtol(lengthArg, NULL, 10);
sink().setSize(length);
if (const char *lengthArg = headers().find("Content-Length")) {
size_t length = strtol(lengthArg, NULL, 10);
sink().setSize(length);
if (mResultClass != unclassifiedFailure)
return mResultClass; // preclassified
unsigned int code = httpResponseCode();
if (mResultClass != unclassifiedFailure)
return mResultClass; // preclassified
unsigned int code = httpResponseCode();
else if (code / 100 == 2) // success codes
return success;
else // when in doubt, blame the remote end :-)
else if (code / 100 == 2) // success codes
return success;
else // when in doubt, blame the remote end :-)