On 08/04/15 15:28, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
It still not clear to me what is going (or
expected) to happen
afterwards. Will this connection be http or websocket? Because websocket
requires framing of the data. Http stays tcp streaming connection.
Given that it is started as HTTP but no Upgrade is required, I guess
that Apache is expecting to deal with http further. And then practically
is not websocket and should not be considered as such.
Anyhow, perhaps you can look inside the websocket function and try to
ignore the parts dealing with the missing headers. Then see what apache
sends next. You can eventually send a 101 reply with some forged
Sec-WebSocket-Accept from config file just to emulate and see the
results. Then if it is websocket transmission, then websocket module can
be adjusted to cope with this situation.
i removed CONNECTION and UPGRADE from
ws_handle_handshake
REQUIRED_HEADERS:
#define REQUIRED_HEADERS (CONNECTION | UPGRADE | SEC_WEBSOCKET_KEY\
| SEC_WEBSOCKET_PROTOCOL\
| SEC_WEBSOCKET_VERSION)
and in the config called ws_handle_handshake() if Sec-WebSocket-Protocol
header exists and has body 'sip'. after that websocket connections via
apache ws_tunnel worked fine.
in my opinion we could make the above change, since existence of
Connection and Upgrade headers can be checked in config rather than in
the code. that is what the example websocket config does anyway:
if (($hdr(Upgrade) == "websocket") &&
in_list("Upgrade", $hdr(Connection), ",") &&
($rm == "GET")) {
comments?
I think this behaviour should be made based on a new parameter for the
module, defaulting to the current behavior -- using the http/websocket
proxy is not a common scenario. Also, I am not sure how valid is to
expect switching to websocket connection without demanding it. Plus, in
this way the upgrade to newer version is not breaking exiting configs.
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda -
http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany -
http://www.kamailioworld.com