1
0
Fork 0

fixed downloads

This commit is contained in:
Jan Steemann 2013-04-18 12:00:49 +02:00
parent 9d3b2019b0
commit b0bd55adbe
1 changed files with 15 additions and 4 deletions

View File

@ -227,9 +227,15 @@ namespace triagens {
_writeBuffer.appendText(l); _writeBuffer.appendText(l);
_writeBuffer.appendText(" HTTP/1.1\r\n"); _writeBuffer.appendText(" HTTP/1.1\r\n");
string hostname = _connection->getEndpoint()->getHostString();
if (hostname.find(':') != string::npos) {
hostname = hostname.substr(0, hostname.find(':'));
}
_writeBuffer.appendText("Host: "); _writeBuffer.appendText("Host: ");
_writeBuffer.appendText(_connection->getEndpoint()->getHostString()); _writeBuffer.appendText(hostname);
_writeBuffer.appendText("\r\n"); _writeBuffer.appendText("\r\n");
_writeBuffer.appendText("Connection: Keep-Alive\r\n"); _writeBuffer.appendText("Connection: Keep-Alive\r\n");
_writeBuffer.appendText("User-Agent: VOC-Client/1.0\r\n"); _writeBuffer.appendText("User-Agent: VOC-Client/1.0\r\n");
@ -263,9 +269,14 @@ namespace triagens {
_writeBuffer.appendText("\r\n"); _writeBuffer.appendText("\r\n");
} }
_writeBuffer.appendText("Content-Length: "); if (method != HttpRequest::HTTP_REQUEST_GET) {
_writeBuffer.appendInteger(bodyLength); _writeBuffer.appendText("Content-Length: ");
_writeBuffer.appendText("\r\n\r\n"); _writeBuffer.appendInteger(bodyLength);
_writeBuffer.appendText("\r\n\r\n");
}
else {
_writeBuffer.appendText("\r\n");
}
_writeBuffer.appendText(body, bodyLength); _writeBuffer.appendText(body, bodyLength);
LOGGER_TRACE("Request: " << _writeBuffer.c_str()); LOGGER_TRACE("Request: " << _writeBuffer.c_str());