mirror of https://github.com/moparisthebest/curl
Added a httpreq field in the main struct so that there's one field to check
for what HTTP request that is being used. The old bit-style fields are still in there as well.
This commit is contained in:
parent
c331ef02f9
commit
fcb347d124
|
@ -301,6 +301,8 @@ CURLcode curl_open(CURL **curl, char *url)
|
||||||
|
|
||||||
data->current_speed = -1; /* init to negative == impossible */
|
data->current_speed = -1; /* init to negative == impossible */
|
||||||
|
|
||||||
|
data->httpreq = HTTPREQ_GET; /* Default HTTP request */
|
||||||
|
|
||||||
*curl = data;
|
*curl = data;
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
@ -340,6 +342,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||||
break;
|
break;
|
||||||
case CURLOPT_POST:
|
case CURLOPT_POST:
|
||||||
data->bits.http_post = va_arg(param, long)?TRUE:FALSE;
|
data->bits.http_post = va_arg(param, long)?TRUE:FALSE;
|
||||||
|
data->httpreq = HTTPREQ_POST;
|
||||||
break;
|
break;
|
||||||
case CURLOPT_FILETIME:
|
case CURLOPT_FILETIME:
|
||||||
data->bits.get_filetime = va_arg(param, long)?TRUE:FALSE;
|
data->bits.get_filetime = va_arg(param, long)?TRUE:FALSE;
|
||||||
|
@ -361,19 +364,17 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||||
break;
|
break;
|
||||||
case CURLOPT_PUT:
|
case CURLOPT_PUT:
|
||||||
data->bits.http_put = va_arg(param, long)?TRUE:FALSE;
|
data->bits.http_put = va_arg(param, long)?TRUE:FALSE;
|
||||||
|
data->httpreq = HTTPREQ_PUT;
|
||||||
break;
|
break;
|
||||||
case CURLOPT_MUTE:
|
case CURLOPT_MUTE:
|
||||||
data->bits.mute = va_arg(param, long)?TRUE:FALSE;
|
data->bits.mute = va_arg(param, long)?TRUE:FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURLOPT_TIMECONDITION:
|
case CURLOPT_TIMECONDITION:
|
||||||
data->timecondition = va_arg(param, long);
|
data->timecondition = va_arg(param, long);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURLOPT_TIMEVALUE:
|
case CURLOPT_TIMEVALUE:
|
||||||
data->timevalue = va_arg(param, long);
|
data->timevalue = va_arg(param, long);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURLOPT_SSLVERSION:
|
case CURLOPT_SSLVERSION:
|
||||||
data->ssl.version = va_arg(param, long);
|
data->ssl.version = va_arg(param, long);
|
||||||
break;
|
break;
|
||||||
|
@ -405,10 +406,12 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||||
break;
|
break;
|
||||||
case CURLOPT_CUSTOMREQUEST:
|
case CURLOPT_CUSTOMREQUEST:
|
||||||
data->customrequest = va_arg(param, char *);
|
data->customrequest = va_arg(param, char *);
|
||||||
|
data->httpreq = HTTPREQ_CUSTOM;
|
||||||
break;
|
break;
|
||||||
case CURLOPT_HTTPPOST:
|
case CURLOPT_HTTPPOST:
|
||||||
data->httppost = va_arg(param, struct HttpPost *);
|
data->httppost = va_arg(param, struct HttpPost *);
|
||||||
data->bits.http_formpost = data->httppost?1:0;
|
data->bits.http_formpost = data->httppost?1:0;
|
||||||
|
data->httpreq = HTTPREQ_POST_FORM;
|
||||||
break;
|
break;
|
||||||
case CURLOPT_INFILE:
|
case CURLOPT_INFILE:
|
||||||
data->in = va_arg(param, FILE *);
|
data->in = va_arg(param, FILE *);
|
||||||
|
|
|
@ -278,9 +278,25 @@ struct FTP {
|
||||||
char *file; /* decoded file */
|
char *file; /* decoded file */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HTTPREQ_NONE, /* first in list */
|
||||||
|
HTTPREQ_GET,
|
||||||
|
HTTPREQ_POST,
|
||||||
|
HTTPREQ_POST_FORM, /* we make a difference internally */
|
||||||
|
HTTPREQ_PUT,
|
||||||
|
HTTPREQ_CUSTOM,
|
||||||
|
HTTPREQ_LAST /* last in list */
|
||||||
|
} Curl_HttpReq;
|
||||||
|
|
||||||
/* This struct is for boolean settings that define how to behave during
|
/* This struct is for boolean settings that define how to behave during
|
||||||
this session. */
|
this session. */
|
||||||
struct Configbits {
|
struct Configbits {
|
||||||
|
/* these four request types mirror the httpreq field */
|
||||||
|
bool http_formpost;
|
||||||
|
bool http_post;
|
||||||
|
bool http_put;
|
||||||
|
bool http_get;
|
||||||
|
|
||||||
bool get_filetime;
|
bool get_filetime;
|
||||||
bool tunnel_thru_httpproxy;
|
bool tunnel_thru_httpproxy;
|
||||||
bool ftp_append;
|
bool ftp_append;
|
||||||
|
@ -290,10 +306,7 @@ struct Configbits {
|
||||||
bool hide_progress;
|
bool hide_progress;
|
||||||
bool http_fail_on_error;
|
bool http_fail_on_error;
|
||||||
bool http_follow_location;
|
bool http_follow_location;
|
||||||
bool http_formpost;
|
|
||||||
bool http_include_header;
|
bool http_include_header;
|
||||||
bool http_post;
|
|
||||||
bool http_put;
|
|
||||||
bool http_set_referer;
|
bool http_set_referer;
|
||||||
bool http_auto_referer; /* set "correct" referer when following location: */
|
bool http_auto_referer; /* set "correct" referer when following location: */
|
||||||
bool httpproxy;
|
bool httpproxy;
|
||||||
|
@ -308,7 +321,6 @@ struct Configbits {
|
||||||
bool verbose;
|
bool verbose;
|
||||||
bool this_is_a_follow; /* this is a followed Location: request */
|
bool this_is_a_follow; /* this is a followed Location: request */
|
||||||
bool krb4; /* kerberos4 connection requested */
|
bool krb4; /* kerberos4 connection requested */
|
||||||
|
|
||||||
bool proxystringalloc; /* the http proxy string is malloc()'ed */
|
bool proxystringalloc; /* the http proxy string is malloc()'ed */
|
||||||
bool rangestringalloc; /* the range string is malloc()'ed */
|
bool rangestringalloc; /* the range string is malloc()'ed */
|
||||||
bool urlstringalloc; /* the URL string is malloc()'ed */
|
bool urlstringalloc; /* the URL string is malloc()'ed */
|
||||||
|
@ -481,6 +493,8 @@ struct UrlData {
|
||||||
TimeCond timecondition; /* kind of comparison */
|
TimeCond timecondition; /* kind of comparison */
|
||||||
time_t timevalue; /* what time to compare with */
|
time_t timevalue; /* what time to compare with */
|
||||||
|
|
||||||
|
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 */
|
||||||
|
|
||||||
char *headerbuff; /* allocated buffer to store headers in */
|
char *headerbuff; /* allocated buffer to store headers in */
|
||||||
|
|
Loading…
Reference in New Issue