Skip to content

[DONE] tool: preserve the default protocol for schemeless uploads - #23402

Closed
cla7aye15I4nd wants to merge 2 commits into
curl:masterfrom
cla7aye15I4nd:zheng/curl-upload-default-scheme
Closed

cla7aye15I4nd wants to merge 2 commits into
curl:masterfrom
cla7aye15I4nd:zheng/curl-upload-default-scheme

Conversation

@cla7aye15I4nd

Copy link
Copy Markdown
Contributor

Appending a local filename to a schemeless upload URL currently serializes the guessed scheme. For example, curl --proto-default https -T secret.txt example.com/uploads/ can acquire an explicit http:// URL during filename handling, preventing the requested HTTPS default from taking effect.

Preserve the absence of an explicitly supplied scheme when serializing the updated URL by using CURLU_NO_GUESS_SCHEME. Subsequent protocol selection can then apply --proto-default, or perform normal guessing when no default was specified. Explicit schemes remain unchanged. This does not introduce protocol fallback.

Add regression test 3980: a schemeless ftp.test upload uses --proto-default http and a local HTTP proxy. The test checks the HTTP PUT request, demonstrating that the guessed FTP scheme does not override the selected HTTP default. This regression does not use HTTPS.

Validation on macOS ARM64, debug/static OpenSSL 3.6.3:

  • Test 3980 fails before the production fix and passes afterward.
  • Existing tests 2008, 2045, 10, 1639 and 1644 pass.
  • Six loopback checks cover HTTPS ClientHello selection, explicit HTTP, normal guessing, filename escaping, an existing filename and a query. The HTTPS probe verifies TLS protocol selection, not a completed TLS handshake or HTTPS upload.
  • Build, checksrc and whitespace checks pass. Cross-platform and full-suite validation remain pending.

AI assistance was used to investigate, implement, and test this change.

@bagder bagder closed this in 2c04412 Oct 15, 2026
@bagder

bagder commented Oct 15, 2026

Copy link
Copy Markdown
Member

Thanks!

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.

2 participants