Skip to content

Commit

Permalink
Support http sync client cancel request
Browse files Browse the repository at this point in the history
  • Loading branch information
ithewei committed Oct 23, 2023
1 parent 9308d5e commit b968776
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions http/client/HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ static int http_client_exec(http_client_t* cli, HttpRequest* req, HttpResponse*
if (left_time != INFINITE) {
so_sndtimeo(cli->fd, left_time);
}
if (req->cancel) goto disconnect;
nsend = http_client_send_data(cli, data + total_nsend, len - total_nsend);
if (req->cancel) goto disconnect;
if (nsend <= 0) {
CHECK_TIMEOUT
err = socket_errno();
Expand All @@ -368,7 +370,9 @@ static int http_client_exec(http_client_t* cli, HttpRequest* req, HttpResponse*
if (left_time != INFINITE) {
so_rcvtimeo(cli->fd, left_time);
}
if (req->cancel) goto disconnect;
nrecv = http_client_recv_data(cli, recvbuf, sizeof(recvbuf));
if (req->cancel) goto disconnect;
if (nrecv <= 0) {
CHECK_TIMEOUT
err = socket_errno();
Expand Down

0 comments on commit b968776

Please sign in to comment.