mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
![]() This is intended to solve a longstanding problem with the relationship between http/1.1 keep-alive and the service loop. Ah now contain an rx buffer which is used during header processing, and the ah may not be detached from the wsi until the rx buffer is exhausted. Having the rx buffer in the ah means we can delay using the rx until a later service loop. Ah which have pending rx force POLLIN service on the wsi they are attached to automatically, so we can interleave general service / connections with draining each ah rx buffer. The possible http/1.1 situations and their dispositions are: 1) exactly one set of http headers come. After processing, the ah is detached since no pending rx left. If more headers come later, a fresh ah is aqcuired when available and the rx flow control blocks the read until then. 2) more that one whole set of headers come and we remain in http mode (no upgrade). The ah is left attached and returns to the service loop after the first set of headers. We will get forced service due to the ah having pending content (respecting flowcontrol) and process the pending rx in the ah. If we use it all up, we will detach the ah. 3) one set of http headers come with ws traffic appended. We service the headers, do the upgrade, and keep the ah until the remaining ws content is used. When we exhausted the ws traffix in the ah rx buffer, we detach the ah. Since there can be any amount of http/1.1 pipelining on a connection, and each may be expensive to service, it's now enforced there is a return to the service loop after each header set is serviced on a connection. When I added the forced service for ah with pending buffering, I added support for it to the windows plat code. However this is untested. Signed-off-by: Andy Green <andy.green@linaro.org> |
||
---|---|---|
.. | ||
.gitignore | ||
alloc.c | ||
base64-decode.c | ||
client-handshake.c | ||
client-parser.c | ||
client.c | ||
context.c | ||
daemonize.c | ||
extension-permessage-deflate.c | ||
extension-permessage-deflate.h | ||
extension.c | ||
getifaddrs.c | ||
getifaddrs.h | ||
handshake.c | ||
header.c | ||
hpack.c | ||
http2.c | ||
huftable.h | ||
lextable-strings.h | ||
lextable.h | ||
libev.c | ||
libuv.c | ||
libwebsockets.c | ||
libwebsockets.h | ||
lws-plat-mbed3.c | ||
lws-plat-mbed3.cpp | ||
lws-plat-unix.c | ||
lws-plat-win.c | ||
minihuf.c | ||
minilex.c | ||
output.c | ||
parsers.c | ||
pollfd.c | ||
private-libwebsockets.h | ||
server-handshake.c | ||
server.c | ||
service.c | ||
sha-1.c | ||
ssl-http2.c | ||
ssl.c |