Skip to content
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

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

Merged
merged 4 commits into from
Jan 6, 2024

Conversation

MC-Squared
Copy link
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
Member

route commented Nov 17, 2023

Could you add a proper test with tag?

@route
Copy link
Member

route commented Nov 25, 2023

ping

@MC-Squared
Copy link
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
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
10 checks passed
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