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

Error when location contains space #4445

Closed
momala454 opened this issue Oct 1, 2019 · 2 comments

Comments

@momala454
Copy link

commented Oct 1, 2019

I did this

curl "https://annuaire.118712.fr/ppart/Paris-75/Paris-75005/Coutinho_aida-0633685195_7%200080S00006F80400R70720S" -vL

returned data :
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 01 Oct 2019 01:07:37 GMT
< Server: Apache
< Strict-Transport-Security: max-age=3600; includeSubdomains
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Access-Control-Max-Age: 1000
< Access-Control-Allow-Headers: x-requested-with, Content-Type, origin, authorization, accept, client-security-token
< Status: 301 Moved Permanently
< Location: https://annuaire.118712.fr/ppart/Paris-75/Paris-75005/Coutinho_aida-JFCCFHEAIE_7 0080S00006F80400R70720S
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=utf-8

I expected the following

On web browsers, the url redirect to https://annuaire.118712.fr/ppart/Paris-75/Paris-75005/Coutinho_aida-JFCCFHEAIE_7 0080S00006F80400R70720S and the space in that url is handled. But on curl the space is not url encoded which cause the website to return :
HTTP/1.1 400 Bad Request

curl/libcurl version

curl -V
curl 7.66.0 (x86_64-pc-win32) libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 WinIDN libssh2/1.9.0 nghttp2/1.39.2
Release-Date: 2019-09-11
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP brotli libz

operating system

windows 10

@bagder

This comment has been minimized.

Copy link
Member

commented Oct 1, 2019

I can reproduce this problem when the redirect is to an absolute URL. If it redirects to a relative path curl URL encodes path components with embedded spaces. I'm on it.

@bagder bagder self-assigned this Oct 1, 2019
bagder added a commit that referenced this issue Oct 1, 2019
... to make it handle for example (RFC violating) embeded spaces.

Reported-by: momala454 on github
Fixes #4445
@bagder bagder removed the regression label Oct 1, 2019
@bagder

This comment has been minimized.

Copy link
Member

commented Oct 1, 2019

I don't think this is a regression. I think it never worked with spaces in absolute URLs.

It should be noted that spaces are not allowed in URLs per RFC 3986 which is the primary spec defining curl's URL parsing.

@bagder bagder closed this in c6f250c Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.