Changes in uspace/lib/http/src/response.c [9a09212:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/http/src/response.c
r9a09212 rb7fd2a0 34 34 */ 35 35 36 #include <errno.h> 36 37 #include <stdio.h> 37 38 #include <stdlib.h> … … 40 41 41 42 #include <http/http.h> 42 #include <http/errno.h>43 43 44 44 static bool is_digit(char c) … … 47 47 } 48 48 49 static int receive_number(receive_buffer_t *rb, char **str)49 static errno_t receive_number(receive_buffer_t *rb, char **str) 50 50 { 51 51 receive_buffer_mark_t start; … … 53 53 54 54 recv_mark(rb, &start); 55 int rc = recv_while(rb, is_digit);56 if (rc < 0) {55 errno_t rc = recv_while(rb, is_digit); 56 if (rc != EOK) { 57 57 recv_unmark(rb, &start); 58 58 return rc; … … 66 66 } 67 67 68 static int receive_uint8_t(receive_buffer_t *rb, uint8_t *out_value)68 static errno_t receive_uint8_t(receive_buffer_t *rb, uint8_t *out_value) 69 69 { 70 70 char *str = NULL; 71 int rc = receive_number(rb, &str);71 errno_t rc = receive_number(rb, &str); 72 72 73 73 if (rc != EOK) … … 80 80 } 81 81 82 static int receive_uint16_t(receive_buffer_t *rb, uint16_t *out_value)82 static errno_t receive_uint16_t(receive_buffer_t *rb, uint16_t *out_value) 83 83 { 84 84 char *str = NULL; 85 int rc = receive_number(rb, &str);85 errno_t rc = receive_number(rb, &str); 86 86 87 87 if (rc != EOK) … … 94 94 } 95 95 96 static int expect(receive_buffer_t *rb, const char *expect)96 static errno_t expect(receive_buffer_t *rb, const char *expect) 97 97 { 98 98 size_t ndisc; 99 int rc = recv_discard_str(rb, expect, &ndisc);99 errno_t rc = recv_discard_str(rb, expect, &ndisc); 100 100 if (rc != EOK) 101 101 return rc; … … 110 110 } 111 111 112 int http_receive_status(receive_buffer_t *rb, http_version_t *out_version,112 errno_t http_receive_status(receive_buffer_t *rb, http_version_t *out_version, 113 113 uint16_t *out_status, char **out_message) 114 114 { … … 117 117 char *message = NULL; 118 118 119 int rc = expect(rb, "HTTP/");119 errno_t rc = expect(rb, "HTTP/"); 120 120 if (rc != EOK) 121 121 return rc; … … 149 149 150 150 rc = recv_while(rb, is_not_newline); 151 if (rc < 0) {151 if (rc != EOK) { 152 152 recv_unmark(rb, &msg_start); 153 153 return rc; … … 187 187 } 188 188 189 int http_receive_response(receive_buffer_t *rb, http_response_t **out_response,189 errno_t http_receive_response(receive_buffer_t *rb, http_response_t **out_response, 190 190 size_t max_headers_size, unsigned max_headers_count) 191 191 { … … 196 196 http_headers_init(&resp->headers); 197 197 198 int rc = http_receive_status(rb, &resp->version, &resp->status,198 errno_t rc = http_receive_status(rb, &resp->version, &resp->status, 199 199 &resp->message); 200 200 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.