Skip to content

curl_formdata: fix to pass long where missing, document CURLFORM_NAMELENGTH#22017

Closed
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:CURLFORM_NAMELENGTH
Closed

curl_formdata: fix to pass long where missing, document CURLFORM_NAMELENGTH#22017
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:CURLFORM_NAMELENGTH

Conversation

@vszakats

@vszakats vszakats commented Jun 15, 2026

Copy link
Copy Markdown
Member

https://github.com/curl/curl/pull/22017/files?w=1

There is also this in lib650, I couldn't trace back in source
if size_t is correct or should be long (I'd guess it's the
latter):

  formarray[1].option = CURLFORM_CONTENTSLENGTH;
  formarray[1].value = (char *)(size_t)contentlength;

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens correctness and consistency around the deprecated curl_formadd() form API by ensuring options that expect long are documented/passed as long, and by cleaning up a few documentation/examples.

Changes:

  • Update docs/examples to explicitly pass long to CURLFORM_BUFFERLENGTH and document CURLFORM_NAMELENGTH.
  • Fix tests/libtest/lib650.c to pass a long for CURLFORM_NAMELENGTH (and simplify an interim variable).
  • Minor whitespace/style cleanups in docs and comments.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/libtest/lib650.c Fixes CURLFORM_NAMELENGTH argument type to long in the test and simplifies length handling.
lib/formdata.c Adjusts an internal comment example to use 10L and cleans whitespace.
docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.md Formatting/whitespace tweak in an example.
docs/libcurl/curl_formadd.md Adds CURLFORM_NAMELENGTH section and fixes CURLFORM_BUFFERLENGTH example to cast to long.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/libcurl/curl_formadd.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

@testclutch

This comment was marked as outdated.

@vszakats vszakats marked this pull request as ready for review June 15, 2026 12:49
@vszakats vszakats force-pushed the CURLFORM_NAMELENGTH branch from 94be47b to 504be0a Compare June 15, 2026 14:47
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.

3 participants