HttpRequest: chunk length are in hex
Thanks to mmlr for spotting this. The wrong format specifier was used, which would lead the server to get the wrong size and do strange things. Chunked uploads should now work a lot better. While I was at it, put the line termination in the printf to save a write to the socket (these are unbuffered and each of them costs us a syscall, and in some cases this has been found to confuse webservers as we end up sending super small TCP packets).
This commit is contained in:
parent
4e44b1a472
commit
44cff45d3d
@ -1076,12 +1076,13 @@ BHttpRequest::_SendPostData()
|
||||
break;
|
||||
|
||||
if (fOptInputDataSize < 0) {
|
||||
// Chunked transfer
|
||||
char hexSize[20];
|
||||
size_t hexLength = sprintf(hexSize, "%ld", read);
|
||||
// Input data size unknown, so we have to use chunked transfer
|
||||
char hexSize[18];
|
||||
// The string does not need to be NULL terminated.
|
||||
size_t hexLength = snprintf(hexSize, sizeof(hexSize), "%lx\r\n",
|
||||
read);
|
||||
|
||||
fSocket->Write(hexSize, hexLength);
|
||||
fSocket->Write("\r\n", 2);
|
||||
fSocket->Write(outputTempBuffer, read);
|
||||
fSocket->Write("\r\n", 2);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user