aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cowboy_http_protocol.erl4
-rw-r--r--test/http_SUITE.erl3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index 4962217..d7ba508 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -113,6 +113,10 @@ wait_request(State=#state{socket=Socket, transport=Transport,
request({http_request, _Method, _URI, Version}, State)
when Version =/= {1, 0}, Version =/= {1, 1} ->
error_terminate(505, State);
+%% We still receive the original Host header.
+request({http_request, Method, {absoluteURI, _Scheme, _Host, _Port, Path},
+ Version}, State) ->
+ request({http_request, Method, {abs_path, Path}, Version}, State);
request({http_request, Method, {abs_path, AbsPath}, Version},
State=#state{socket=Socket, transport=Transport,
urldecode={URLDecFun, URLDecArg}=URLDec}) ->
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 862a110..9191f26 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -378,7 +378,8 @@ raw(Config) ->
{"GET / HTTP/1.1\r\nHost: localhost", 408},
{"GET / HTTP/1.1\r\nHost: localhost\r\n", 408},
{"GET / HTTP/1.1\r\nHost: localhost\r\n\r", 408},
- {"GET http://localhost/ HTTP/1.1\r\n\r\n", 501},
+ {"GET http://proxy/ HTTP/1.1\r\n\r\n", 400},
+ {"GET http://proxy/ HTTP/1.1\r\nHost: localhost\r\n\r\n", 200},
{"GET / HTTP/1.2\r\nHost: localhost\r\n\r\n", 505},
{"GET /init_shutdown HTTP/1.1\r\nHost: localhost\r\n\r\n", 666},
{"GET /long_polling HTTP/1.1\r\nHost: localhost\r\n\r\n", 102},