summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2017-10-03 01:56:43 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2017-10-03 21:16:03 -0400
commit513887fa529c681958c57a946dade81f3c11d616 (patch)
treef7c2c09cbd3dc9267f720a78fa2cb676fd27dd79 /src
parent428cd963d6551414e81653ce8c68abf012c6747f (diff)
downloadlighttpd-git-513887fa529c681958c57a946dade81f3c11d616.tar.gz
[core] URI scheme is case-insensitive
check case-insensitive scheme if full URI provided in request-line RFC7230: The scheme and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner. x-ref: "https://redmine.lighttpd.net/boards/3/topics/7637"
Diffstat (limited to 'src')
-rw-r--r--src/request.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/request.c b/src/request.c
index d042d0b8..65fcddf6 100644
--- a/src/request.c
+++ b/src/request.c
@@ -587,13 +587,16 @@ int http_request_parse(server *srv, connection *con) {
return 0;
}
- if (0 == strncmp(uri, "http://", 7) &&
+ if (*uri == '/') {
+ /* (common case) */
+ buffer_copy_string_len(con->request.uri, uri, proto - uri - 1);
+ } else if (0 == strncasecmp(uri, "http://", 7) &&
NULL != (nuri = strchr(uri + 7, '/'))) {
reqline_host = uri + 7;
reqline_hostlen = nuri - reqline_host;
buffer_copy_string_len(con->request.uri, nuri, proto - nuri - 1);
- } else if (0 == strncmp(uri, "https://", 8) &&
+ } else if (0 == strncasecmp(uri, "https://", 8) &&
NULL != (nuri = strchr(uri + 8, '/'))) {
reqline_host = uri + 8;
reqline_hostlen = nuri - reqline_host;