{
uint32_t val = 0;
FILE *f;
+ size_t n;
f = fopen("/dev/urandom", "r");
if (f) {
- fread(&val, sizeof(val), 1, f);
+ n = fread(&val, sizeof(val), 1, f);
fclose(f);
+ if (n != 1)
+ return;
}
bin_to_hex(dest, &val, sizeof(val));
ustream_printf(uh->us,
"%s %s HTTP/1.1\r\n"
- "Host: %s\r\n",
+ "Host: %s%s%s\r\n",
request_types[req_type],
- url->location, url->host);
+ url->location, url->host,
+ url->port ? ":" : "",
+ url->port ? url->port : "");
blobmsg_for_each_attr(cur, uh->headers.head, rem)
ustream_printf(uh->us, "%s: %s\r\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
if (!tb)
return false;
- url = uclient_get_url(blobmsg_data(tb), url->auth);
+ url = uclient_get_url_location(url, blobmsg_data(tb));
if (!url)
return false;