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

Don't remove trailing regular spaces from the "raw" response headers (issue 19205) #19214

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

Snuffleupagus
Copy link
Collaborator

This bug only seems to reproduce in Google Chrome, since browsers apparently sort response headers differently. When the issue occurs the "raw" response headers string looks like this:

content-length: 525404\r\ncontent-type: \r\n

and since we trim any leading/trailing white-space characters the "content-type" header isn't detected correctly, which thus leads to new Headers(...) throwing.

Hence we'll keep regular spaces at the end of the "raw" response headers string, while still removing all other kinds of trailing white-space characters.

Note: The response headers parsing was based on https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#examples

…(issue 19205)

This bug only seems to reproduce in Google Chrome, since browsers apparently sort response headers differently.
When the issue occurs the "raw" response headers string looks like this:
```
content-length: 525404\r\ncontent-type: \r\n
```
and since we trim *any* leading/trailing white-space characters the "content-type" header isn't detected correctly, which thus leads to `new Headers(...)` throwing.

Hence we'll keep regular spaces at the end of the "raw" response headers string, while still removing all other kinds of trailing white-space characters.

*Note:* The response headers parsing was based on https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#examples
@Snuffleupagus Snuffleupagus linked an issue Dec 11, 2024 that may be closed by this pull request
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/87106ade3acf564/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/20f696609fa2c15/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/87106ade3acf564/output.txt

Total script time: 2.45 mins

  • Unit Tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/20f696609fa2c15/output.txt

Total script time: 6.62 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit 3226169 into mozilla:master Dec 15, 2024
9 checks passed
@timvandermeij
Copy link
Contributor

Thanks!

@Snuffleupagus Snuffleupagus deleted the issue-19205 branch December 15, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Blob URL Error in PDF.js v4.7.76 and Above
3 participants