Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Issue with cyrillic symbols in location headers #25293

Closed
LavrovArtem opened this issue May 13, 2015 · 4 comments
Closed

Issue with cyrillic symbols in location headers #25293

LavrovArtem opened this issue May 13, 2015 · 4 comments

Comments

@LavrovArtem
Copy link

To reproduce this bug, execute the code below and open http://localhost:777/ in the browser. This page redirects to a page from the location header, and browser should open http://localhost:777/?text=что-то%20русское .

In node.js version 0.10.15 and earlier, it works fine, but in the latest version, node.js opens the http://localhost:777/?text=GB>-B>%20@CAA:>5 url.

I think that the issue is linked to the writeHead function that incorrectly encodes headers and sends them to the browser.

var http = require('http');

http.createServer(function(req, res) {
    if (req.url === '/')
        res.writeHead(302, {location:'?text=что-то русское'});

    res.end();
}).listen(777);
@LavrovArtem LavrovArtem changed the title Issue with russian symbols in location headers Issue with cyrillic symbols in location headers May 13, 2015
@dnakamura
Copy link

Seems to be an issue introduced with 6d3d60a . Workarround:

var http = require('http');

http.createServer(function(req, res) {
    if (req.url === '/')
        res.writeHead(302, {location:'?text=что-то русское'});

    res.end('', 'utf-8');
}).listen(777);

@ChALkeR
Copy link
Member

ChALkeR commented May 14, 2015

Cross-linking: nodejs/node#1693

@jasnell
Copy link
Member

jasnell commented May 14, 2015

Confirmed. There are workarounds for this documented in nodejs/node#1693, and developers really ought not be passing non-ascii characters into the headers but writeHead should be operating defensively here and it's not. This ought to get fixed but since there are good workarounds it's likely not a high priority.

Node versions affected: Tested on v0.12.2
Platforms affected: Tested on mac, should apply to all platforms
High priority/critical category: No
recommended priority: P3
Existing io.js issue: nodejs/node#1693
Pull request included: No
Reproducible: Yes
Exists in later version: Not yet tested in v0.10
@joyent/node-coreteam

@ChALkeR
Copy link
Member

ChALkeR commented Sep 15, 2015

This is the same issue as nodejs/node#1693.
No reason to keep a dupe open in the archive, the discussion should move to nodejs/node.

@ChALkeR ChALkeR closed this as completed Sep 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants