static void uclient_http_headers_complete(struct uclient_http *uh)
{
enum auth_type auth_type = uh->auth_type;
+ socklen_t sl;
uh->state = HTTP_STATE_RECV_DATA;
uh->uc.meta = uh->meta.head;
return;
}
+ memset(&uh->uc.local_addr, 0, sizeof(uh->uc.local_addr));
+ memset(&uh->uc.remote_addr, 0, sizeof(uh->uc.remote_addr));
+
+ sl = sizeof(uh->uc.local_addr);
+ getsockname(uh->ufd.fd.fd, &uh->uc.local_addr.sa, &sl);
+ getpeername(uh->ufd.fd.fd, &uh->uc.remote_addr.sa, &sl);
+
if (uh->uc.cb->header_done)
uh->uc.cb->header_done(&uh->uc);
- if (uh->req_type == REQ_HEAD) {
+ if (uh->req_type == REQ_HEAD || uh->uc.status_code == 204) {
uh->eof = true;
uclient_notify_eof(uh);
}
}
int
-uclient_http_reset_headers(struct uclient *cl, const char *name, const char *value)
+uclient_http_reset_headers(struct uclient *cl)
{
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
uclient_http_send_headers(uh);
- ustream_printf(uh->us, "%X\r\n", len);
- if (len > 0)
+ if (len > 0) {
+ ustream_printf(uh->us, "%X\r\n", len);
ustream_write(uh->us, buf, len, false);
- ustream_printf(uh->us, "\r\n");
+ ustream_printf(uh->us, "\r\n");
+ }
return len;
}