added the option CURLOPT_HTTP_VERSION that can specify which HTTP version
authorDaniel Stenberg <daniel@haxx.se>
Tue, 9 Oct 2001 06:52:37 +0000 (06:52 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 9 Oct 2001 06:52:37 +0000 (06:52 +0000)
libcurl should use in its request

lib/http.c
lib/url.c
lib/urldata.h

index 353ab5c7ce0b035ed273ef8ba23f40494d835dc7..ea1e4b6c0840e0735ff156e8547b1ec35edc9c81 100644 (file)
@@ -555,6 +555,10 @@ CURLcode Curl_http(struct connectdata *conn)
   }
 
   do {
+    /* Use 1.1 unless the use specificly asked for 1.0 */
+    const char *httpstring=
+      data->set.httpversion==CURL_HTTP_VERSION_1_0?"1.0":"1.1";
+
     send_buffer *req_buffer;
     struct curl_slist *headers=data->set.headers;
 
@@ -564,7 +568,7 @@ CURLcode Curl_http(struct connectdata *conn)
     /* add the main request stuff */
     add_bufferf(req_buffer,
                 "%s " /* GET/HEAD/POST/PUT */
-                "%s HTTP/1.1\r\n" /* path */
+                "%s HTTP/%s\r\n" /* path */
                 "%s" /* proxyuserpwd */
                 "%s" /* userpwd */
                 "%s" /* range */
@@ -580,7 +584,7 @@ CURLcode Curl_http(struct connectdata *conn)
                  ((HTTPREQ_POST == data->set.httpreq) ||
                   (HTTPREQ_POST_FORM == data->set.httpreq))?"POST":
                  (HTTPREQ_PUT == data->set.httpreq)?"PUT":"GET"),
-                ppath,
+                ppath, httpstring,
                 (conn->bits.proxy_user_passwd &&
                  conn->allocptr.proxyuserpwd)?conn->allocptr.proxyuserpwd:"",
                 (conn->bits.user_passwd && conn->allocptr.userpwd)?
index f9dc3a7f385d269e8c832261e67d342f07d8ab84..a9f12d6703679e3e187f5e71661dfa7a5223e727 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -444,6 +444,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
      */
     data->set.http_follow_location = va_arg(param, long)?TRUE:FALSE;
     break;
+  case CURLOPT_HTTP_VERSION:
+    /*
+     * This sets a requested HTTP version to be used. The value is one of
+     * the listed enums in curl/curl.h.
+     */
+    data->set.httpversion = va_arg(param, long);
+    break;
   case CURLOPT_TRANSFERTEXT:
     /*
      * This option was previously named 'FTPASCII'. Renamed to work with
@@ -461,15 +468,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
     if(va_arg(param, long))
       data->set.httpreq = HTTPREQ_PUT;
     break;
-#if 0
-    /* obsolete stuff, kept here a while for informational purposes */
-  case CURLOPT_MUTE:
-    /*
-     * Stay absolutely quiet.
-     */
-    data->set.mute = va_arg(param, long)?TRUE:FALSE;
-    break;
-#endif
   case CURLOPT_TIMECONDITION:
     /*
      * Set HTTP time condition. This must be one of the defines in the
index 0ac3a490753d52752ec0899931023b3b08f2ecbc..4f320408a4f1fe5951ce08c78b958e64bac6087a 100644 (file)
@@ -520,11 +520,13 @@ struct UserDefined {
   struct curl_slist *quote;     /* before the transfer */
   struct curl_slist *postquote; /* after the transfer */
   struct curl_slist *telnet_options; /* linked list of telnet options */
-  TimeCond timecondition; /* kind of time/date comparison */
+  curl_TimeCond timecondition; /* kind of time/date comparison */
   time_t timevalue;       /* what time to compare with */
   curl_closepolicy closepolicy; /* connection cache close concept */
   Curl_HttpReq httpreq;   /* what kind of HTTP request (if any) is this */
   char *customrequest;    /* HTTP/FTP request to use */
+  long httpversion; /* when non-zero, a specific HTTP version requested to
+                       be used in the library's request(s) */
   char *auth_host; /* if set, this is the allocated string to the host name
                     * to which to send the authorization data to, and no other
                     * host (which location-following otherwise could lead to)