Mercurial > hg > nginx
comparison src/http/ngx_http_variables.c @ 5072:7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
This allows to proxy WebSockets by using configuration like this:
location /chat/ {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Connection upgrade is allowed as long as it was requested by a client
via the Upgrade request header.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 18 Feb 2013 13:50:52 +0000 |
parents | 829cc5872186 |
children | a805dc9c85cd |
comparison
equal
deleted
inserted
replaced
5071:e14b49c12a73 | 5072:7fa7e60a7f66 |
---|---|
1745 ngx_http_variable_value_t *v, uintptr_t data) | 1745 ngx_http_variable_value_t *v, uintptr_t data) |
1746 { | 1746 { |
1747 size_t len; | 1747 size_t len; |
1748 char *p; | 1748 char *p; |
1749 | 1749 |
1750 if (r->keepalive) { | 1750 if (r->headers_out.status == NGX_HTTP_SWITCHING_PROTOCOLS) { |
1751 len = sizeof("upgrade") - 1; | |
1752 p = "upgrade"; | |
1753 | |
1754 } else if (r->keepalive) { | |
1751 len = sizeof("keep-alive") - 1; | 1755 len = sizeof("keep-alive") - 1; |
1752 p = "keep-alive"; | 1756 p = "keep-alive"; |
1753 | 1757 |
1754 } else { | 1758 } else { |
1755 len = sizeof("close") - 1; | 1759 len = sizeof("close") - 1; |