]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mime: store "form escape" as a single bit
authorDaniel Stenberg <daniel@haxx.se>
Tue, 21 Nov 2023 16:44:05 +0000 (17:44 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 22 Nov 2023 06:44:18 +0000 (07:44 +0100)
Closes #12374

lib/mime.c
lib/setopt.c
lib/urldata.h

index 3b27e59e17c67aba32e5f9753eaadd987d28a420..4b7160aed46942a7fa6b4d3761e08ada73d68fc7 100644 (file)
@@ -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);
index 04762b0ebc877ac8bdb71fbc4e295fbe1a905330..9dcaffef53d9ebfab266af42672884651e5c68da 100644 (file)
@@ -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
 
index 582f1f2f570eb6fe4387894d13fc3808a30bd08a..30745db9668b9dcfbbe0eda07737891873337b94 100644 (file)
@@ -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 */