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 */
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;
}
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
/* 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);
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
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:"",
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;
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) {
}
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:"))
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".
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
* 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
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:
* 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: