This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
http: createServer request.method is null for DELETE requests #6461
Comments
I guess this issue in Express 3.3.4 against 0.11.8 is related: var app = express();
app.delete('/:db/:id', api.delete); When delete is called we get a stack dump as follows:
The problem only seems to affect delete against the express app object. The other HTTP handling methods work fine. |
If I were to guess, I'd say probably related to 4c0195e. |
This seems to do it for me. The problem is that DELETE is at index 0, so the diff --git a/lib/_http_common.js b/lib/_http_common.js
index 2fb5bd8..7d89b86 100644
--- a/lib/_http_common.js
+++ b/lib/_http_common.js
@@ -27,6 +27,7 @@ var IncomingMessage = incoming.IncomingMessage;
var readStart = incoming.readStart;
var readStop = incoming.readStop;
+var isNumber = require('util').isNumber;
var debug = require('util').debuglog('http');
exports.debug = debug;
@@ -90,7 +91,7 @@ function parserOnHeadersComplete(info) {
parser.incoming._addHeaderLines(headers, n);
- if (info.method) {
+ if (isNumber(info.method)) {
// server only
parser.incoming.method = HTTPParser.methods[info.method];
} else { |
Can somebody please review? https://github.com/TooTallNate/node/commit/9bc53d887ad8b7da1b6656a14ccc56fa3312bda5 |
ghost
assigned TooTallNate
Nov 4, 2013
Fixed in 9bc53d8. @SaltwaterC thanks for the report! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The issue appeared in node.js v0.11.8.
Proof of concept server:
Trigger the issue on faulty versions:
Quite needless to say that it is present in the master branch.
The text was updated successfully, but these errors were encountered: