From: Daniel Stenberg Date: Tue, 21 Nov 2023 16:44:05 +0000 (+0100) Subject: mime: store "form escape" as a single bit X-Git-Tag: curl-8_5_0~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f766637aae1a5705b345077017166a5cb6f5515;p=thirdparty%2Fcurl.git mime: store "form escape" as a single bit Closes #12374 --- diff --git a/lib/mime.c b/lib/mime.c index 3b27e59e17..4b7160aed4 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -311,8 +311,7 @@ static char *escape_string(struct Curl_easy *data, table = formtable; /* data can be NULL when this function is called indirectly from curl_formget(). */ - if(strategy == MIMESTRATEGY_MAIL || - (data && (data->set.mime_options & CURLMIMEOPT_FORMESCAPE))) + if(strategy == MIMESTRATEGY_MAIL || (data && (data->set.mime_formescape))) table = mimetable; Curl_dyn_init(&db, CURL_MAX_INPUT_LENGTH); diff --git a/lib/setopt.c b/lib/setopt.c index 04762b0ebc..9dcaffef53 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -985,8 +985,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) break; case CURLOPT_MIME_OPTIONS: - data->set.mime_options = (unsigned int)va_arg(param, long); - break; + arg = va_arg(param, long); + data->set.mime_formescape = !!(arg & CURLMIMEOPT_FORMESCAPE); + break; # endif #endif diff --git a/lib/urldata.h b/lib/urldata.h index 582f1f2f57..30745db966 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1802,9 +1802,6 @@ struct UserDefined { #endif curl_prot_t allowed_protocols; curl_prot_t redir_protocols; -#ifndef CURL_DISABLE_MIME - unsigned int mime_options; /* Mime option flags. */ -#endif #ifndef CURL_DISABLE_RTSP void *rtp_out; /* write RTP to this if non-NULL */ /* Common RTSP header options */ @@ -1857,6 +1854,9 @@ struct UserDefined { IMAP or POP3 or others! (type: curl_usessl)*/ unsigned char connect_only; /* make connection/request, then let application use the socket */ +#ifndef CURL_DISABLE_MIME + BIT(mime_formescape); +#endif BIT(is_fread_set); /* has read callback been set to non-NULL? */ #ifndef CURL_DISABLE_TFTP BIT(tftp_no_options); /* do not send TFTP options requests */