On 2023/06/28 18:47:17 +0200, Theo Buehler <[email protected]> wrote:
> On Wed, Jun 28, 2023 at 06:37:43PM +0200, Omar Polo wrote:
> > A similar thing could be applied to rpki-client' http.c as well, it
> > should work the same.
>
> Could you please send a diff? The files have diverged, but keeping the
> shared parts in sync is helpful.
here it is, but i can't do more than compile-test it.
The trailing spaces are trimmed in http_get_line(), so the strcspn is
just as redundant.
diff /usr/src
commit - 9832f5035d799ae12e9f848cff5650481b673260
path + /usr/src
blob - 4544eac237147fe77bcb9d0068438827ddd81424
file + usr.sbin/rpki-client/http.c
--- usr.sbin/rpki-client/http.c
+++ usr.sbin/rpki-client/http.c
@@ -1369,7 +1369,6 @@ http_parse_header(struct http_connection *conn, char *
else if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) {
cp += sizeof(CONTENTLEN) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
conn->iosz = strtonum(cp, 0, MAX_CONTENTLEN, &errstr);
if (errstr != NULL) {
warnx("Content-Length of %s is %s",
@@ -1422,14 +1421,12 @@ http_parse_header(struct http_connection *conn, char *
sizeof(TRANSFER_ENCODING) - 1) == 0) {
cp += sizeof(TRANSFER_ENCODING) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
if (strcasecmp(cp, "chunked") == 0)
conn->chunked = 1;
} else if (strncasecmp(cp, CONTENT_ENCODING,
sizeof(CONTENT_ENCODING) - 1) == 0) {
cp += sizeof(CONTENT_ENCODING) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
if (strcasecmp(cp, "gzip") == 0 ||
strcasecmp(cp, "deflate") == 0) {
if (http_inflate_new(conn) == -1)
@@ -1439,7 +1436,6 @@ http_parse_header(struct http_connection *conn, char *
} else if (strncasecmp(cp, CONNECTION, sizeof(CONNECTION) - 1) == 0) {
cp += sizeof(CONNECTION) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
if (strcasecmp(cp, "close") == 0)
conn->keep_alive = 0;
else if (strcasecmp(cp, "keep-alive") == 0)