Skip to content

Fix: Do not expect response for initiatorType Ping requests#417

Merged
route merged 4 commits intorubycdp:mainfrom
MC-Squared:fix/ping-requests
Jan 6, 2024
Merged

Fix: Do not expect response for initiatorType Ping requests#417
route merged 4 commits intorubycdp:mainfrom
MC-Squared:fix/ping-requests

Conversation

@MC-Squared
Copy link
Copy Markdown
Contributor

@MC-Squared MC-Squared commented Nov 16, 2023

Motivation

HTML supports adding a ping attribute to <a> tags. In such cases, the browser sents a POST request to the set URL(s) before navigating to the new URL (See w3schools doc here and Mozilla docs on initiatorType which includes ping as an option).
Unfortunately, because these requests do not receive a server response Ferrum adds them to the list of pending_connections, meaning that subsequent calls to wait_for_idle will timeout waiting for these never-will-complete requests.

Changes

  • Add Request#response_expected? method to indicate if the request expects a response from the server (currently 'ping' is the only request I know of that would not get a response)
  • Add Exchange#response_expected? that calls the request method. Note, if request.nil? we default to true to match the current behaviour
  • Update Exchange#finished? so that any requests that do not expect responses are now also considered 'finished'

@route
Copy link
Copy Markdown
Member

route commented Nov 17, 2023

Could you add a proper test with tag?

@route
Copy link
Copy Markdown
Member

route commented Nov 25, 2023

ping

@MC-Squared
Copy link
Copy Markdown
Contributor Author

Updated - I have guessed a bit on where best to locate the new specs so if they need to be moved/re-arranged just let me know

@route
Copy link
Copy Markdown
Member

route commented Jan 6, 2024

Thanks! Merging, though I have some patch to apply on it after merging.

@route route merged commit b5a5ae8 into rubycdp:main Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants