diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2001-10-09 06:52:37 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2001-10-09 06:52:37 +0000 | 
| commit | a9181f8f00d5bdfda39e227ed2ec4076ee4d2baa (patch) | |
| tree | e7f0023696b916783bbea5546a205a24f648301b /lib | |
| parent | 3685f792cbd271ecdc623de2e0b48e1debab6109 (diff) | |
added the option CURLOPT_HTTP_VERSION that can specify which HTTP version
libcurl should use in its request
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/http.c | 8 | ||||
| -rw-r--r-- | lib/url.c | 16 | ||||
| -rw-r--r-- | lib/urldata.h | 4 | 
3 files changed, 16 insertions, 12 deletions
| diff --git a/lib/http.c b/lib/http.c index 353ab5c7c..ea1e4b6c0 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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)? @@ -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 diff --git a/lib/urldata.h b/lib/urldata.h index 0ac3a4907..4f320408a 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -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) | 
