diff options
author | David Kelly <[email protected]> | 2012-02-01 14:08:29 -0800 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-02-02 20:25:23 +0100 |
commit | e7b6e2a402922724ffd668161ed1b65533b5c034 (patch) | |
tree | 1ea25f2598dfde0c7aeca66841fd9fc5b089cae5 /test | |
parent | 062db956535907d33c430cd87e632d2c8f746240 (diff) | |
download | cowboy-e7b6e2a402922724ffd668161ed1b65533b5c034.tar.gz cowboy-e7b6e2a402922724ffd668161ed1b65533b5c034.tar.bz2 cowboy-e7b6e2a402922724ffd668161ed1b65533b5c034.zip |
Added absoluteURI support
If requests go through a proxy, they will have the original uri in the
request, i.e. : GET http://proxy.server.uri/some/query/string HTTP 1.1 ...
That was problematic -- cowboy_http_protocol:request didn't know what to
to with the result of decode_packet applied to this, which would be something
like:
``` erlang
{http_request,'GET',{absoluteURI,http,<<"proxy.server.uri">>,
undefined,<<"/some/query/string">>},{1,1}}
```
So, I just ignore the host, grab the path and pass into
``` erlang
cowboy_http_protocol:request({http_request, Method, {abs_path, Path},
Version}, State)
```
Seems to do the trick without much effort.
Diffstat (limited to 'test')
-rw-r--r-- | test/http_SUITE.erl | 3 |
1 files changed, 2 insertions, 1 deletions
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}, |