Changeset 9a09212 in mainline for uspace/lib/http/src/response.c


Ignore:
Timestamp:
2017-12-04T20:22:45Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
82d515e9
Parents:
0fb1755
Message:

Libhttp should not mix error codes and number of bytes transferred.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/http/src/response.c

    r0fb1755 r9a09212  
    9696static int expect(receive_buffer_t *rb, const char *expect)
    9797{
    98         int rc = recv_discard_str(rb, expect);
    99         if (rc < 0)
    100                 return rc;
    101         if ((size_t) rc < str_length(expect))
     98        size_t ndisc;
     99        int rc = recv_discard_str(rb, expect, &ndisc);
     100        if (rc != EOK)
     101                return rc;
     102        if (ndisc < str_length(expect))
    102103                return HTTP_EPARSE;
    103104        return EOK;
     
    168169        recv_unmark(rb, &msg_end);
    169170       
    170         rc = recv_eol(rb);
    171         if (rc == 0)
     171        size_t nrecv;
     172        rc = recv_eol(rb, &nrecv);
     173        if (rc == EOK && nrecv == 0)
    172174                rc = HTTP_EPARSE;
    173         if (rc < 0) {
     175        if (rc != EOK) {
    174176                free(message);
    175177                return rc;
     
    204206                goto error;
    205207       
    206         rc = recv_eol(rb);
    207         if (rc == 0)
     208        size_t nrecv;
     209        rc = recv_eol(rb, &nrecv);
     210        if (rc == EOK && nrecv == 0)
    208211                rc = HTTP_EPARSE;
    209         if (rc < 0)
     212        if (rc != EOK)
    210213                goto error;
    211214       
Note: See TracChangeset for help on using the changeset viewer.