mirror of
https://github.com/curl/curl.git
synced 2026-08-25 07:23:31 +03:00
http_proxy: Fix proxy CONNECT hang on pending data
- Check for pending data before waiting on the socket. Bug: https://github.com/curl/curl/issues/1156 Reported-by: Adam Langley
This commit is contained in:
parent
afb57f7b0b
commit
d00f2a8f2e
6 changed files with 256 additions and 231 deletions
11
lib/sendf.c
11
lib/sendf.c
|
|
@ -122,6 +122,13 @@ static size_t convert_lineends(struct Curl_easy *data,
|
|||
#endif /* CURL_DO_LINEEND_CONV */
|
||||
|
||||
#ifdef USE_RECV_BEFORE_SEND_WORKAROUND
|
||||
bool Curl_recv_has_postponed_data(struct connectdata *conn, int sockindex)
|
||||
{
|
||||
struct postponed_data * const psnd = &(conn->postponed[sockindex]);
|
||||
return psnd->buffer && psnd->allocated_size &&
|
||||
psnd->recv_size > psnd->recv_processed;
|
||||
}
|
||||
|
||||
static void pre_receive_plain(struct connectdata *conn, int num)
|
||||
{
|
||||
const curl_socket_t sockfd = conn->sock[num];
|
||||
|
|
@ -201,6 +208,10 @@ static ssize_t get_pre_recved(struct connectdata *conn, int num, char *buf,
|
|||
}
|
||||
#else /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
|
||||
/* Use "do-nothing" macros instead of functions when workaround not used */
|
||||
bool Curl_recv_has_postponed_data(struct connectdata *conn, int sockindex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#define pre_receive_plain(c,n) do {} WHILE_FALSE
|
||||
#define get_pre_recved(c,n,b,l) 0
|
||||
#endif /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue