Closed Bug 1367177 Opened 2 years ago Closed 2 years ago

webRequest.onBeforeSendHeaders event fires too early, before the request is finalized

Categories

(WebExtensions :: Request Handling, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1368527

People

(Reporter: gaubugzilla, Unassigned)

References

Details

(Whiteboard: [webRequest] triaged)

In Chrome, webRequest.onBeforeSendHeaders event fires as late as possible. In fact, the documentation states that a TCP connection might already be established at this point and merely data hasn't been sent yet. This is not the case for the Firefox implementation which uses the http-on-modify-request observer notification. If you look at the code (https://dxr.mozilla.org/mozilla-central/rev/5bc1c758ab57c1885dceab4e7837e58af27b998c/netwerk/protocol/http/nsHttpChannel.cpp#6274), there is plenty of stuff happening after http-on-modify-request, e.g. the Connection header is being added. Also, HSTS is applied after http-on-modify-request meaning that you might see an HTTP URL even though the request goes to HTTPS. This part actually prevents porting my Enforce Encryption extension to Web Extensions even though the port works well in Chrome.
Flags: needinfo?(mixedpuppy)
Depends on: 1368527
Flags: needinfo?(mixedpuppy)
See Also: → 1353489
shane is discussing in bug 1353489, dependency bug 1368527 seems like root cause for both
Flags: needinfo?(mixedpuppy)
Priority: -- → P3
Whiteboard: [webRequest] triaged
simplifying
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(mixedpuppy)
Resolution: --- → DUPLICATE
Duplicate of bug: 1368527
See Also: → 1418275
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.