-/* $OpenBSD: server_http.c,v 1.148 2021/11/05 19:01:02 benno Exp $ */
+/* $OpenBSD: server_http.c,v 1.149 2021/11/11 15:52:33 claudio Exp $ */
/*
* Copyright (c) 2020 Matthias Pressfreund <mpfr@fn.de>
struct evbuffer *src = EVBUFFER_INPUT(bev);
char *line = NULL, *key, *value;
const char *errstr;
- char *http_version;
+ char *http_version, *query;
size_t size, linelen;
int version;
struct kv *hdr = NULL;
}
*http_version++ = '\0';
- desc->http_query = strchr(desc->http_path, '?');
- if (desc->http_query != NULL)
- *desc->http_query++ = '\0';
/*
* We have to allocate the strings because they could
goto fail;
}
- if (desc->http_query != NULL &&
- (desc->http_query =
- strdup(desc->http_query)) == NULL)
- goto fail;
+ query = strchr(desc->http_path, '?');
+ if (query != NULL) {
+ *query++ = '\0';
+
+ if ((desc->http_query = strdup(query)) == NULL)
+ goto fail;
+ }
} else if (desc->http_method != HTTP_METHOD_NONE &&
strcasecmp("Content-Length", key) == 0) {