configure, cmake, lib: more form api deprecation

Introduce a --enable-form-api configure option to control its inclusion
in builds. The condition name defined for it is CURL_DISABLE_FORM_API.

Form api code is dependent of MIME: configure and CMake handle this
dependency automatically: CMake by making it a dependent option
explicitly, configure by inheriting the MIME value by default and
rejecting explicit incompatible values.

"form-api" is now a new hidden test feature.

Update libcurl modules to respect this option and adjust tests
accordingly.

Closes #9621
This commit is contained in:
Patrick Monnerat 2022-11-15 17:50:22 +01:00 committed by Daniel Stenberg
parent 50e563253d
commit 038c46f61f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
18 changed files with 62 additions and 19 deletions

View file

@ -50,6 +50,9 @@
/* disables FILE */
#cmakedefine CURL_DISABLE_FILE 1
/* disables form api */
#cmakedefine CURL_DISABLE_FORM_API 1
/* disables FTP */
#cmakedefine CURL_DISABLE_FTP 1

View file

@ -27,7 +27,7 @@
#include <curl/curl.h>
#include "formdata.h"
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_MIME)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_FORM_API)
#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME)
#include <libgen.h>
@ -941,7 +941,7 @@ int curl_formget(struct curl_httppost *form, void *arg,
void curl_formfree(struct curl_httppost *form)
{
(void)form;
/* does nothing HTTP is disabled */
/* Nothing to do. */
}
#endif /* if disabled */

View file

@ -26,7 +26,7 @@
#include "curl_setup.h"
#ifndef CURL_DISABLE_MIME
#ifndef CURL_DISABLE_FORM_API
/* used by FormAdd for temporary storage */
struct FormInfo {
@ -53,10 +53,7 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
curl_mimepart *,
struct curl_httppost *post,
curl_read_callback fread_func);
#else
/* disabled */
#define Curl_getformdata(a,b,c,d) CURLE_NOT_BUILT_IN
#endif
#endif /* CURL_DISABLE_FORM_API */
#endif /* HEADER_CURL_FORMDATA_H */

View file

@ -2372,6 +2372,7 @@ CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
case HTTPREQ_POST_MIME:
http->sendit = &data->set.mimepost;
break;
#ifndef CURL_DISABLE_FORM_API
case HTTPREQ_POST_FORM:
/* Convert the form structure into a mime structure. */
Curl_mime_cleanpart(&http->form);
@ -2381,6 +2382,7 @@ CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
return result;
http->sendit = &http->form;
break;
#endif
default:
http->sendit = NULL;
}

View file

@ -666,7 +666,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.method = HTTPREQ_GET;
break;
#ifndef CURL_DISABLE_MIME
#ifndef CURL_DISABLE_FORM_API
case CURLOPT_HTTPPOST:
/*
* Set to make us do HTTP POST