|
|
@ -129,7 +129,8 @@ function IncomingMessage (connection) { |
|
|
|
full: "", |
|
|
|
queryString: "", |
|
|
|
fragment: "", |
|
|
|
path: "" |
|
|
|
path: "", |
|
|
|
params: {} |
|
|
|
}; |
|
|
|
|
|
|
|
this.method = null; |
|
|
@ -140,6 +141,21 @@ function IncomingMessage (connection) { |
|
|
|
} |
|
|
|
node.inherits(IncomingMessage, node.EventEmitter); |
|
|
|
|
|
|
|
IncomingMessage.prototype._parseQueryString = function () { |
|
|
|
var parts = this.uri.queryString.split('&'); |
|
|
|
for (var j = 0; j < parts.length; j++) { |
|
|
|
var i = parts[j].indexOf('='); |
|
|
|
if (i < 0) continue; |
|
|
|
try { |
|
|
|
var key = decode(parts[j].slice(0,i)) |
|
|
|
var value = decode(parts[j].slice(i+1)); |
|
|
|
this.uri.params[key] = value; |
|
|
|
} catch (e) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
IncomingMessage.prototype.setBodyEncoding = function (enc) { |
|
|
|
// TODO: Find a cleaner way of doing this.
|
|
|
|
this.connection.setEncoding(enc); |
|
|
@ -390,6 +406,10 @@ function createIncomingMessageStream (connection, incoming_listener) { |
|
|
|
if (info.method) { |
|
|
|
// server only
|
|
|
|
incoming.method = info.method; |
|
|
|
|
|
|
|
if (incoming.uri.queryString.length > 0) { |
|
|
|
incoming._parseQueryString(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// client only
|
|
|
|
incoming.statusCode = info.statusCode; |
|
|
|