{"thread":{"id":"48765","subject":"[PATCH] protocol-v2 doc: put HTTP headers after request","startedAt":"2018-06-22T19:01:30Z","lastAt":"2018-06-22T20:47:28Z","messageCount":3,"participants":["Josh Steadmon","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"350756","messageId":"20180622190112.7559-1-steadmon@google.com","threadId":"48765","inReplyTo":null,"subject":"[PATCH] protocol-v2 doc: put HTTP headers after request","fromName":"Josh Steadmon","fromEmail":"steadmon@google.com","sentAt":"2018-06-22T19:01:12Z","receivedAt":"2018-06-22T19:01:30Z","isPatch":true,"sender":{"key":"steadmon@google.com","avatar":"https://avatars.githubusercontent.com/u/2654920?v=4"},"body":"HTTP servers return 400 if you send headers before the GET request.\n\nSigned-off-by: Josh Steadmon <steadmon@google.com>\n---\n Documentation/technical/protocol-v2.txt | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/Documentation/technical/protocol-v2.txt b/Documentation/technical/protocol-v2.txt\nindex 49bda76d2..f58f24b1e 100644\n--- a/Documentation/technical/protocol-v2.txt\n+++ b/Documentation/technical/protocol-v2.txt\n@@ -64,9 +64,8 @@ When using the http:// or https:// transport a client makes a \"smart\"\n info/refs request as described in `http-protocol.txt` and requests that\n v2 be used by supplying \"version=2\" in the `Git-Protocol` header.\n \n-   C: Git-Protocol: version=2\n-   C:\n    C: GET $GIT_URL/info/refs?service=git-upload-pack HTTP/1.0\n+   C: Git-Protocol: version=2\n \n A v2 server would reply:\n \n-- \n2.18.0.rc2.346.g013aa6912e-goog\n\n"},{"id":"350757","messageId":"20180622193757.GF12013@aiede.svl.corp.google.com","threadId":"48765","inReplyTo":"20180622190112.7559-1-steadmon@google.com","subject":"Re: [PATCH] protocol-v2 doc: put HTTP headers after request","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-06-22T19:37:57Z","receivedAt":"2018-06-22T19:38:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Josh Steadmon wrote:\n\n> HTTP servers return 400 if you send headers before the GET request.\n>\n> Signed-off-by: Josh Steadmon <steadmon@google.com>\n> ---\n>  Documentation/technical/protocol-v2.txt | 3 +--\n>  1 file changed, 1 insertion(+), 2 deletions(-)\n\nThanks.  Congrats on your first patch! ;-)\n\nTested using\n\n  openssl s_client -connect github.com:443\n\nwith input\n\n  GET /git/git/info/refs?service=git-upload-pack HTTP/1.0\n  Host: github.com\n  Git-Protocol: version=2\n\nwhich produces a 404 instead of the 400 that putting Git-Protocol\nin front would produce.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"350760","messageId":"20180622204722.GG12013@aiede.svl.corp.google.com","threadId":"48765","inReplyTo":"20180622193757.GF12013@aiede.svl.corp.google.com","subject":"Re: [PATCH] protocol-v2 doc: put HTTP headers after request","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-06-22T20:47:22Z","receivedAt":"2018-06-22T20:47:28Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n> Josh Steadmon wrote:\n\n>> HTTP servers return 400 if you send headers before the GET request.\n[...]\n> Tested using\n>\n>   openssl s_client -connect github.com:443\n>\n> with input\n>\n>   GET /git/git/info/refs?service=git-upload-pack HTTP/1.0\n>   Host: github.com\n>   Git-Protocol: version=2\n>\n> which produces a 404 instead of the 400 that putting Git-Protocol\n> in front would produce.\n\nI figured out how to produce a 200:\n\n\tprintf '%s\\r\\n' \\\n\t\t'GET /git/git/info/refs?service=git-upload-pack HTTP/1.0' \\\n\t\t'Host: github.com' \\\n\t\t'User-Agent: git/jrn-at-keyboard' \\\n\t\t'Git-Protocol: version=2' '' |\n\topenssl s_client -connect github.com:443 -quiet\n\nThe critical part is the User-Agent starting with git/.\n\nSo we should probably update Documentation/technical/http-protocol.txt\nto indicate that clients MUST have a user-agent string starting with\nGit/ to allow the kind of request routing that github does.\n\nThat's all orthogonal to this patch.  The patch still looks good to me.\n\nSincerely,\nJonathan\n"}]}