Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure, cmake, lib: more form api deprecation #9621

Closed
wants to merge 1 commit into from

Conversation

monnerat
Copy link
Contributor

@monnerat monnerat commented Sep 29, 2022

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.

@bagder
Copy link
Member

bagder commented Sep 29, 2022

I don't think we can disable it by default without bumping the SONAME number. This would affect a lot of users.

@monnerat
Copy link
Contributor Author

I don't think we can disable it by default without bumping the SONAME number.

Technically speaking, yes we can. The API is still there but returns CURL_FORMADD_DISABLED.

Now, for users needing it, they still can build with --enable-form-api. At least this will force them to take conscience it's deprecated for 5 years.

Considering #9116, it seems obvious that deprecation in the documentation only is not enough: the solution implemented in this PR may seem to come abrubtly because you just read the PR. If it had been submitted (with forms enabled) together with the mime api introduction, it would appear more natural to disable it by default now.

After all, we already suppressed (not only disabled) features like Kerberos4 and char code conversion. They were less used, I admit.

That said, we can still have the form api enabled by default for some months or until a big change (version 8?), but I don't feel stretching the delay for disabling it by default will help.

A change in SONAME, although not needed, will emphasize a theoric incompatibility that can even exist between 2 different builds today (using --disable-mime).

@bagder
Copy link
Member

bagder commented Sep 30, 2022

Technically speaking, yes we can. The API is still there but returns CURL_FORMADD_DISABLED.

I disagree. SONAME implies ABI compatibility, and ABI includes behavior.

This is functionality that is still very much in use by people. Having the option there is good, but disabling it by default is not.

After all, we already suppressed (not only disabled) features like Kerberos4 and char code conversion. They were less used, I admit.

It becomes an exercise in philosophy at times: when nobody uses a feature then it actually doesn't change behavior when it is removed. A tough balance and call to make.

A change in SONAME, although not needed, will emphasize a theoretic incompatibility that can even exist between 2 different builds today (using --disable-mime).

A user can destroy the compatibility in many ways, but we maintain it for the same build options, and in particular when you do not disable features in a new way.

@monnerat monnerat changed the title configure, lib: really deprecate form api configure, lib: more form api deprecation Sep 30, 2022
@monnerat
Copy link
Contributor Author

Updated to enable by default.
A configure time warning message is issued when enabled.

@bagder
Copy link
Member

bagder commented Sep 30, 2022

I don't quite understand the warning. What is that going to do for users? The form API will be provided for as long as we remain using this SONAME, which very well may be another decade or two.

@monnerat
Copy link
Contributor Author

I don't quite understand the warning. What is that going to do for users?

This PR is not only another nth + 1 disabling conditional, but a push for users to use mime instead of form api by emphasizing deprecation.
I'm sure a lot of coders are'nt even aware that form api is deprecated and continue to develop around it. As we have seen, there had even been a request to upgrade it!
I don't want to break existing or binary applications, but IMO, if something has to be changed in an existing formadd calling sequence, this is time to migrate it to the mime api.
The goal of the warning message is to raise awareness of this deprecation by "advertising" it a little bit more than in documentation only, at least for those who build libcurl themselves.
I tried to make some kind of symetry with experimental features, that do issue a message when enabled: they are emerging, deprecated ones are diluting,

@jay
Copy link
Member

jay commented Oct 2, 2022

I think the doc warning is enough. We could put it in bold,

diff --git a/docs/libcurl/curl_formadd.3 b/docs/libcurl/curl_formadd.3
index 92135bf..04e10b3 100644
--- a/docs/libcurl/curl_formadd.3
+++ b/docs/libcurl/curl_formadd.3
@@ -32,7 +32,7 @@ CURLFORMcode curl_formadd(struct curl_httppost **firstitem,
                           struct curl_httppost **lastitem, ...);
 .fi
 .SH DESCRIPTION
-This function is deprecated. Do not use. See \fIcurl_mime_init(3)\fP instead.
+\fBThis function is deprecated.\fP Use \fIcurl_mime_init(3)\fP instead.
 
 curl_formadd() is used to append sections when building a multipart form
 post. Append one section at a time until you have added all the sections you

@monnerat
Copy link
Contributor Author

monnerat commented Oct 3, 2022

I think the doc warning is enough. We could put it in bold,

Good idea. But I fear a lot of people do cut n' paste old programs and do not read the doc :-(

jay added a commit to jay/curl that referenced this pull request Oct 3, 2022
jay added a commit to jay/curl that referenced this pull request Oct 5, 2022
jay added a commit that referenced this pull request Oct 5, 2022
@@ -654,7 +654,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.upload = FALSE;
break;

#ifndef CURL_DISABLE_MIME
#ifndef CURL_DISABLE_FORM_API
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't disabling MIME also imply disabling the form API? This makes them look like they are independent from each other, but surely the form API doesn't work if you disable MIME does it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't disabling MIME also imply disabling the form API?

Yes. The case is tested in configure.ac and CURL_DISABLE_FORM_API is always set when CURL_DISABLE_MIME is. CMakeLists.txt doesn't check it though.

Copy link
Contributor Author

@monnerat monnerat Nov 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now also handled in CMake.

@monnerat monnerat force-pushed the deprecate-formapi branch 2 times, most recently from 0165bb4 to 7be0c85 Compare October 23, 2022 10:43
jquepi pushed a commit to jquepi/curl.1.555 that referenced this pull request Oct 24, 2022
@monnerat monnerat force-pushed the deprecate-formapi branch 3 times, most recently from 3926257 to 6f60ab6 Compare November 15, 2022 17:09
@monnerat monnerat changed the title configure, lib: more form api deprecation configure, cmake, lib: more form api deprecation Nov 15, 2022
@monnerat
Copy link
Contributor Author

Now that the deprecation patch has been applied, I've removed the compilation-time warning.

@ROBERT-MCDOWELL
Copy link

it would be very nice to give some examples of how to convert curl_formadd to curl_mime_init .... as the logic is completely different. thanks

@monnerat
Copy link
Contributor Author

it would be very nice to give some examples of how to convert curl_formadd to curl_mime_init .... as the logic is completely different. thanks

Well... this is a doc request and should be set in a separate issue, as it is not related to introducing conditional compilation for form api.

FYI, there are files docs/examples/postit2.c and docs/examples(postit2-formadd.c that both implement the same form filling using mime and form api respectively. Similarly you can compare docs/examples/multi-post.c and docs/examples/multi-formadd.c.

@monnerat
Copy link
Contributor Author

monnerat commented Jun 4, 2023

@bagder: what about this PR? this is essentially the introduction of form api conditional compilation like 860ca31 did for mime and does not affect builds with default options.

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.
@bagder bagder closed this in 038c46f Jul 31, 2023
@bagder
Copy link
Member

bagder commented Jul 31, 2023

Thanks, and sorry for taking so long.

@monnerat monnerat deleted the deprecate-formapi branch July 31, 2023 08:38
ptitSeb pushed a commit to wasix-org/curl that referenced this pull request Sep 25, 2023
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 curl#9621
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants