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
Closed

Error when location contains space #4445

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

Comments

@momala454
Copy link

momala454 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
Copy link
Member

bagder 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
Copy link
Member

bagder 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 as completed in c6f250c Oct 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

2 participants