Skip to content

Commit b3d86f2

Browse files
committed
Fix http client examples for files longer than about 16,000 bytes (#696)
1 parent 4c3a3dc commit b3d86f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pico_w/wifi/http_client/example_http_client_util.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ static err_t internal_header_fn(httpc_state_t *connection, void *arg, struct pbu
7070
static err_t internal_recv_fn(void *arg, struct altcp_pcb *conn, struct pbuf *p, err_t err) {
7171
assert(arg);
7272
EXAMPLE_HTTP_REQUEST_T *req = (EXAMPLE_HTTP_REQUEST_T*)arg;
73+
int rc = ERR_OK;
7374
if (req->recv_fn) {
74-
return req->recv_fn(req->callback_arg, conn, p, err);
75+
rc = req->recv_fn(req->callback_arg, conn, p, err);
7576
}
76-
return ERR_OK;
77+
altcp_recved(conn, p->tot_len);
78+
pbuf_free(p);
79+
return rc;
7780
}
7881

7982
static void internal_result_fn(void *arg, httpc_result_t httpc_result, u32_t rx_content_len, u32_t srv_res, err_t err) {

0 commit comments

Comments
 (0)