Changeset 4d4f656 in mainline for uspace/lib/http/src/response.c
- Timestamp:
- 2013-09-26T20:50:52Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 408424e
- Parents:
- b623b68
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/http/src/response.c
rb623b68 r4d4f656 40 40 41 41 #include <http/http.h> 42 #include <http/errno.h> 42 43 43 44 int http_parse_status(const char *line, http_version_t *out_version, … … 98 99 return ENOMEM; 99 100 memset(resp, 0, sizeof(http_response_t)); 100 list_initialize(&resp->headers);101 http_headers_init(&resp->headers); 101 102 102 103 char *line = malloc(http->buffer_size); … … 115 116 goto error; 116 117 117 while (true) { 118 rc = recv_eol(&http->recv_buffer); 119 if (rc < 0) 120 goto error; 121 122 /* Empty line ends header part */ 123 if (rc > 0) 124 break; 125 126 http_header_t *header = malloc(sizeof(http_header_t)); 127 if (header == NULL) { 128 rc = ENOMEM; 129 goto error; 130 } 131 http_header_init(header); 132 133 rc = http_header_receive(&http->recv_buffer, header); 134 if (rc != EOK) { 135 free(header); 136 goto error; 137 } 138 139 list_append(&header->link, &resp->headers); 140 } 118 rc = http_headers_receive(&http->recv_buffer, &resp->headers); 119 if (rc != EOK) 120 goto error; 121 122 rc = recv_eol(&http->recv_buffer); 123 if (rc == 0) 124 rc = HTTP_EPARSE; 125 if (rc < 0) 126 goto error; 141 127 142 128 *out_response = resp; … … 157 143 { 158 144 free(resp->message); 159 link_t *link = resp->headers.head.next; 160 while (link != &resp->headers.head) { 161 link_t *next = link->next; 162 http_header_t *header = list_get_instance(link, http_header_t, link); 163 http_header_destroy(header); 164 link = next; 165 } 145 http_headers_clear(&resp->headers); 166 146 free(resp); 167 147 }
Note:
See TracChangeset
for help on using the changeset viewer.