aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c25
-rw-r--r--lib/transfer.c6
-rw-r--r--lib/url.c25
-rw-r--r--lib/urldata.h6
4 files changed, 31 insertions, 31 deletions
diff --git a/lib/http.c b/lib/http.c
index 73d13a6dc..28292384e 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -361,7 +361,7 @@ CURLcode Curl_http_done(struct connectdata *conn)
data=conn->data;
http=conn->proto.http;
- if(data->bits.http_formpost) {
+ if(HTTPREQ_POST_FORM == data->httpreq) {
*bytecount = http->readbytecount + http->writebytecount;
Curl_FormFree(http->sendit); /* Now free that whole lot */
@@ -369,7 +369,7 @@ CURLcode Curl_http_done(struct connectdata *conn)
data->fread = http->storefread; /* restore */
data->in = http->in; /* restore */
}
- else if(data->bits.http_put) {
+ else if(HTTPREQ_PUT == data->httpreq) {
*bytecount = http->readbytecount + http->writebytecount;
}
@@ -405,7 +405,7 @@ CURLcode Curl_http(struct connectdata *conn)
if ( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
data->bits.upload) {
- data->bits.http_put=1;
+ data->httpreq = HTTPREQ_PUT;
}
/* The User-Agent string has been built in url.c already, because it might
@@ -457,7 +457,7 @@ CURLcode Curl_http(struct connectdata *conn)
/* The path sent to the proxy is in fact the entire URL */
ppath = data->url;
}
- if(data->bits.http_formpost) {
+ if(HTTPREQ_POST_FORM == data->httpreq) {
/* we must build the whole darned post sequence first, so that we have
a size of the whole shebang before we start to send it */
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
@@ -488,9 +488,9 @@ CURLcode Curl_http(struct connectdata *conn)
if(!checkheaders(data, "Accept:"))
http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
- if((data->bits.http_post ||
- data->bits.http_formpost ||
- data->bits.http_put) &&
+ if(( (HTTPREQ_POST == data->httpreq) ||
+ (HTTPREQ_POST_FORM == data->httpreq) ||
+ (HTTPREQ_PUT == data->httpreq) ) &&
conn->resume_from) {
/**********************************************************************
* Resuming upload in HTTP means that we PUT or POST and that we have
@@ -597,8 +597,9 @@ CURLcode Curl_http(struct connectdata *conn)
data->customrequest?data->customrequest:
(data->bits.no_body?"HEAD":
- (data->bits.http_post || data->bits.http_formpost)?"POST":
- (data->bits.http_put)?"PUT":"GET"),
+ ((HTTPREQ_POST == data->httpreq) ||
+ (HTTPREQ_POST_FORM == data->httpreq))?"POST":
+ (HTTPREQ_PUT == data->httpreq)?"PUT":"GET"),
ppath,
(conn->bits.proxy_user_passwd &&
conn->allocptr.proxyuserpwd)?conn->allocptr.proxyuserpwd:"",
@@ -703,7 +704,7 @@ CURLcode Curl_http(struct connectdata *conn)
headers = headers->next;
}
- if(data->bits.http_formpost) {
+ if(HTTPREQ_POST_FORM == data->httpreq) {
if(Curl_FormInit(&http->form, http->sendit)) {
failf(data, "Internal HTTP POST error!\n");
return CURLE_HTTP_POST_ERROR;
@@ -734,7 +735,7 @@ CURLcode Curl_http(struct connectdata *conn)
return result;
}
}
- else if(data->bits.http_put) {
+ else if(HTTPREQ_PUT == data->httpreq) {
/* Let's PUT the data to the server! */
if(data->infilesize>0) {
@@ -762,7 +763,7 @@ CURLcode Curl_http(struct connectdata *conn)
}
else {
- if(data->bits.http_post) {
+ if(HTTPREQ_POST == data->httpreq) {
/* this is the simple POST, using x-www-form-urlencoded style */
if(!checkheaders(data, "Content-Length:"))
diff --git a/lib/transfer.c b/lib/transfer.c
index 5bdbefd1b..91db1c59e 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1046,10 +1046,8 @@ CURLcode Curl_perform(CURL *curl)
case 303: /* See Other */
/* Disable both types of POSTs, since doing a second POST when
* following isn't what anyone would want! */
- data->bits.http_post = FALSE;
- data->bits.http_formpost = FALSE;
- data->httpreq = HTTPREQ_GET; /* enfore GET request */
- infof(data, "Disables POST\n");
+ data->httpreq = HTTPREQ_GET; /* enforce GET request */
+ infof(data, "Disables POST, goes with GET\n");
break;
case 304: /* Not Modified */
/* 304 means we did a conditional request and it was "Not modified".
diff --git a/lib/url.c b/lib/url.c
index bcb801405..404a26faa 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -432,10 +432,10 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
break;
case CURLOPT_PUT:
/*
- * Use the HTTP PUT request to transfer data.
+ * Use the HTTP PUT request to transfer data if this is TRUE. If this is
+ * FALSE, don't set the httpreq. We can't know what to revert it to!
*/
- data->bits.http_put = va_arg(param, long)?TRUE:FALSE;
- if(data->bits.http_put)
+ if(va_arg(param, long))
data->httpreq = HTTPREQ_PUT;
break;
#if 0
@@ -529,10 +529,18 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
* Set to make us do HTTP POST
*/
data->httppost = va_arg(param, struct HttpPost *);
- data->bits.http_formpost = data->httppost?1:0;
- if(data->bits.http_formpost)
+ if(data->httppost)
data->httpreq = HTTPREQ_POST_FORM;
break;
+
+ case CURLOPT_HTTPGET:
+ /*
+ * Set to force us do HTTP GET
+ */
+ if(va_arg(param, long))
+ data->httpreq = HTTPREQ_GET;
+ break;
+
case CURLOPT_INFILE:
/*
* FILE pointer to read the file to be uploaded from. Or possibly
@@ -575,8 +583,8 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
break;
case CURLOPT_POST:
/* Does this option serve a purpose anymore? */
- data->bits.http_post = va_arg(param, long)?TRUE:FALSE;
- if(data->bits.http_post)
+
+ if(va_arg(param, long))
data->httpreq = HTTPREQ_POST;
break;
case CURLOPT_POSTFIELDS:
@@ -584,8 +592,7 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
* A string with POST data. Makes curl HTTP POST.
*/
data->postfields = va_arg(param, char *);
- data->bits.http_post = data->postfields?TRUE:FALSE;
- if(data->bits.http_post)
+ if(data->postfields)
data->httpreq = HTTPREQ_POST;
break;
case CURLOPT_POSTFIELDSIZE:
diff --git a/lib/urldata.h b/lib/urldata.h
index 18039f176..21b225a58 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -382,12 +382,6 @@ typedef enum {
/* This struct is for boolean settings that define how to behave during
this session. */
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 tunnel_thru_httpproxy;
bool ftp_append;