Cannot determine OHTTP proxy return status code if proxy rejects with 429 or similar
Categories
(Core :: Networking: HTTP, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox120 | --- | fixed |
People
(Reporter: Gijs, Assigned: valentin)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [necko-triaged])
Attachments
(1 file)
OHTTP channels' response header and response status handling code returns NS_ERROR_NOT_AVAILABLE if there is no binary http response (ie no encapsulated response from the gateway that was handed over by the proxy).
This means that if the proxy returns nothing combined with a 4** or 5** error code, I think we hit: https://searchfox.org/mozilla-central/rev/077fc34d03b85b09add26b5f99f1a3a3a72c8720/netwerk/protocol/http/ObliviousHttpChannel.cpp#693-696
nsresult ObliviousHttpChannel::ProcessOnStopRequest() {
if (mRawResponse.IsEmpty()) {
return NS_OK;
}
and never set mBinaryHttpResponse
, consumers cannot determine the HTTP response code from the proxy. This is bad because it means we cannot do any differentiated error handling on the client side based on the proxy's response.
Valentin, per bug 1845519 comment 3, do you have concrete ideas on how to more clearly separate the outer/inner request status/response headers?
Assignee | ||
Comment 1•1 year ago
|
||
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
Gijs, the patch I attached allows you to inspect the innerChannel (HTTP channel).
I imagine it would work something like this:
let httpStatus = request.QueryInterface(
Ci.nsIObliviousHttpChannel
).innerChannel.responseStatus;
if (httpStatus == 200) {
...
let ohttpStatus = request.QueryInterface(
Ci.nsIHttpChannel
).responseStatus;
}
Let me know if that works or if you prefer something else.
Assignee | ||
Updated•1 year ago
|
Comment 4•1 year ago
|
||
bugherder |
Description
•