diff options
author | Caleb Maclennan <caleb@alerque.com> | 2022-03-24 18:11:07 +0300 |
---|---|---|
committer | Caleb Maclennan <caleb@alerque.com> | 2022-03-24 18:11:07 +0300 |
commit | 2de8ddfbb837a75b1cb5f09a656379c1e7cc589c (patch) | |
tree | 20b5f7b8a48d1c126763daca3860fcfb7c3b59a7 /src | |
parent | f9e1d03f3c6c9fc59dd3b91716debc23aebf947f (diff) | |
parent | 5ed8b66e6d0c295f95fade159ada0f97f482b2ac (diff) | |
download | luasocket-2de8ddfbb837a75b1cb5f09a656379c1e7cc589c.tar.gz luasocket-2de8ddfbb837a75b1cb5f09a656379c1e7cc589c.tar.bz2 luasocket-2de8ddfbb837a75b1cb5f09a656379c1e7cc589c.zip |
Merge remote-tracking branch 'upstream/master' into test-builds
Diffstat (limited to 'src')
-rw-r--r-- | src/http.lua | 7 | ||||
-rw-r--r-- | src/ltn12.lua | 6 | ||||
-rwxr-xr-x | src/makefile | 12 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/http.lua b/src/http.lua index e3a1742..1330355 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -283,6 +283,13 @@ local function adjustrequest(reqt) | |||
283 | nreqt.uri = reqt.uri or adjusturi(nreqt) | 283 | nreqt.uri = reqt.uri or adjusturi(nreqt) |
284 | -- adjust headers in request | 284 | -- adjust headers in request |
285 | nreqt.headers = adjustheaders(nreqt) | 285 | nreqt.headers = adjustheaders(nreqt) |
286 | if nreqt.source | ||
287 | and not nreqt.headers["content-length"] | ||
288 | and not nreqt.headers["transfer-encoding"] | ||
289 | then | ||
290 | nreqt.headers["transfer-encoding"] = "chunked" | ||
291 | end | ||
292 | |||
286 | -- ajust host and port if there is a proxy | 293 | -- ajust host and port if there is a proxy |
287 | nreqt.host, nreqt.port = adjustproxy(nreqt) | 294 | nreqt.host, nreqt.port = adjustproxy(nreqt) |
288 | return nreqt | 295 | return nreqt |
diff --git a/src/ltn12.lua b/src/ltn12.lua index f1e05e1..4cb17f5 100644 --- a/src/ltn12.lua +++ b/src/ltn12.lua | |||
@@ -11,6 +11,8 @@ local string = require("string") | |||
11 | local table = require("table") | 11 | local table = require("table") |
12 | local unpack = unpack or table.unpack | 12 | local unpack = unpack or table.unpack |
13 | local base = _G | 13 | local base = _G |
14 | local select = select | ||
15 | |||
14 | local _M = {} | 16 | local _M = {} |
15 | if module then -- heuristic for exporting a global package table | 17 | if module then -- heuristic for exporting a global package table |
16 | ltn12 = _M -- luacheck: ignore | 18 | ltn12 = _M -- luacheck: ignore |
@@ -22,8 +24,6 @@ _M.source = source | |||
22 | _M.sink = sink | 24 | _M.sink = sink |
23 | _M.pump = pump | 25 | _M.pump = pump |
24 | 26 | ||
25 | local unpack = unpack or table.unpack | ||
26 | |||
27 | -- 2048 seems to be better in windows... | 27 | -- 2048 seems to be better in windows... |
28 | _M.BLOCKSIZE = 2048 | 28 | _M.BLOCKSIZE = 2048 |
29 | _M._VERSION = "LTN12 1.0.3" | 29 | _M._VERSION = "LTN12 1.0.3" |
@@ -45,7 +45,7 @@ end | |||
45 | -- (thanks to Wim Couwenberg) | 45 | -- (thanks to Wim Couwenberg) |
46 | function filter.chain(...) | 46 | function filter.chain(...) |
47 | local arg = {...} | 47 | local arg = {...} |
48 | local n = base.select('#',...) | 48 | local n = select('#',...) |
49 | local top, index = 1, 1 | 49 | local top, index = 1, 1 |
50 | local retry = "" | 50 | local retry = "" |
51 | return function(chunk) | 51 | return function(chunk) |
diff --git a/src/makefile b/src/makefile index 522d378..f95498a 100755 --- a/src/makefile +++ b/src/makefile | |||
@@ -16,7 +16,7 @@ | |||
16 | # platform to build for | 16 | # platform to build for |
17 | PLAT?=linux | 17 | PLAT?=linux |
18 | 18 | ||
19 | # LUAV: 5.1 5.2 | 19 | # LUAV: 5.1 5.2 5.3 5.4 |
20 | # lua version to build against | 20 | # lua version to build against |
21 | LUAV?=5.1 | 21 | LUAV?=5.1 |
22 | 22 | ||
@@ -163,7 +163,7 @@ O_macosx=o | |||
163 | CC_macosx=gcc | 163 | CC_macosx=gcc |
164 | DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN | 164 | DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN |
165 | CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common | 165 | CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common |
166 | LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o | 166 | LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o |
167 | LD_macosx=gcc | 167 | LD_macosx=gcc |
168 | SOCKET_macosx=usocket.o | 168 | SOCKET_macosx=usocket.o |
169 | 169 | ||
@@ -176,7 +176,7 @@ CC_linux=gcc | |||
176 | DEF_linux=-DLUASOCKET_$(DEBUG) | 176 | DEF_linux=-DLUASOCKET_$(DEBUG) |
177 | CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ | 177 | CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ |
178 | -Wimplicit -O2 -ggdb3 -fpic | 178 | -Wimplicit -O2 -ggdb3 -fpic |
179 | LDFLAGS_linux=-O -shared -fpic -o | 179 | LDFLAGS_linux=-O -shared -fpic -o |
180 | LD_linux=gcc | 180 | LD_linux=gcc |
181 | SOCKET_linux=usocket.o | 181 | SOCKET_linux=usocket.o |
182 | 182 | ||
@@ -189,7 +189,7 @@ CC_freebsd=gcc | |||
189 | DEF_freebsd=-DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN | 189 | DEF_freebsd=-DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN |
190 | CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ | 190 | CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ |
191 | -Wimplicit -O2 -ggdb3 -fpic | 191 | -Wimplicit -O2 -ggdb3 -fpic |
192 | LDFLAGS_freebsd=-O -shared -fpic -o | 192 | LDFLAGS_freebsd=-O -shared -fpic -o |
193 | LD_freebsd=gcc | 193 | LD_freebsd=gcc |
194 | SOCKET_freebsd=usocket.o | 194 | SOCKET_freebsd=usocket.o |
195 | 195 | ||
@@ -202,7 +202,7 @@ CC_solaris=gcc | |||
202 | DEF_solaris=-DLUASOCKET_$(DEBUG) | 202 | DEF_solaris=-DLUASOCKET_$(DEBUG) |
203 | CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ | 203 | CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \ |
204 | -Wimplicit -O2 -ggdb3 -fpic | 204 | -Wimplicit -O2 -ggdb3 -fpic |
205 | LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o | 205 | LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o |
206 | LD_solaris=gcc | 206 | LD_solaris=gcc |
207 | SOCKET_solaris=usocket.o | 207 | SOCKET_solaris=usocket.o |
208 | 208 | ||
@@ -215,7 +215,7 @@ CC_mingw=gcc | |||
215 | DEF_mingw= -DLUASOCKET_$(DEBUG) \ | 215 | DEF_mingw= -DLUASOCKET_$(DEBUG) \ |
216 | -DWINVER=0x0501 | 216 | -DWINVER=0x0501 |
217 | CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common | 217 | CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common |
218 | LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o | 218 | LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o |
219 | LD_mingw=gcc | 219 | LD_mingw=gcc |
220 | SOCKET_mingw=wsocket.o | 220 | SOCKET_mingw=wsocket.o |
221 | 221 | ||