summaryrefslogtreecommitdiffstats
path: root/lem/http/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'lem/http/core.c')
-rw-r--r--lem/http/core.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/lem/http/core.c b/lem/http/core.c
index 3d4efc3..70f1327 100644
--- a/lem/http/core.c
+++ b/lem/http/core.c
@@ -1,6 +1,6 @@
/*
* This file is part of LEM, a Lua Event Machine.
- * Copyright 2011-2012 Emil Renner Berthing
+ * Copyright 2011-2013 Emil Renner Berthing
*
* LEM is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
@@ -206,11 +206,23 @@ parse_http_process(lua_State *T, struct lem_inputbuf *b)
case CMIV:
case CNUM:
case CTXT:
- case SKEY:
case SVAL:
b->buf[w++] = ch;
break;
+ case XKEY:
+ state = SKEY;
+ lua_pushlstring(T, b->buf, w);
+ lua_rawset(T, -3);
+ w = 0;
+ /* fallthrough */
+
+ case SKEY:
+ if (ch >= 'A' && ch <= 'Z')
+ ch += ('a' - 'A');
+ b->buf[w++] = ch;
+ break;
+
case SRE1:
lua_pushlstring(T, b->buf, w);
lua_setfield(T, -2, "version");
@@ -283,14 +295,6 @@ parse_http_process(lua_State *T, struct lem_inputbuf *b)
b->buf[w++] = ch;
break;
- case XKEY:
- state = SKEY;
- lua_pushlstring(T, b->buf, w);
- lua_rawset(T, -3);
- w = 0;
- b->buf[w++] = ch;
- break;
-
case XEND:
/* in case there are no headers this is false */
if (lua_type(T, -1) == LUA_TSTRING) {