1
0
Fork 0

do not send a content-length header on GET/HEAD/DELETE requests

This commit is contained in:
Jan Steemann 2012-11-20 15:36:52 +01:00
parent b159a0539b
commit c315c4466d
1 changed files with 13 additions and 3 deletions

View File

@ -259,9 +259,19 @@ namespace triagens {
_writeBuffer.appendText("\r\n"); _writeBuffer.appendText("\r\n");
} }
_writeBuffer.appendText("Content-Length: "); if (method == HttpRequest::HTTP_REQUEST_GET ||
_writeBuffer.appendInteger(bodyLength); method == HttpRequest::HTTP_REQUEST_HEAD ||
_writeBuffer.appendText("\r\n\r\n"); method == HttpRequest::HTTP_REQUEST_DELETE) {
// don't use a content-length for these request types
_writeBuffer.appendText("\r\n");
}
else {
// use a content-length for these request types
_writeBuffer.appendText("Content-Length: ");
_writeBuffer.appendInteger(bodyLength);
_writeBuffer.appendText("\r\n\r\n");
}
_writeBuffer.appendText(body, bodyLength); _writeBuffer.appendText(body, bodyLength);
LOGGER_TRACE << "Request: " << _writeBuffer.c_str(); LOGGER_TRACE << "Request: " << _writeBuffer.c_str();