Skip to content

Commit f2a2e5f

Browse files
committed
bugfix: treat Expect header value case-insensitive
test: download Test::Nginx with the super user permission
1 parent a2a6fec commit f2a2e5f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
- DOWNLOAD_CACHE=$HOME/download_cache
1212
- INSTALL_CACHE=$HOME/install_cache
1313
install:
14-
- cpanm -v --notest Test::Nginx
14+
- cpanm -v --notest --sudo Test::Nginx
1515
before_script:
1616
- sudo apt-get update -q
1717
- sudo apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev -y

lib/resty/requests/request.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ local insert = table.insert
1414
local concat = table.concat
1515
local find = string.find
1616
local sub = string.sub
17+
local lower = string.lower
1718
local format = string.format
1819
local ngx_match = ngx.re.match
1920
local _M = { _VERSION = "0.2" }
@@ -145,8 +146,14 @@ local function new(method, url, session, config)
145146
end
146147

147148
local body = prepare(url_parts, session, config)
149+
local expect = false
148150

149-
local expect = session.headers["expect"] == "100-continue"
151+
do
152+
local expect_field = session.headers["expect"]
153+
if expect_field then
154+
expect = lower(expect_field) == "100-continue"
155+
end
156+
end
150157

151158
local r = {
152159
method = method,

0 commit comments

Comments
 (0)