1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
From: daurnimator <quae@daurnimator.com>
Date: Thu, 25 May 2017 11:04:32 +1000
Subject: http/h1_connection: Fix request building in locales with comma
decimal separator
Reported at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863286
---
http/h1_connection.lua | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/http/h1_connection.lua b/http/h1_connection.lua
index 1dd5def..28db038 100644
--- a/http/h1_connection.lua
+++ b/http/h1_connection.lua
@@ -336,7 +336,7 @@ function connection_methods:write_request_line(method, path, httpversion, timeou
assert(method:match("^[^ \r\n]+$"))
assert(path:match("^[^ \r\n]+$"))
assert(httpversion == 1.0 or httpversion == 1.1)
- local line = string.format("%s %s HTTP/%1.1f\r\n", method, path, httpversion)
+ local line = string.format("%s %s HTTP/%s\r\n", method, path, httpversion == 1.0 and "1.0" or "1.1")
local ok, err, errno = self.socket:xwrite(line, "f", timeout)
if not ok then
return nil, err, errno
@@ -348,7 +348,7 @@ function connection_methods:write_status_line(httpversion, status_code, reason_p
assert(httpversion == 1.0 or httpversion == 1.1)
assert(status_code:match("^[1-9]%d%d$"), "invalid status code")
assert(type(reason_phrase) == "string" and reason_phrase:match("^[^\r\n]*$"), "invalid reason phrase")
- local line = string.format("HTTP/%1.1f %s %s\r\n", httpversion, status_code, reason_phrase)
+ local line = string.format("HTTP/%s %s %s\r\n", httpversion == 1.0 and "1.0" or "1.1", status_code, reason_phrase)
local ok, err, errno = self.socket:xwrite(line, "f", timeout)
if not ok then
return nil, err, errno
|