aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/http.html8
-rw-r--r--luasocket-scm-0.rockspec2
-rw-r--r--src/compat.h2
-rw-r--r--src/http.lua5
-rw-r--r--src/makefile24
5 files changed, 24 insertions, 17 deletions
diff --git a/doc/http.html b/doc/http.html
index 3b7a8b1..78f785a 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -135,7 +135,8 @@ http.<b>request{</b><br>
135&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br> 135&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br>
136&nbsp;&nbsp;[proxy = <i>string</i>,]<br> 136&nbsp;&nbsp;[proxy = <i>string</i>,]<br>
137&nbsp;&nbsp;[redirect = <i>boolean</i>,]<br> 137&nbsp;&nbsp;[redirect = <i>boolean</i>,]<br>
138&nbsp;&nbsp;[create = <i>function</i>]<br> 138&nbsp;&nbsp;[create = <i>function</i>,]<br>
139&nbsp;&nbsp;[maxredirects = <i>number</i>]<br>
139<b>}</b> 140<b>}</b>
140</p> 141</p>
141 142
@@ -185,6 +186,7 @@ Defaults to the LTN12 <tt>pump.step</tt> function.
185function from automatically following 301 or 302 server redirect messages; 186function from automatically following 301 or 302 server redirect messages;
186<li><tt>create</tt>: An optional function to be used instead of 187<li><tt>create</tt>: An optional function to be used instead of
187<a href=tcp.html#socket.tcp><tt>socket.tcp</tt></a> when the communications socket is created. 188<a href=tcp.html#socket.tcp><tt>socket.tcp</tt></a> when the communications socket is created.
189<li><tt>maxredirects</tt>: An optional number specifying the maximum number of redirects to follow. Defaults to <tt>5</tt> if not specified. A boolean <tt>false</tt> value means no maximum (unlimited).
188</ul> 190</ul>
189 191
190<p class=return> 192<p class=return>
@@ -324,8 +326,8 @@ r, c = http.request {
324</p> 326</p>
325<p> 327<p>
326<small> 328<small>
327Last modified by Diego Nehab on <br> 329Last modified by Eric Westbrook on <br>
328Thu Apr 20 00:25:26 EDT 2006 330Sat Feb 23 19:09:42 UTC 2019
329</small> 331</small>
330</p> 332</p>
331</center> 333</center>
diff --git a/luasocket-scm-0.rockspec b/luasocket-scm-0.rockspec
index 61bd645..c827e46 100644
--- a/luasocket-scm-0.rockspec
+++ b/luasocket-scm-0.rockspec
@@ -75,7 +75,7 @@ local function make_plat(plat)
75 modules["socket.core"].libraries = {"network"} 75 modules["socket.core"].libraries = {"network"}
76 end 76 end
77 modules["socket.unix"] = { 77 modules["socket.unix"] = {
78 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" }, 78 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c", "src/unixdgram.c", "src/unixstream.c" },
79 defines = defines[plat], 79 defines = defines[plat],
80 incdir = "/src" 80 incdir = "/src"
81 } 81 }
diff --git a/src/compat.h b/src/compat.h
index e2ab307..49e83f9 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -5,6 +5,8 @@
5#include "lauxlib.h" 5#include "lauxlib.h"
6 6
7#if LUA_VERSION_NUM==501 7#if LUA_VERSION_NUM==501
8#define luaL_setfuncs socket_setfuncs
9#define luaL_testudata socket_testudata
8void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); 10void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
9void *luaL_testudata ( lua_State *L, int arg, const char *tname); 11void *luaL_testudata ( lua_State *L, int arg, const char *tname);
10#endif 12#endif
diff --git a/src/http.lua b/src/http.lua
index 6b26a0a..fb729b2 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -285,7 +285,9 @@ local function shouldredirect(reqt, code, headers)
285 return (reqt.redirect ~= false) and 285 return (reqt.redirect ~= false) and
286 (code == 301 or code == 302 or code == 303 or code == 307) and 286 (code == 301 or code == 302 or code == 303 or code == 307) and
287 (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD") 287 (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD")
288 and (not reqt.nredirects or reqt.nredirects < 5) 288 and ((false == reqt.maxredirects)
289 or ((reqt.nredirects or 0)
290 < (reqt.maxredirects or 5)))
289end 291end
290 292
291local function shouldreceivebody(reqt, code) 293local function shouldreceivebody(reqt, code)
@@ -307,6 +309,7 @@ local trequest, tredirect
307 sink = reqt.sink, 309 sink = reqt.sink,
308 headers = reqt.headers, 310 headers = reqt.headers,
309 proxy = reqt.proxy, 311 proxy = reqt.proxy,
312 maxredirects = reqt.maxredirects,
310 nredirects = (reqt.nredirects or 0) + 1, 313 nredirects = (reqt.nredirects or 0) + 1,
311 create = reqt.create 314 create = reqt.create
312 } 315 }
diff --git a/src/makefile b/src/makefile
index 0f4b359..cc1ec7e 100644
--- a/src/makefile
+++ b/src/makefile
@@ -35,7 +35,7 @@ DEBUG?=NODEBUG
35# LUAINC_macosx: 35# LUAINC_macosx:
36# /opt/local/include 36# /opt/local/include
37LUAINC_macosx_base?=/opt/local/include 37LUAINC_macosx_base?=/opt/local/include
38LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) 38LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) $(LUAINC_macosx_base)/lua$(LUAV)
39# FIXME default should this default to fink or to macports? 39# FIXME default should this default to fink or to macports?
40# What happens when more than one Lua version is installed? 40# What happens when more than one Lua version is installed?
41LUAPREFIX_macosx?=/opt/local 41LUAPREFIX_macosx?=/opt/local
@@ -48,7 +48,7 @@ LDIR_macosx?=share/lua/$(LUAV)
48# /usr/local/include/lua$(LUAV) 48# /usr/local/include/lua$(LUAV)
49# where lua headers are found for linux builds 49# where lua headers are found for linux builds
50LUAINC_linux_base?=/usr/include 50LUAINC_linux_base?=/usr/include
51LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) 51LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) $(LUAINC_linux_base)/lua$(LUAV)
52LUAPREFIX_linux?=/usr/local 52LUAPREFIX_linux?=/usr/local
53CDIR_linux?=lib/lua/$(LUAV) 53CDIR_linux?=lib/lua/$(LUAV)
54LDIR_linux?=share/lua/$(LUAV) 54LDIR_linux?=share/lua/$(LUAV)
@@ -57,7 +57,7 @@ LDIR_linux?=share/lua/$(LUAV)
57# /usr/local/include/lua$(LUAV) 57# /usr/local/include/lua$(LUAV)
58# where lua headers are found for freebsd builds 58# where lua headers are found for freebsd builds
59LUAINC_freebsd_base?=/usr/local/include/ 59LUAINC_freebsd_base?=/usr/local/include/
60LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua$(LUAV) 60LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua/$(LUAV) $(LUAINC_freebsd_base)/lua$(LUAV)
61LUAPREFIX_freebsd?=/usr/local/ 61LUAPREFIX_freebsd?=/usr/local/
62CDIR_freebsd?=lib/lua/$(LUAV) 62CDIR_freebsd?=lib/lua/$(LUAV)
63LDIR_freebsd?=share/lua/$(LUAV) 63LDIR_freebsd?=share/lua/$(LUAV)
@@ -66,7 +66,7 @@ LDIR_freebsd?=share/lua/$(LUAV)
66# LUAINC_mingw: 66# LUAINC_mingw:
67# /opt/local/include 67# /opt/local/include
68LUAINC_mingw_base?=/usr/include 68LUAINC_mingw_base?=/usr/include
69LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) 69LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) $(LUAINC_mingw_base)/lua$(LUAV)
70LUALIB_mingw_base?=/usr/bin 70LUALIB_mingw_base?=/usr/bin
71LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll 71LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll
72LUAPREFIX_mingw?=/usr 72LUAPREFIX_mingw?=/usr
@@ -78,7 +78,7 @@ LDIR_mingw?=lua/$(LUAV)/lua
78# LUALIB_win32: 78# LUALIB_win32:
79# where lua headers and libraries are found for win32 builds 79# where lua headers and libraries are found for win32 builds
80LUAPREFIX_win32?= 80LUAPREFIX_win32?=
81LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) 81LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) $(LUAPREFIX_win32)/include/lua$(LUAV)
82PLATFORM_win32?=Release 82PLATFORM_win32?=Release
83CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32) 83CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)
84LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua 84LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua
@@ -88,7 +88,7 @@ LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib
88 88
89# LUAINC_solaris: 89# LUAINC_solaris:
90LUAINC_solaris_base?=/usr/include 90LUAINC_solaris_base?=/usr/include
91LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV) 91LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV) $(LUAINC_solaris_base)/lua$(LUAV)
92LUAPREFIX_solaris?=/usr/local 92LUAPREFIX_solaris?=/usr/local
93CDIR_solaris?=lib/lua/$(LUAV) 93CDIR_solaris?=lib/lua/$(LUAV)
94LDIR_solaris?=share/lua/$(LUAV) 94LDIR_solaris?=share/lua/$(LUAV)
@@ -153,7 +153,7 @@ DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
153 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 153 -DLUASOCKET_API='__attribute__((visibility("default")))' \
154 -DUNIX_API='__attribute__((visibility("default")))' \ 154 -DUNIX_API='__attribute__((visibility("default")))' \
155 -DMIME_API='__attribute__((visibility("default")))' 155 -DMIME_API='__attribute__((visibility("default")))'
156CFLAGS_macosx= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ 156CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common \
157 -fvisibility=hidden 157 -fvisibility=hidden
158LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o 158LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
159LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc 159LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
@@ -169,7 +169,7 @@ DEF_linux=-DLUASOCKET_$(DEBUG) \
169 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 169 -DLUASOCKET_API='__attribute__((visibility("default")))' \
170 -DUNIX_API='__attribute__((visibility("default")))' \ 170 -DUNIX_API='__attribute__((visibility("default")))' \
171 -DMIME_API='__attribute__((visibility("default")))' 171 -DMIME_API='__attribute__((visibility("default")))'
172CFLAGS_linux= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ 172CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
173 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden 173 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
174LDFLAGS_linux=-O -shared -fpic -o 174LDFLAGS_linux=-O -shared -fpic -o
175LD_linux=gcc 175LD_linux=gcc
@@ -185,7 +185,7 @@ DEF_freebsd=-DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
185 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 185 -DLUASOCKET_API='__attribute__((visibility("default")))' \
186 -DUNIX_API='__attribute__((visibility("default")))' \ 186 -DUNIX_API='__attribute__((visibility("default")))' \
187 -DMIME_API='__attribute__((visibility("default")))' 187 -DMIME_API='__attribute__((visibility("default")))'
188CFLAGS_freebsd= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ 188CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
189 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden 189 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
190LDFLAGS_freebsd=-O -shared -fpic -o 190LDFLAGS_freebsd=-O -shared -fpic -o
191LD_freebsd=gcc 191LD_freebsd=gcc
@@ -201,7 +201,7 @@ DEF_solaris=-DLUASOCKET_$(DEBUG) \
201 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 201 -DLUASOCKET_API='__attribute__((visibility("default")))' \
202 -DUNIX_API='__attribute__((visibility("default")))' \ 202 -DUNIX_API='__attribute__((visibility("default")))' \
203 -DMIME_API='__attribute__((visibility("default")))' 203 -DMIME_API='__attribute__((visibility("default")))'
204CFLAGS_solaris=-I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ 204CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
205 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden 205 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
206LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o 206LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o
207LD_solaris=gcc 207LD_solaris=gcc
@@ -216,7 +216,7 @@ CC_mingw=gcc
216DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \ 216DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \
217 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \ 217 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
218 -DMIME_API='__declspec(dllexport)' 218 -DMIME_API='__declspec(dllexport)'
219CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ 219CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common \
220 -fvisibility=hidden 220 -fvisibility=hidden
221LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o 221LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
222LD_mingw=gcc 222LD_mingw=gcc
@@ -233,7 +233,7 @@ DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
233 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \ 233 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
234 //D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \ 234 //D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \
235 //D "LUASOCKET_$(DEBUG)" 235 //D "LUASOCKET_$(DEBUG)"
236CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo 236CFLAGS_win32=$(LUAINC:%=//I "%") $(DEF) //O2 //Ot //MD //W3 //nologo
237LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \ 237LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
238 //MANIFEST //MANIFESTFILE:"intermediate.manifest" \ 238 //MANIFEST //MANIFESTFILE:"intermediate.manifest" \
239 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ 239 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \