aboutsummaryrefslogtreecommitdiff
path: root/lib/roles/h1
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2019-08-27 06:06:13 +0100
committerAndy Green <andy@warmcat.com>2019-09-22 03:08:36 -0700
commit6710279e21effbc2b1a033bbce0ee911f2555074 (patch)
tree6a0056d9ecd24fe51f00498c08711924bf979cae /lib/roles/h1
parent78c7b0651e3c8f85ed4e315fa6c1835e0ed62cad (diff)
downloadlibwebsockets-6710279e21effbc2b1a033bbce0ee911f2555074.tar.gz
client: use block parse and buflist
With http, the protocol doesn't indicate where the headers end and the next transaction or body begin. Until now, we handled that for client header response parsing by reading from the tls buffer bytewise. This modernizes the code to read in up to 256-byte chunks and parse the chunks in one hit (the parse API is already set up for doing this elsewhere). Now we have a generic input buflist, adapt the parser loop to go through that and arrange that any leftovers are placed on there.
Diffstat (limited to 'lib/roles/h1')
-rw-r--r--lib/roles/h1/ops-h1.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/roles/h1/ops-h1.c b/lib/roles/h1/ops-h1.c
index 4788c84a..4a6fbf08 100644
--- a/lib/roles/h1/ops-h1.c
+++ b/lib/roles/h1/ops-h1.c
@@ -389,7 +389,8 @@ lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)
if (lwsi_state(wsi) == LRS_ISSUING_FILE) {
// lwsl_notice("stashing: wsi %p: bd %d\n", wsi, buffered);
- if (lws_buflist_aware_consume(wsi, &ebuf, 0, buffered, __func__))
+ if (lws_buflist_aware_finished_consuming(wsi, &ebuf, 0,
+ buffered, __func__))
return LWS_HPI_RET_PLEASE_CLOSE_ME;
goto try_pollout;
@@ -410,7 +411,8 @@ lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)
// lwsl_notice("%s: consumed %d\n", __func__, n);
- if (lws_buflist_aware_consume(wsi, &ebuf, n, buffered, __func__))
+ if (lws_buflist_aware_finished_consuming(wsi, &ebuf, n,
+ buffered, __func__))
return LWS_HPI_RET_PLEASE_CLOSE_ME;
/*