Skip to content

Error when location contains space #4445

Closed
@momala454

Description

@momala454

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

Activity

bagder

bagder commented on Oct 1, 2019

@bagder
Member

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.

self-assigned this
on Oct 1, 2019
added a commit that references this issue on Oct 1, 2019
1b43300
bagder

bagder commented on Oct 1, 2019

@bagder
Member

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.

locked as resolved and limited conversation to collaborators on Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @momala454@bagder

    Issue actions

      Error when location contains space · Issue #4445 · curl/curl