Repository navigation
upload: follow a redirect, take an early answer, and give up on a frozen upload (#232) - #233
Conversation
…zen upload (#232) From a network that cuts connections to openipc.org after their first kilobytes, `ipctool upload` with a backup sat at "Sending 0%" for minutes, and through another --host it reported "openipc.org answered 502" for an answer openipc.org never gave. - After the headers, wait up to 2 s for an answer before sending the body. A server that redirects or refuses says so at once, and the answer to the headers gets back where a body would not. - Follow a 307/308 to a plain http:// address, up to three hops, with the same body. openipc.org can then send a cut-off network's report where it gets through, and nothing in ipctool names that place. - A send that cannot place a byte for 30 s is a stall: wait 10 s for an answer, then say the upload stopped moving and that --host can send it another way, instead of "Could not reach" after several minutes. Waited through poll(), since SO_SNDTIMEO restarts whenever a few bytes squeeze in. - An answer with no explanation no longer names openipc.org.
PR Summary by QodoHandle upload redirects, early responses, and stalled sends
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
…pc.org - A 307/308 to another host is followed only from openipc.org, the destination the owner agreed to send the report and maybe the whole flash to; where it forwards its own reports is part of that. Any other --host may move the report within its own name, and otherwise ipctool says where it was sent and that --host can send it there. - An interim 1xx before the body is not the answer: the body is sent and the 1xx skipped with the final answer. - A Location with a query and no path (http://h?x=1) keeps the query out of the host name; the fragment stays behind. - http_test: http_post() against servers forked on the loopback -- a redirect on the headers gets no body, the followed request delivers all 16 MB, a 100 Continue still gets the body, and a server that never reads is ERR_STALLED in seconds. The timeouts are variables so the test can shorten them. Run by the unit-tests job.
* Send a cut-off network's ipctool report to openipc.ru with a 307 From a network the TSPU cuts off, a report with a flash backup sent to openipc.org's port 80 froze at its first kilobytes and sat at "Sending 0%" (OpenIPC/ipctool#232). Port 80 now answers it with `307 http://openipc.ru/api/v1/reports`, whose port 80 proxies it back here, as it already does for ipctool's downloads (#397). 307 keeps the POST and its body. ipctool since OpenIPC/ipctool#233 waits for an answer to the headers before sending the body and follows a plain-HTTP 307, so a plain `ipctool upload` gets through from Russia with no --host. An older one reports the 307 and stops, which is quicker than the freeze. Install after #233 is in the published ipctool. Identify stays: a few kilobytes, which the freeze lets through. * Blocked nets: say port 80 sends the report with a 307 too Qodo on #422: the geo block's comment still said port 80's report upload was left alone.
From a network that cuts connections to openipc.org after their first
kilobytes,
ipctool uploadwith a backup sat at "Sending 0%" forminutes, and through another --host it reported "openipc.org answered
502" for an answer openipc.org never gave.
body. A server that redirects or refuses says so at once, and the
answer to the headers gets back where a body would not.
the same body. openipc.org can then send a cut-off network's report
where it gets through, and nothing in ipctool names that place.
answer, then say the upload stopped moving and that --host can send it
another way, instead of "Could not reach" after several minutes.
Waited through poll(), since SO_SNDTIMEO restarts whenever a few bytes
squeeze in.
Fixes #232.
Tested natively:
report_test(new cases for the redirect parser and the message), andhttp_postdriven against local servers. A 16 MB body to a server that answers 307 on the headers: no body is sent there, it is followed, and the second server gets all 16,777,216 bytes, 2.0 s in total. Against a server that never reads: ERR_STALLED after 42 s (2 + 30 + 10), where it used to sit for minutes. The cross builds are left to CI.The website side (openipc.org's port 80 answering a cut-off network's report with a 307) is OpenIPC/website, to install once this is in the published ipctool.