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

Difference in GM_xhr responseHeaders between FF 5.1.1 and Chrome 5.2.3 #2160

Open
perpil opened this issue Aug 17, 2024 · 3 comments
Open

Difference in GM_xhr responseHeaders between FF 5.1.1 and Chrome 5.2.3 #2160

perpil opened this issue Aug 17, 2024 · 3 comments

Comments

@perpil
Copy link

perpil commented Aug 17, 2024

The responseHeaders returned with GM_xmlhttpRequest include \r in FF TM 5.5.1 and don't in Chrome 5.2.+.

This can be worked around, but raising in case it is unintentional.

Expected Behavior

Behavior is consistent across browsers.

Actual Behavior

FF has \r\n as responseHeaders delimiter, Chrome just has \n.

Specifications

  • Chrome 127.0.6533.120/TM 5.2.0 and 5.2.3
  • FF 129.0.1/TM 5.1.1
  • OS: Mac Os 14.5

Script

// ==UserScript==
// @name         HTTP Header in xmlhttpRequest
// @namespace    http://tampermonkey.net/
// @version      2024-08-17
// @description  try to take over the world!
// @author       You
// @grant        GM_xmlhttpRequest
// @match        https://github.com/
// @connect      self
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com
// ==/UserScript==

(async function() {
    'use strict';

  await GM_xmlhttpRequest({
  method: "GET",
  url: "https://github.com/",
  onload: function(response) {
    console.log(`Headers includes \\r?: ${response.responseHeaders.includes('\r')}`);
  }
});
})();

Run this on https://github.com and look in the console in both Firefox and Chrome. Chrome will print false, FF will print true.

@peterpham
Copy link

Observe the same behaviour.
This breaks some of our logic to parse headers and caused incompatibility.

@derjanb derjanb added the bug label Aug 29, 2024
@derjanb derjanb added this to the 5.3 milestone Aug 29, 2024
@derjanb
Copy link
Member

derjanb commented Sep 5, 2024

Should be fixed at 5.3.6209 (crx|xpi in review)

Please download the crx file linked above and drag and drop it to the extensions page chrome://extensions (after you've enabled 'Developer Mode').

For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.

@trim21
Copy link

trim21 commented Sep 9, 2024

Didn't try beta version, not sure how tampermonkey fix this.

Just want to add some context: RFC says HTTP header should always use CRLF as line break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants