Commits


redo "got-fetch-http: fix GET request URL", without breaking tests My previous fix for ~user in SSH URLs broke ~user in HTTP URLs, as used on sourcehut. Sanitize the amount of leading and embedded slashes in URLs to make things work in all cases. The root cause of the test problem with naddy's previous diff was likely in the http-server script itself, where a request like GET //repo//info/refs?service=git-upload-pack somehow ended up as GET $testroot///info/refs. We work around this here by avoiding the double slashes.


got-fetch-http: backout GET request URL fix It broke the clone regression test.


got-fetch-http: fix GET request URL Add a leading '/' and do not produce a double "//" after the path. ok op


fix got-fetch-http when chunked encoding is not used We would end up raising a spurious error when the server had no more data to send and would abort the clone operation, while everything was fine in fact. Problem reported by vazub via IRC, thanks!


Use got_pkt_readlen() to parse pkt-lens.


make got-fetch-http pass "done\n" through rather than faking it Without this we exit the loop early and got-fetch-pack sees unexpected end-of-file on stdout trying to write its final "done\n" message. ok op@


fix previous; pledge("stdio") must wait until after the TLS handshake


use pledge("stdio") late in got-fetch-http, currently as early as possible


remove dead code under DEBUG_HTTP; ok op@


use unveil to restrict filesystem access of got-fetch-http With HTTPS we only need to be able to read /etc/ssl/cert.pem. With plaintext HTTP no filesystem access is needed at all.


can drop "rpath" pledge in got-fetch-http if plaintext HTTP is being used


ensure that a pkt-line fits into read buffers used by got-fetch-http


add missing \n to got-fetch-http debug output


revert my previous two commits because they broke clone over http


make got-fetch-http get_refs() understand when packet lines end Previously it would only exit the loop when reading failed. ok tobhe@


log pkt lines read and written by got-fetch-http, in verbose mode


add comments to the HTTP fetching process which clarify how it works


Remove some dead code


Rewrite got-fetch-http I/O using bufio API. This should help make the code more portable supports almost everything we need out of the box. pledge needs the rpath promise because of libtls. This was technically also the case with the old API but we didn't actually enable pledge thanks to DEBUG_HTTP. The synchronous bufio wrappers should probably move to lib/bufio.c in the future. ok and feedback from op@


improve got-fetch-http request/response logging in verbose mode


Rename got-http helper to got-fetch-http to match naming scheme. We aren't planning to support sending anyway. ok stsp@