w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

network.continueRequest can create invalid requests (eg w/ http2) #735

Open juliandescottes opened 1 week ago

juliandescottes commented 1 week ago

Related to the following bug https://bugzilla.mozilla.org/show_bug.cgi?id=1904317.

Network interception commands such as continueRequest allow to override headers list. As soon as a non-null value is provided for headers, it will fully replace the original headers of the request.

If the request is using http2 and the headers no longer contain some headers such as the host header, in Firefox the request will fail due to security checks. However the continueRequest command itself was successful, so unless you are monitoring fetchError events or directly looking at the automated browser, it might be difficult to understand why the request doesn't seem to succeed.

The safe approach to using those commands is usually to merge the original request headers with custom ones, and use this merged list as the override. But when you first start using the command, it can be difficult to figure out.

First we should check how other browsers (so Chrome here) behave in this scenario.

Second, we should decide how we can make the developer experience smoother here. Some options include:

whimboo commented 6 days ago

@juliandescottes thanks for filing. Would it be easy enough to get a wdspec test added and checked in CI how Chrome behaves?

For Safari, we cannot test due to the missing BiDi implementation. Perhaps @gsnedders could give some info for this.