mirror of
https://github.com/moparisthebest/curl
synced 2024-11-04 16:45:06 -05:00
http: allow Curl_add_buffer_send() to do a short first send by force
In a debug build, settting the environment variable "CURL_SMALLREQSEND" will make the first HTTP request send not send more bytes than the set amount, thus ending up verifying that the logic for handling a split HTTP request send works correctly.
This commit is contained in:
parent
0bcf975c38
commit
3e376059bb
15
lib/http.c
15
lib/http.c
@ -1229,8 +1229,21 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer **inp,
|
||||
memcpy(data->state.ulbuf, ptr, sendsize);
|
||||
ptr = data->state.ulbuf;
|
||||
}
|
||||
else
|
||||
else {
|
||||
#ifdef CURLDEBUG
|
||||
/* Allow debug builds override this logic to force short initial sends */
|
||||
char *p = getenv("CURL_SMALLREQSEND");
|
||||
if(p) {
|
||||
size_t altsize = (size_t)strtoul(p, NULL, 10);
|
||||
if(altsize)
|
||||
sendsize = CURLMIN(size, altsize);
|
||||
else
|
||||
sendsize = size;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
sendsize = size;
|
||||
}
|
||||
|
||||
result = Curl_write(conn, sockfd, ptr, sendsize, &amount);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user