mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
added the option CURLOPT_HTTP_VERSION that can specify which HTTP version
libcurl should use in its request
This commit is contained in:
parent
3685f792cb
commit
a9181f8f00
@ -555,6 +555,10 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
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;
|
send_buffer *req_buffer;
|
||||||
struct curl_slist *headers=data->set.headers;
|
struct curl_slist *headers=data->set.headers;
|
||||||
|
|
||||||
@ -564,7 +568,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
/* add the main request stuff */
|
/* add the main request stuff */
|
||||||
add_bufferf(req_buffer,
|
add_bufferf(req_buffer,
|
||||||
"%s " /* GET/HEAD/POST/PUT */
|
"%s " /* GET/HEAD/POST/PUT */
|
||||||
"%s HTTP/1.1\r\n" /* path */
|
"%s HTTP/%s\r\n" /* path */
|
||||||
"%s" /* proxyuserpwd */
|
"%s" /* proxyuserpwd */
|
||||||
"%s" /* userpwd */
|
"%s" /* userpwd */
|
||||||
"%s" /* range */
|
"%s" /* range */
|
||||||
@ -580,7 +584,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
((HTTPREQ_POST == data->set.httpreq) ||
|
((HTTPREQ_POST == data->set.httpreq) ||
|
||||||
(HTTPREQ_POST_FORM == data->set.httpreq))?"POST":
|
(HTTPREQ_POST_FORM == data->set.httpreq))?"POST":
|
||||||
(HTTPREQ_PUT == data->set.httpreq)?"PUT":"GET"),
|
(HTTPREQ_PUT == data->set.httpreq)?"PUT":"GET"),
|
||||||
ppath,
|
ppath, httpstring,
|
||||||
(conn->bits.proxy_user_passwd &&
|
(conn->bits.proxy_user_passwd &&
|
||||||
conn->allocptr.proxyuserpwd)?conn->allocptr.proxyuserpwd:"",
|
conn->allocptr.proxyuserpwd)?conn->allocptr.proxyuserpwd:"",
|
||||||
(conn->bits.user_passwd && conn->allocptr.userpwd)?
|
(conn->bits.user_passwd && conn->allocptr.userpwd)?
|
||||||
|
16
lib/url.c
16
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;
|
data->set.http_follow_location = va_arg(param, long)?TRUE:FALSE;
|
||||||
break;
|
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:
|
case CURLOPT_TRANSFERTEXT:
|
||||||
/*
|
/*
|
||||||
* This option was previously named 'FTPASCII'. Renamed to work with
|
* 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))
|
if(va_arg(param, long))
|
||||||
data->set.httpreq = HTTPREQ_PUT;
|
data->set.httpreq = HTTPREQ_PUT;
|
||||||
break;
|
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:
|
case CURLOPT_TIMECONDITION:
|
||||||
/*
|
/*
|
||||||
* Set HTTP time condition. This must be one of the defines in the
|
* Set HTTP time condition. This must be one of the defines in the
|
||||||
|
@ -520,11 +520,13 @@ struct UserDefined {
|
|||||||
struct curl_slist *quote; /* before the transfer */
|
struct curl_slist *quote; /* before the transfer */
|
||||||
struct curl_slist *postquote; /* after the transfer */
|
struct curl_slist *postquote; /* after the transfer */
|
||||||
struct curl_slist *telnet_options; /* linked list of telnet options */
|
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 */
|
time_t timevalue; /* what time to compare with */
|
||||||
curl_closepolicy closepolicy; /* connection cache close concept */
|
curl_closepolicy closepolicy; /* connection cache close concept */
|
||||||
Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
|
Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
|
||||||
char *customrequest; /* HTTP/FTP request to use */
|
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
|
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
|
* to which to send the authorization data to, and no other
|
||||||
* host (which location-following otherwise could lead to)
|
* host (which location-following otherwise could lead to)
|
||||||
|
Loading…
Reference in New Issue
Block a user