Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
http ... PARTY!
node-http-proxy
Commits
70f42746
Commit
70f42746
authored
9 years ago
by
Fabian Jakobs
Browse files
Options
Download
Email Patches
Plain Diff
actually propagate the error to be consistent with errors propagates by http.request
parent
4fa64f40
github/fork/cloud9ide/catch-invalid-headers
1 merge request
!965
Catch invalid headers
Pipeline
#1333
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/http-proxy/passes/web-incoming.js
+10
-3
lib/http-proxy/passes/web-incoming.js
lib/http-proxy/passes/web-outgoing.js
+1
-5
lib/http-proxy/passes/web-outgoing.js
with
11 additions
and
8 deletions
+11
-8
lib/http-proxy/passes/web-incoming.js
+
10
-
3
View file @
70f42746
...
...
@@ -145,9 +145,16 @@ web_o = Object.keys(web_o).map(function(pass) {
(
options
.
buffer
||
req
).
pipe
(
proxyReq
);
proxyReq
.
on
(
'
response
'
,
function
(
proxyRes
)
{
if
(
server
)
{
server
.
emit
(
'
proxyRes
'
,
proxyRes
,
req
,
res
);
}
for
(
var
i
=
0
;
i
<
web_o
.
length
;
i
++
)
{
if
(
web_o
[
i
](
req
,
res
,
proxyRes
,
options
))
{
break
;
}
var
stop
=
false
;
if
(
server
)
{
server
.
emit
(
'
proxyRes
'
,
proxyRes
,
req
,
res
);
}
for
(
var
i
=
0
;
i
<
web_o
.
length
;
i
++
)
{
try
{
stop
=
web_o
[
i
](
req
,
res
,
proxyRes
,
options
);
}
catch
(
e
)
{
return
proxyError
(
e
);
}
if
(
stop
)
{
break
;
}
}
// Allow us to listen when the proxy has completed
...
...
This diff is collapsed.
Click to expand it.
lib/http-proxy/passes/web-outgoing.js
+
1
-
5
View file @
70f42746
...
...
@@ -83,11 +83,7 @@ var redirectRegex = /^30(1|2|7|8)$/;
function
writeHeaders
(
req
,
res
,
proxyRes
)
{
Object
.
keys
(
proxyRes
.
headers
).
forEach
(
function
(
key
)
{
if
(
proxyRes
.
headers
[
key
]
!=
undefined
)
{
try
{
res
.
setHeader
(
key
,
proxyRes
.
headers
[
key
]);
}
catch
(
e
)
{
// ignore invalid headers
}
res
.
setHeader
(
key
,
proxyRes
.
headers
[
key
]);
}
});
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets