cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTPs connection dropped on SSL_ERROR_WANT_WRITE

From: Ameya Vaidya (amevaidy) <amevaidy_at_cisco.com>
Date: Mon, 7 Mar 2016 09:46:41 +0000

>
> I take it that pipelining is required to trigger this, isn't it?

That is correct.

>
> To me it sounds like a decent way to fix this problem, so please by all means show us your take!
>

--- curl-7.47.1.orig/lib/http.h 2016-02-02 15:02:44.000000000 -0800
+++ curl-7.47.1/lib/http.h 2016-02-26 01:51:46.000000000 -0800
@@ -77,6 +77,7 @@
 
 /* protocol-specific functions set up to be called by the main engine */
 CURLcode Curl_http(struct connectdata *conn, bool *done);
+CURLcode Curl_http_doing(struct connectdata *conn, bool *done);
 CURLcode Curl_http_done(struct connectdata *, CURLcode, bool premature);
 CURLcode Curl_http_connect(struct connectdata *conn, bool *done);
 CURLcode Curl_http_setup_conn(struct connectdata *conn);

--- curl-7.47.1.orig/lib/http.c 2016-02-04 06:17:13.000000000 -0800
+++ curl-7.47.1/lib/http.c 2016-03-03 10:18:38.000000000 -0800
@@ -135,7 +135,7 @@
   ZERO_NULL, /* do_more */
   Curl_http_connect, /* connect_it */
   https_connecting, /* connecting */
- ZERO_NULL, /* doing */
+ Curl_http_doing, /* doing */
   https_getsock, /* proto_getsock */
   http_getsock_do, /* doing_getsock */
   ZERO_NULL, /* domore_getsock */
@@ -1754,6 +1754,10 @@
   return result;
 }
 
+CURLcode Curl_http_doing(struct connectdata *conn, bool *done)
+{
+ return Curl_http(conn, done);
+}
 /*
  * Curl_http() gets called from the generic Curl_do() function when a HTTP
  * request is to be performed. This creates and sends a properly constructed
@@ -2431,10 +2435,14 @@
                                     &data->info.request_size, 0, FIRSTSOCKET);
       if(result)
         failf(data, "Failed sending POST request");
- else
- /* setup variables for the upcoming transfer */
- Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
- -1, NULL);
+ else {
+ if((conn->handler->flags & PROTOPT_SSL) && (data->info.request_size == 0))
+ *done = FALSE;
+ else
+ /* setup variables for the upcoming transfer */
+ Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
+ -1, NULL);
+ }
       break;
     }
 
@@ -2501,11 +2509,15 @@
                                   &data->info.request_size, 0, FIRSTSOCKET);
     if(result)
       failf(data, "Failed sending POST request");
- else
- /* setup variables for the upcoming transfer */
- Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
- &http->readbytecount, FIRSTSOCKET,
- &http->writebytecount);
+ else {
+ if((conn->handler->flags & PROTOPT_SSL) && (data->info.request_size == 0))
+ *done = FALSE;
+ else
+ /* setup variables for the upcoming transfer */
+ Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
+ &http->readbytecount, FIRSTSOCKET,
+ &http->writebytecount);
+ }
 
     if(result) {
       Curl_formclean(&http->sendit); /* free that whole lot */
@@ -2556,11 +2568,15 @@
                                   &data->info.request_size, 0, FIRSTSOCKET);
     if(result)
       failf(data, "Failed sending PUT request");
- else
- /* prepare for transfer */
- Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
- &http->readbytecount, postsize?FIRSTSOCKET:-1,
- postsize?&http->writebytecount:NULL);
+ else {
+ if((conn->handler->flags & PROTOPT_SSL) && (data->info.request_size == 0))
+ *done = FALSE;
+ else
+ /* prepare for transfer */
+ Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
+ &http->readbytecount, postsize?FIRSTSOCKET:-1,
+ postsize?&http->writebytecount:NULL);
+ }
     if(result)
       return result;
     break;
@@ -2715,10 +2731,14 @@
 
     if(result)
       failf(data, "Failed sending HTTP POST request");
- else
- Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
- &http->readbytecount, http->postdata?FIRSTSOCKET:-1,
- http->postdata?&http->writebytecount:NULL);
+ else {
+ if((conn->handler->flags & PROTOPT_SSL) && (data->info.request_size == 0))
+ *done = FALSE;
+ else
+ Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
+ &http->readbytecount, http->postdata?FIRSTSOCKET:-1,
+ http->postdata?&http->writebytecount:NULL);
+ }
     break;
 
   default:
@@ -2732,11 +2752,15 @@
 
     if(result)
       failf(data, "Failed sending HTTP request");
- else
- /* HTTP GET/HEAD download: */
- Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
- http->postdata?FIRSTSOCKET:-1,
- http->postdata?&http->writebytecount:NULL);
+ else {
+ if((conn->handler->flags & PROTOPT_SSL) && (data->info.request_size == 0))
+ *done = FALSE;
+ else
+ /* HTTP GET/HEAD download: */
+ Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
+ http->postdata?FIRSTSOCKET:-1,
+ http->postdata?&http->writebytecount:NULL);
+ }
   }
   if(result)
     return result;
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-07