{"thread":{"id":"37614","subject":"[Bug] Query string not being phrased correctly when question marks present in config URL.","startedAt":"2014-09-22T18:20:55Z","lastAt":"2014-09-23T09:06:27Z","messageCount":2,"participants":["Steven Lawler","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"249745","messageId":"CAOf__z5DTzchZpnz-DzoOEHnt8RdypV7=RPP1=AzinsskQEg8w@mail.gmail.com","threadId":"37614","inReplyTo":null,"subject":"[Bug] Query string not being phrased correctly when question marks present in config URL.","fromName":"Steven Lawler","fromEmail":"steven.lawler777@gmail.com","sentAt":"2014-09-22T18:20:55Z","receivedAt":"2014-09-22T18:20:55Z","isPatch":false,"sender":{"key":"steven.lawler777@gmail.com","avatar":null},"body":"Cause:\n[remote \"repo\"]\n  url = http://example.com/git/example.com?foo=bar\nThere is a question mark in the URL of the repo URL.\n\nEffect (Taken from Apache logs):\n[22/Sep/2014:14:12:07 -0400] \"GET\n/git/example.com?foo=bar/info/refs&service=git-receive-pack HTTP/1.1\"\n403 207 \"-\" \"git/1.9.4.msysgit.1\"\n\nGit attempts to correct the issue by making the query string continue\nusing ampersands where it would have started the original query\nstring.\n\nExpected outcome:\nThe git client should move the ?foo=bar onto the beginning (or end) of\nthe query string that it is creating. For example:\n[22/Sep/2014:14:12:07 -0400] \"GET\n/git/example.com/info/refs?foo=bar&service=git-receive-pack HTTP/1.1\"\n403 207 \"-\" \"git/1.9.4.msysgit.1\"\n\nThis is caused on the git client, double checked with Wireshark. I\nhave not tested this on HTTPS, but imagine the output is the same.\n"},{"id":"249779","messageId":"20140923090627.GB7644@peff.net","threadId":"37614","inReplyTo":"CAOf__z5DTzchZpnz-DzoOEHnt8RdypV7=RPP1=AzinsskQEg8w@mail.gmail.com","subject":"Re: [Bug] Query string not being phrased correctly when question marks present in config URL.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-09-23T09:06:27Z","receivedAt":"2014-09-23T09:06:27Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 23, 2014 at 04:20:55AM +1000, Steven Lawler wrote:\n\n> Cause:\n> [remote \"repo\"]\n>   url = http://example.com/git/example.com?foo=bar\n> There is a question mark in the URL of the repo URL.\n\nIs the question mark there because it is separating query parameters\nfrom the path, or is \"?foo=bar\" part of the literal path? If the latter,\nit needs to be percent-escaped.\n\n> Effect (Taken from Apache logs):\n> [22/Sep/2014:14:12:07 -0400] \"GET\n> /git/example.com?foo=bar/info/refs&service=git-receive-pack HTTP/1.1\"\n> 403 207 \"-\" \"git/1.9.4.msysgit.1\"\n> \n> Git attempts to correct the issue by making the query string continue\n> using ampersands where it would have started the original query\n> string.\n\nIt has to, because:\n\n  http://example.com/git/example.com?foo=bar?service=git-receive-pack\n\nwould not mark the \"service\" parameter as a separate parameter of the\nquery-string.  However, from your expected output below, I do not think\nthat part is the thing you are complaining about:\n\n> Expected outcome:\n> The git client should move the ?foo=bar onto the beginning (or end) of\n> the query string that it is creating. For example:\n> [22/Sep/2014:14:12:07 -0400] \"GET\n> /git/example.com/info/refs?foo=bar&service=git-receive-pack HTTP/1.1\"\n> 403 207 \"-\" \"git/1.9.4.msysgit.1\"\n\nThe difference here is not the ampersand but the placement of\n\"info/refs\".  Let's forget about the \"service\" parameter for a moment.\nGit needs to access the \"info/refs\" directory of the repo specified by\nthe URL it is passed. Given:\n\n  http://host/path?key=value\n\nwhich part of the URL specifies the path to the repository (and that we\ncould munge to access info/refs)? I do not think there is a well-defined\nanswer. If \"path\" is the path to the repo and \"key=value\" is an\nunrelated parameter, you would want:\n\n  http://host/path/info/refs?key=value\n\nwhich matches your example. But if the key is specifying the repository\npath in its value, you would want to append it directly there. For\nexample,\n\n  http://host/git?path=my-repo.git\n\nshould become:\n\n  http://host/git?path=my-repo.git/info/refs\n\nSo I think you would need a config option or other mechanism to specify\nwhich form your URL requires.\n\n-Peff\n"}]}