Commit 6192c989 authored by James M Snell's avatar James M Snell
Browse files

http: add checkIsHttpToken check for header fields

Ref: https://github.com/nodejs/node-convergence-archive/issues/13



This adds a new check for header and trailer fields names and method
names to ensure that they conform to the HTTP token rule. If they do
not, a `TypeError` is thrown.

Previously this had an additional `strictMode` option that has been
removed in favor of making the strict check the default (and only)
behavior.

Doc and test case are included.

On the client-side
```javascript
var http = require('http');
var url = require('url');
var p = url.parse('http://localhost:8888');
p.headers = {'testing 123': 123};
http.client(p, function(res) { }); // throws
```

On the server-side
```javascript
var http = require('http');
var server = http.createServer(function(req,res) {
  res.setHeader('testing 123', 123); // throws
  res.end('...');
});
```

Reviewed-By: default avatarSakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: default avatarTrevor Norris <trevnorris@nodejs.org>
Reviewed-By: default avatarСковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: default avatarRod Vagg <rod@vagg.org>
PR-URL: https://github.com/nodejs/node/pull/2526
parent b50e89e0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment