Hacker News new | ask | show | jobs
by llimllib 38 days ago
> curl, for example, seems to illegitimately strip a trailing question mark (could be only for the command line, didn’t test library usage).

umm what? I don't know what they're actually sending where they think this, but if you think curl is broken you should re-think that maybe you're the one doing something wrong.

Here are some examples showing curl not stripping question marks (obviously), I am very curious what this person was actually seeing

    $ curl -s 'https://httpbingo.org/get?' | jq .url
    "https://httpbingo.org/get?"
    $ curl -s 'https://httpbingo.org/get?path' | jq .url
    "https://httpbingo.org/get?path"
    $ curl -s 'https://httpbingo.org/get?path,query=bananas' | jq .url
    "https://httpbingo.org/get?path,query=bananas"
    $ curl -s 'https://httpbingo.org/get????' | jq .url               
    "https://httpbingo.org/get????"
    $ curl -sv 'https://httpbingo.org/????' 2>&1 | grep :path
    * [HTTP/2] [1] [:path: /????]
1 comments

  $ curl -s 'https://httpbingo.org/get?' | jq .url
  "https://httpbingo.org/get"
This may require further investigation.
From Debian 13.2 (Trixie) + Bash + curl 8.14.1:

  $ curl -s 'https://httpbingo.org/get?' | jq .url
  "https://httpbingo.org/get"
But on macOS + Bash/Zsh + curl 8.7.1:

  $ curl -s 'https://httpbingo.org/get?' | jq .url
  "https://httpbingo.org/get?"
I see some related changes here: https://github.com/curl/curl/commit/3eac21d
Interesting! I took a look with the agent and it looks like it was this change that went in at curl 8.8.0: https://github.com/curl/curl/commit/3eac21d86bc50ba459a9a8a0... (same one susam saw)

There's a flag that would preserve it, but no way to set it from the CLI afaict

edit: I started a discussion here: https://github.com/curl/curl/discussions/21544

Might be shell expansion? zsh uses `?` for filename expansion, others might as well: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Filena...

Though I forget if any shell does stuff like that in quotes. Or printing oddities.

No, it’s definitely curl that’s doing it.

  $ echo 'https://httpbingo.org/get?'
  https://httpbingo.org/get?
  $ python
  >>> import json
  >>> import subprocess
  >>> json.loads(subprocess.run(['curl', '-s', 'https://httpbingo.org/get?'], stdout=subprocess.PIPE).stdout)['url']
  'https://httpbingo.org/get'
I’m using curl 8.20.0-3, Arch Linux, x86_64.

  $ curl --version
  curl 8.20.0 (x86_64-pc-linux-gnu) libcurl/8.20.0 OpenSSL/3.6.2 zlib/1.3.2 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.69.0 ngtcp2/1.22.1 nghttp3/1.15.0 mit-krb5/1.21.3
  Release-Date: 2026-04-29
  Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt mqtts pop3 pop3s rtsp scp sftp smtp smtps telnet tftp ws wss
  Features: alt-svc brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
bagder merged a fix to curl in response to my report: https://github.com/curl/curl/commit/b079595f2e903b820a027a68...

Sorry for not believing you initially! I'm very surprised that was in there