http_client: call tcp_recved for header bytes

Without this, closing the connection after successful transfer resulted
in a RST being sent because the window was not fully marked as 'recved'.

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
goldsimon 2018-03-09 11:30:23 +01:00
parent 8d8572354b
commit 253fcc8dcd

View File

@ -312,8 +312,9 @@ httpc_tcp_recv(void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t r)
u16_t total_header_len;
err_t err = http_wait_headers(req->rx_hdrs, &req->hdr_content_len, &total_header_len);
if (err == ERR_OK) {
/* hide header bytes in pbuf */
struct pbuf *q;
/* full header received, send window update for header bytes and call into client callback */
altcp_recved(pcb, total_header_len);
if (req->conn_settings) {
if (req->conn_settings->headers_done_fn) {
err = req->conn_settings->headers_done_fn(req, req->callback_arg, req->rx_hdrs, total_header_len, req->hdr_content_len);
@ -322,6 +323,7 @@ httpc_tcp_recv(void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t r)
}
}
}
/* hide header bytes in pbuf */
q = pbuf_free_header(req->rx_hdrs, total_header_len);
p = q;
req->rx_hdrs = NULL;