mirror of
https://github.com/curl/curl.git
synced 2026-08-25 04:23:36 +03:00
mime: new MIME API.
Available in HTTP, SMTP and IMAP. Deprecates the FORM API. See CURLOPT_MIMEPOST. Lib code and associated documentation.
This commit is contained in:
parent
5bae72734b
commit
ce0881edee
38 changed files with 2946 additions and 994 deletions
|
|
@ -73,6 +73,7 @@
|
|||
#include "connect.h"
|
||||
#include "non-ascii.h"
|
||||
#include "http2.h"
|
||||
#include "mime.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
|
|
@ -241,6 +242,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
|
|||
CURLcode Curl_readrewind(struct connectdata *conn)
|
||||
{
|
||||
struct Curl_easy *data = conn->data;
|
||||
struct Curl_mimepart *mimepart = &data->set.mimepost;
|
||||
|
||||
conn->bits.rewindaftersend = FALSE; /* we rewind now */
|
||||
|
||||
|
|
@ -253,9 +255,21 @@ CURLcode Curl_readrewind(struct connectdata *conn)
|
|||
/* We have sent away data. If not using CURLOPT_POSTFIELDS or
|
||||
CURLOPT_HTTPPOST, call app to rewind
|
||||
*/
|
||||
if(data->set.postfields ||
|
||||
(data->set.httpreq == HTTPREQ_POST_FORM))
|
||||
if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
|
||||
struct HTTP *http = data->req.protop;
|
||||
|
||||
if(http->sendit)
|
||||
mimepart = http->sendit;
|
||||
}
|
||||
if(data->set.postfields)
|
||||
; /* do nothing */
|
||||
else if(data->set.httpreq == HTTPREQ_POST_MIME ||
|
||||
data->set.httpreq == HTTPREQ_POST_FORM) {
|
||||
if(Curl_mime_rewind(mimepart)) {
|
||||
failf(data, "Cannot rewind mime/post data");
|
||||
return CURLE_SEND_FAIL_REWIND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(data->set.seek_func) {
|
||||
int err;
|
||||
|
|
@ -1826,7 +1840,8 @@ CURLcode Curl_follow(struct Curl_easy *data,
|
|||
* can be overridden with CURLOPT_POSTREDIR.
|
||||
*/
|
||||
if((data->set.httpreq == HTTPREQ_POST
|
||||
|| data->set.httpreq == HTTPREQ_POST_FORM)
|
||||
|| data->set.httpreq == HTTPREQ_POST_FORM
|
||||
|| data->set.httpreq == HTTPREQ_POST_MIME)
|
||||
&& !(data->set.keep_post & CURL_REDIR_POST_301)) {
|
||||
infof(data, "Switch from POST to GET\n");
|
||||
data->set.httpreq = HTTPREQ_GET;
|
||||
|
|
@ -1850,7 +1865,8 @@ CURLcode Curl_follow(struct Curl_easy *data,
|
|||
* can be overridden with CURLOPT_POSTREDIR.
|
||||
*/
|
||||
if((data->set.httpreq == HTTPREQ_POST
|
||||
|| data->set.httpreq == HTTPREQ_POST_FORM)
|
||||
|| data->set.httpreq == HTTPREQ_POST_FORM
|
||||
|| data->set.httpreq == HTTPREQ_POST_MIME)
|
||||
&& !(data->set.keep_post & CURL_REDIR_POST_302)) {
|
||||
infof(data, "Switch from POST to GET\n");
|
||||
data->set.httpreq = HTTPREQ_GET;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue