char *sep;
if (uh->state == HTTP_STATE_REQUEST_DONE) {
+ char *code;
+
+ /* HTTP/1.1 */
+ strsep(&data, " ");
+
+ code = strsep(&data, " ");
+ if (!code)
+ goto error;
+
+ uh->uc.status_code = strtoul(code, &sep, 10);
+ if (sep && *sep)
+ goto error;
+
uh->state = HTTP_STATE_RECV_HEADERS;
return;
}
sep++;
blobmsg_add_string(&uh->meta, name, sep);
+ return;
+
+error:
+ uh->uc.status_code = 400;
+ uh->eof = true;
+ uclient_notify_eof(uh);
}
static void __uclient_notify_read(struct uclient_http *uh)
return len;
}
-const struct uclient_backend uclient_backend_http __hidden = {
+const struct uclient_backend uclient_backend_http = {
.prefix = uclient_http_prefix,
.alloc = uclient_http_alloc,