GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — hasCookieHeader works only when Cookie header is set as the last property of headers · Issue #3205 · greasemonkey/greasemonkey

hasCookieHeader works only when Cookie header is set as the last property of headers #3205

New issue
Copy link
New issue
Copy link
Closed
#3206
Closed
hasCookieHeader works only when Cookie header is set as the last property of headers#3205
#3206
Copy link
Milestone
4.14

Description

@syusui-s
syusui-s
opened on Feb 22, 2025
Issue body actions

hasCookieHeader in on-user-script-xhr.js hold the boolean value indicates whether the headers contains Cookie.

However, this variable holds true only if the Cookie is the last property of headers because the hascookieHeader will be overwritten with the new value for each loop.

Solution

In order to solve this problem, we can change the code like this:

  let hasCookieHeader = false;
  if (d.headers) {
    for (let prop in d.headers) {
      if (Object.prototype.hasOwnProperty.call(d.headers, prop)) {
        let propLower = prop.toLowerCase();
-        hasCookieHeader = (propLower === 'cookie');
+       hasCookieHeader ||= (propLower === 'cookie');
        if (gHeadersToReplace.includes(propLower)) {
          xhr.setRequestHeader(gDummyHeaderPrefix + propLower, d.headers[prop]);
        }
        else {
          xhr.setRequestHeader(prop, d.headers[prop]);
        }
      }
    }
  }

Activity

  1. arantius commented on Feb 22, 2025

    @arantius
    arantius
    on Feb 22, 2025
    Collaborator
    More actions

    Good find! Would you like to submit a pull request?

    Reacted by Shusui MOYATANI
  2. syusui-s commented on Feb 22, 2025

    @syusui-s
    syusui-s
    on Feb 22, 2025
    ContributorAuthor
    More actions

    I submitted a pull request. It would be nice if you could review this.
    #3206

    Reacted by Cerberus-tm
  3. arantius
    closed this as completedin #3206on Feb 23, 2025
  4. arantius
    added this to the 4.14 milestone on Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      • 4.14No due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.