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

parseHeaders fails with multiple set-cookie headers in Firefox #928

Open
diegodlh opened this issue Mar 2, 2021 · 0 comments
Open

parseHeaders fails with multiple set-cookie headers in Firefox #928

diegodlh opened this issue Mar 2, 2021 · 0 comments

Comments

@diegodlh
Copy link

@diegodlh diegodlh commented Mar 2, 2021

I'm using @maxlath's wikibase-edit module which depends on cross-fetch, which in turn depends on github/fetch.

I'm developing a plugin for Zotero, which runs on Firefox's runtime environment.

At some point, an XMLHttpRequest is sent, which returns a response with multiple "set-cookie" headers. For some reason, these headers are concatenated (by getAllResponseHeaders() and getResponseHeader()) with \n instead of with \n\t or , . As a result, parseHeaders fails with Invalid character in header field name.

I tried running some test requests on a recent Firefox browser (v85.0). I used Firefox's Browser Toolbox to debug the browser's main process, because otherwise getAllResponseHeaders and getResponseHeader would ignore set-cookie headers. I set up an Apache web server to send duplicate set-cookie and MyHeader headers. In Apache config file:

  ...
  Header add set-cookie "value1"
  Header add set-cookie "value2"
  Header add MyHeader "value1"
  Header add MyHeader "value2"
  ...

Interestingly, whereas getResponseHeader('set-cookie') returns:

value1
value2

getResponseHeader('MyHeader') successfully returns value1, value2.

I don't know enough about the HTTP protocol to understand if this is a bug in Firefox, or if it is an accepted behavior and should be handled by github/fetch.

I understand this may be related to #489.

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

No branches or pull requests

1 participant