msysgit / git

msysGit-based Git for Windows 1.x is now superseded by Git for Windows 2.x
http://github.com/git-for-windows/git
Other
1.01k stars 316 forks source link

URL parameters passed to curl/wget are incorrectly subject to Windows path mangling #250

Closed JasonGross closed 10 years ago

JasonGross commented 10 years ago
D:\Documents\GitHub\HoTT [refl-subu-prod +4 ~0 -0 !]> sh
sh.exe"-3.1$ curl -v 'http://google.com?foo=/foo'
* Adding handle: conn: 0x4a8668
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x4a8668) send_pipe: 1, recv_pipe: 0
* About to connect() to google.com port 80 (#0)
*   Trying 4.53.56.93...
* Connected to google.com (4.53.56.93) port 80 (#0)
> GET /?foo=C:/Users/Jason/AppData/Local/GitHub/PortableGit_6d98349f44ba975cf6c762a720f8259a267ea445/foo HTTP/1.1
> User-Agent: curl/7.30.0
> Host: google.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/?foo=C:/Users/Jason/AppData/Local/GitHub/PortableGit_6d98349f44ba975cf6c762a720f8259a
67ea445/foo
< Content-Type: text/html; charset=UTF-8
< Date: Thu, 18 Sep 2014 00:09:01 GMT
< Expires: Sat, 18 Oct 2014 00:09:01 GMT
< Cache-Control: public, max-age=2592000
* Server gws is not blacklisted
< Server: gws
< Content-Length: 316
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Alternate-Protocol: 80:quic,p=0.002
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/?foo=C:/Users/Jason/AppData/Local/GitHub/PortableGit_6d98349f44ba975cf6c762a720f8259a267
a445/foo">here</A>.
</BODY></HTML>
* Connection #0 to host google.com left intact

Note that it replaces ?foo=/foo with ?foo=C:/Users/Jason/AppData/Local/GitHub/PortableGit_6d98349f44ba975cf6c762a720f8259a 67ea445/foo. A workaround is to replace /foo with %2Ffoo.

sschuberth commented 10 years ago

Please report this to upstream MinGW / MSYS.

t-b commented 10 years ago

Yes that is msys path mangling on duty. Unfortunately there is little we can do here, as /foo really looks like a path.

JasonGross commented 10 years ago

Reported upstream.

dscho commented 10 years ago

Reported upstream.

Thanks, @JasonGross!