Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed a bug that generates an unexpected TypeError #383

Merged
merged 1 commit into from

2 participants

@thefosk

This pull request fixes a bug that generates the following exception:

TypeError: Parameter 'url' must be a string, not undefined
at Object.urlParse [as parse] (url.js:96:11)
at ClientRequest.<anonymous> (/usr/lib/node_modules/test/node_modules/http-proxy/lib/node-http-proxy/http-proxy.js:273:22)
at ClientRequest.g (events.js:192:14)
at ClientRequest.EventEmitter.emit (events.js:96:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1569:7)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
at Socket.socketOnData [as ondata] (http.js:1472:20)
at TCP.onread (net.js:404:27)
@indexzero indexzero merged commit ea10bb2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2013
  1. @thefosk

    Fixing the if statement as it lead to 'TypeError: Parameter 'url' mus…

    thefosk authored
    …t be a string, not undefined' in certain cases
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/node-http-proxy/http-proxy.js
View
2  lib/node-http-proxy/http-proxy.js
@@ -268,7 +268,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
delete response.headers['transfer-encoding'];
}
- if ((response.statusCode === 301) || (response.statusCode === 302)
+ if ((response.statusCode === 301 || response.statusCode === 302)
&& typeof response.headers.location !== 'undefined') {
location = url.parse(response.headers.location);
if (location.host === req.headers.host) {
Something went wrong with that request. Please try again.