-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fetch upload test on HTTP 421 response. #27322
Conversation
Don't we need a test for a non streaming request? |
I think so, but how might we test that requests should be sent twice? |
Added a test for a non streaming request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It's difficult to check the connection identity.
We should also test the service worker responding with with this status code. |
Added service worker test. |
@yoichio in #24965 @MattMenke2 added connection tests and I suspect you could use similar infrastructure here to determine that the connection was not reused. |
Used network-partition-key.py to check connection reuse. |
I don't understand the question. I don't know what port id is. |
I want to test if fetch on 421 response retries fetching same request with new connection. |
network-partition-key.py does create a stash containing one entry for each client address+port, and assumes they aren't reused across sockets. OSes typically assign TCP ports in a sequential order (which isn't great...), so client ports are typically not reused for the duration of the test. There's never a guarantee that a connection will definitely be reused between two requests. I'm not sure what this test is doing or why it cares about socket reuse, or perhaps I could be of more help. |
Thanks. I'm confused between connection, socket and port. I'd like to confirm fetch on 421 does retry on new connection in any way. |
I'm not sure exactly what you're trying to do. Your current modifications to network-partition-key.py look to be counting the total number of requests use a particular uuid, across all connections. Do you want to know the total number of requests use a particular connection instead? |
Yes. |
Sorry for being a bit slow on the uptake. So "address_key" identifies the connection. So something like ++server_state[address_key + b"connection_count"] should work, assuming you initialize it to 0. Or perhaps better, could make a dictionary for each address key with connection count and partition_id fields, and just increment the count on each use (At least I believe recursive dictionaries work with the API used to store state). |
Thanks. |
@annevk, could you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good modulo nit.
Co-authored-by: Anne van Kesteren <[email protected]>
In particular, with a request body stream, the response will be returned to the caller as we do not support retries with streams. Tests: web-platform-tests/wpt#27322.
Following whatwg/fetch#982,
fetch upload streaming on 421 (Misdirected Request) should be rejected.