You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stefan Eissing via dev <de...@httpd.apache.org> on 2023/06/15 13:15:18 UTC

HTTP/2 WebSockets, PR

Adding HTTP/2 WebSockets support to the server.

See: https://github.com/apache/httpd/pull/362

Status:

Works for the test cases I came up with so far. Will do more testing in the next weeks.

What are the main changes?

core:
- addition of 

  ap_get_conn_in_pollfd(
    conn_rec *c, 
    apr_pollfd_t *pfd,
    apr_interval_time_t *ptimeout);

  implemented as a hook. core provides it socket and timeout on "main" connections. mod_http2 provides its input pipe fd on "secondary" connections that were made for it.

mod_http2:
- handling of CONNECT for WebSockets, check of correct headers
- announce WebSockets support in HTTP/2 settings sent to the client
- transform HTTP/2 WebSocket CONNECTs to internal GET requests with generated "Sec-WebSocket-Key" headers, so that it appears internally as if it came via HTTP/1.1.
- check for 101 response or fail the CONNECT. Check the 101 for a matching "Sec-WebSocket-Accept" header or fail.

mod_proxy:
- make the proxy_tunnel code in proxy_util.c work in case it only has a APR_POLL_FILE for the client side.
  (Yann, please have a look and find my stupid mistakes!)

test
- added test cases in pytest for mod_http2 (needs python3-websockets installed)
  The tests use a "ProxyPass xxx upgrade=websocket" configuration to a local python websockets server that can perform a set of traffic cases.
- added test/clients directory to build "h2ws", the client used in the new tests


Cheers,
Stefan

Re: HTTP/2 WebSockets, PR

Posted by Stefan Eissing via dev <de...@httpd.apache.org>.
This has been reviewed by Master Yann (many thanks!) and, with changes based on that, been merged in r1910507 to trunk.

RFC 8441 now supported by Apache httpd dev on non-Windows platforms.

Kind Regards,
Stefan

> Am 15.06.2023 um 15:15 schrieb Stefan Eissing via dev <de...@httpd.apache.org>:
> 
> Adding HTTP/2 WebSockets support to the server.
> 
> See: https://github.com/apache/httpd/pull/362
> 
> Status:
> 
> Works for the test cases I came up with so far. Will do more testing in the next weeks.
> 
> What are the main changes?
> 
> core:
> - addition of 
> 
>  ap_get_conn_in_pollfd(
>    conn_rec *c, 
>    apr_pollfd_t *pfd,
>    apr_interval_time_t *ptimeout);
> 
>  implemented as a hook. core provides it socket and timeout on "main" connections. mod_http2 provides its input pipe fd on "secondary" connections that were made for it.
> 
> mod_http2:
> - handling of CONNECT for WebSockets, check of correct headers
> - announce WebSockets support in HTTP/2 settings sent to the client
> - transform HTTP/2 WebSocket CONNECTs to internal GET requests with generated "Sec-WebSocket-Key" headers, so that it appears internally as if it came via HTTP/1.1.
> - check for 101 response or fail the CONNECT. Check the 101 for a matching "Sec-WebSocket-Accept" header or fail.
> 
> mod_proxy:
> - make the proxy_tunnel code in proxy_util.c work in case it only has a APR_POLL_FILE for the client side.
>  (Yann, please have a look and find my stupid mistakes!)
> 
> test
> - added test cases in pytest for mod_http2 (needs python3-websockets installed)
>  The tests use a "ProxyPass xxx upgrade=websocket" configuration to a local python websockets server that can perform a set of traffic cases.
> - added test/clients directory to build "h2ws", the client used in the new tests
> 
> 
> Cheers,
> Stefan