remote-curl smart-http discovery cleanup
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 9 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | remote-curl: refactor smart-http discoveryremote-curl.c | +59 | 4 replies | |
| 1/3 | remote-curl: refactor smart-http discoveryremote-curl.c | +57 | 3 replies | |
| 2/3 | remote-curl: tighten "version 2" check for smart-httpremote-curl.c | +1 | 1 reply | |
| 2/3 | remote-curl: tighten "version 2" check for smart-httpremote-curl.c | +1 | 0 replies | |
| 3/3 | remote-curl: die on server-side errorsremote-curl.c t/ t/ +2 more | +16 | 0 replies | |
| 3/3 | t5551: test server-side ERR packett/ t/ t/ +1 more | +13 | 0 replies |
Reviews trailers per patch
4 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Josh Steadmon |
|---|---|
| Series | Helped-by |
| 1/3 | Helped-by R-b Helped-by |
| 1/3 | Helped-by R-b Helped-by |
| 2/3 | R-b |
| 2/3 | R-b |
| 3/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] remote-curl smart-http discovery cleanup
Quoted 9 lines · Josh Steadmon
Quoted 5 lines
This patch tightens both of those (I also made a few stylistic tweaks, and added the ERR condition to show where it would go). I dunno. Part of me sees this as a nice cleanup, but maybe it is better to just leave it alone. A lot of these behaviors are just how it happens to work now, and not part of the spec, but we don't know what might be relying on them.
At least according to the protocol-v2 and http-protocol docs, the stricter behavior seems correct:
Quoted 8 lines
For the first point above, dumb servers should never use an "application/x-git-*" content type (http-protocol.txt line 163-167).
For the second point, the docs require v2 servers to use "application/x-git-*" content types. protocol-v2.txt lines 63-65 state that v2 clients should make a smart http request, while http-protocol.txt lines 247-252 state that a smart server's response type must be "application/x-git-*".
Thanks for digging into the spec. I agree that it's pretty clear that the appropriate content-type is expected.
Quoted 3 lines
Of course we don't know if other implementations follow the spec, but ISTM that this patch at least doesn't contradict how we've promised the protocols should work.
These seem like pretty unlikely ways for a buggy server to behave, so I think it's a reasonable risk. I also checked GitHub's implementation (which recently learned to speak v2) and made sure that it works. :) I didn't check JGit, but given the provenance, I assume it's fine.
Amusingly, this does break the test you just added, because it tries to issue an ERR after claiming "text/html" (and after my patch, we correctly fall back to dumb-http).
Quoted 2 lines
If no one has any objections, I'll include the diff below in v2. Thanks for the help Jeff!
I think it makes sense to do the refactoring first as a separate step. And of course it needs a commit message. So how about this series (your original is rebased on top)?
[1/3]: remote-curl: refactor smart-http discovery [2/3]: remote-curl: tighten "version 2" check for smart-http [3/3]: remote-curl: die on server-side errors
remote-curl.c | 96 +++++++++++++++++++++------------ t/lib-httpd.sh | 1 + t/lib-httpd/apache.conf | 4 ++ t/lib-httpd/error-smart-http.sh | 3 ++ t/t5551-http-fetch-smart.sh | 5 ++ 5 files changed, 75 insertions(+), 34 deletions(-) create mode 100644 t/lib-httpd/error-smart-http.sh
-Peff