-/* $OpenBSD: http.c,v 1.5 2021/03/04 15:44:13 tb Exp $ */
+/* $OpenBSD: http.c,v 1.6 2021/03/18 14:08:01 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.com>
http_request(struct http_connection *conn)
{
char *host, *epath, *modified_since;
- int with_port = 0;
+ int r, with_port = 0;
/* TODO adjust request for HTTP proxy setups */
free(conn->buf);
conn->bufpos = 0;
- if ((conn->bufsz = asprintf(&conn->buf,
+ if ((r = asprintf(&conn->buf,
"GET /%s HTTP/1.1\r\n"
"Connection: close\r\n"
"User-Agent: " HTTP_USER_AGENT "\r\n"
epath, host,
modified_since ? modified_since : "")) == -1)
err(1, NULL);
+ conn->bufsz = r;
free(epath);
free(host);
case STATE_FREE:
errx(1, "bad http state");
}
+ errx(1, "unknown http state");
}
static int
case STATE_FREE:
errx(1, "bad http state");
}
+ errx(1, "unknown http state");
}
static int