From d00f2a8f2e8529024709f70c8ab4c4138dc651a0 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Thu, 8 Dec 2016 16:32:36 -0500 Subject: 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 --- lib/sendf.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/sendf.c') diff --git a/lib/sendf.c b/lib/sendf.c index 29333e0e2..c3458a2b6 100644 --- a/lib/sendf.c +++ b/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 */ -- cgit v1.2.3