Network.requestWillBeSentExtraInfo - indeterminate attribution on redirects

35 views
Skip to first unread message

Matt Fysh

unread,
Apr 11, 2020, 11:46:49 PM4/11/20
to chrome-debugging-protocol
From the docs:

Not every requestWillBeSent event will have an additional requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent or requestWillBeSentExtraInfo will be fired first for the same request.

If this is true for a redirect request (with a single request ID), it is not possible to determine which real http request this event belongs to. You may have the following two scenarios when a redirect occurs:

Scenario 1. Request ID = X
  1. original url requestWillBeSent
  2. original url requestWillBeSentExtraInfo
  3. redirect url requestWill Be Sent

Scenario 2. Request ID = Y
  1. original url requestWillBeSent
  2. redirect url requestWillBeSentExtraInfo
  3. redirect url requestWill Be Sent

When you receive the `requestWillBeSentExtraInfo` event, how do you know which URL it should be attributed to? It must belong to either the original URL, or the redirect URL, but after inspecting the event payloads I can't see any data that will let you determine which scenario you are in.

Thanks,

Andrey Kosyakov

unread,
Apr 13, 2020, 3:26:38 PM4/13/20
to Matt Fysh, Joey Arhar, chrome-debugging-protocol
+Joey Arhar who may provide some additional insights on the subject.

I think what the doc implies by "Not every requestWillBeSent event will have an additional requestWillBeSentExtraInfo fired for it" is that some requests may not get to the network layer at all (e.g. be blocked, served by a service worker or be handled by a scheme other than http(s)). We generally expect that if a request got to the network layer so as to produce requestWillBeSentExtraInfo, the subsequent redirects will do the same, so the correct way to handle the events on the client side would be to keep all events of the same type associated with given requestId ordered by their natural order of reception, then assume the first requestWillBeSent corresponds the first requestWillBeSentExtraInfo and responseReceivedExtraInfo, the second requestWillBeSent matches the second requestWillBeSentExtraInfo and so on. Check out RedirectExtraInfoBuilder to see how the DevTools front-end handles the reassembly of the info from multiple events.

Best regards,
Andrey.



--
You received this message because you are subscribed to the Google Groups "chrome-debugging-protocol" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-debugging-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chrome-debugging-protocol/5a5da550-c532-457b-8b43-8a0fc5e518f8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages