]> granicus.if.org Git - curl/commitdiff
Toshiyuki Maezawa reported that when doing a POST with a read callback,
authorDaniel Stenberg <daniel@haxx.se>
Mon, 18 Apr 2005 17:14:58 +0000 (17:14 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 18 Apr 2005 17:14:58 +0000 (17:14 +0000)
libcurl didn't properly send an Expect: 100-continue header. It does now.

CHANGES
lib/http.c
tests/data/test508
tests/data/test510
tests/data/test513
tests/data/test515

diff --git a/CHANGES b/CHANGES
index 7340b4cdefb17f430e0dd1a88e1ba4885258144f..9b1fd61275c0f19a4aed63d42a64fdc40f3c8ac5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,14 @@
 
                                   Changelog
 
+Daniel (18 April 2005)
+- Toshiyuki Maezawa reported that when doing a POST with a read callback,
+  libcurl didn't properly send an Expect: 100-continue header. It does now.
+
+- I committed by mig change in the test suite's FTP server that moves out all
+  socket/TCP code to a separate C program named sockfilt. And added 4 new
+  test cases for FTP over IPv6.
+
 Daniel (8 April 2005)
 - Cory Nelson reported a problem with a HTTP server that responded with a 304
   response containing an "illegal" Content-Length: header, which was not
index 392e70657bf57469fff6604a6dc3e81317f4a55e..c3c80595670b4620af2d882254fa227637dc3e23 100644 (file)
@@ -1347,6 +1347,27 @@ CURLcode Curl_http_done(struct connectdata *conn,
   return CURLE_OK;
 }
 
+/* check and possibly add an Expect: header */
+static CURLcode expect100(struct SessionHandle *data,
+                          send_buffer *req_buffer)
+{
+  CURLcode result = CURLE_OK;
+  if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
+     !checkheaders(data, "Expect:")) {
+    /* if not doing HTTP 1.0 or disabled explicitly, we add a Expect:
+       100-continue to the headers which actually speeds up post
+       operations (as there is one packet coming back from the web
+       server) */
+    result = add_bufferf(req_buffer,
+                         "Expect: 100-continue\r\n");
+    if(result == CURLE_OK)
+      data->set.expect100header = TRUE;
+  }
+  return result;
+}
+
+
+
 /*
  * 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
@@ -1928,18 +1949,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
           return result;
       }
 
-      if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
-         !checkheaders(data, "Expect:")) {
-        /* if not doing HTTP 1.0 or disabled explicitly, we add a Expect:
-           100-continue to the headers which actually speeds up post
-           operations (as there is one packet coming back from the web
-           server) */
-        result = add_bufferf(req_buffer,
-                             "Expect: 100-continue\r\n");
-        if(result)
-          return result;
-        data->set.expect100header = TRUE;
-      }
+      result = expect100(data, req_buffer);
+      if(result)
+        return result;
 
       if(!checkheaders(data, "Content-Type:")) {
         /* Get Content-Type: line from Curl_formpostheader.
@@ -2002,18 +2014,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
           return result;
       }
 
-      if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
-         !checkheaders(data, "Expect:")) {
-        /* if not HTTP 1.0 or disabled explicitly, we add a Expect:
-           100-continue to the headers which actually speeds up post
-           operations (as there is one packet coming back from the web
-           server) */
-        result = add_bufferf(req_buffer,
-                             "Expect: 100-continue\r\n");
-        if(result)
-          return result;
-        data->set.expect100header = TRUE;
-      }
+      result = expect100(data, req_buffer);
+      if(result)
+        return result;
 
       result = add_buffer(req_buffer, "\r\n", 2); /* end of headers */
       if(result)
@@ -2121,21 +2124,18 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
           /* set the upload size to the progress meter */
           Curl_pgrsSetUploadSize(data, http->postsize);
 
-          if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
-             !checkheaders(data, "Expect:")) {
-            /* if not HTTP 1.0 or disabled explicitly, we add a Expect:
-               100-continue to the headers which actually speeds up post
-               operations (as there is one packet coming back from the web
-               server) */
-            add_bufferf(req_buffer,
-                        "Expect: 100-continue\r\n");
-            data->set.expect100header = TRUE;
-          }
+          result = expect100(data, req_buffer);
+          if(result)
+            return result;
 
           add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
         }
       }
       else {
+        result = expect100(data, req_buffer);
+        if(result)
+          return result;
+
         add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
 
         if(data->set.postfieldsize) {
index 08217effb607b64e7d55667a67f54fc7a5d3046a..51e3f81547e99191bbfe433993d713d8b21050f4 100644 (file)
@@ -40,6 +40,7 @@ Pragma: no-cache
 Accept: */*\r
 Content-Length: 45\r
 Content-Type: application/x-www-form-urlencoded\r
+Expect: 100-continue\r
 \r
 this is what we post to the silly web server
 </protocol>
index a82452a89a1c6eeea2e653a9df343d9049ae5601..6ab346678088d81d1f0d646c6edc80e8cf2f4ff2 100644 (file)
@@ -40,6 +40,7 @@ Pragma: no-cache
 Accept: */*\r
 Transfer-Encoding: chunked\r
 Content-Type: application/x-www-form-urlencoded\r
+Expect: 100-continue\r
 \r
 3\r
 one\r
index d97607e58e7a3af50afe6f9aa7f07b8b97d36d05..8b1fcf61f84855213c4204f36fe49a14beb4d2e2 100644 (file)
@@ -31,6 +31,7 @@ Pragma: no-cache
 Accept: */*\r
 Content-Length: 1\r
 Content-Type: application/x-www-form-urlencoded\r
+Expect: 100-continue\r
 \r
 </protocol>
 # 42 - aborted by callback
index 7e72858a3389bb10293c2de5316d5debb0678664..5feb4a94aed5f78ced79542077207f5fda8fa5f4 100644 (file)
@@ -41,6 +41,7 @@ Pragma: no-cache
 Accept: */*\r
 Content-Length: 0\r
 Content-Type: application/x-www-form-urlencoded\r
+Expect: 100-continue\r
 \r
 </protocol>
 </verify>