This makes luasocket work with
303 See Other and
307 Temporary Redirect

HTTP redirections, similiar to what ftp(1) already does.

303 in particular is something youtube sometimes returns.

thoughts?

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/luasocket/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile    11 Jun 2008 05:04:37 -0000      1.14
+++ Makefile    3 Nov 2008 13:20:06 -0000
@@ -4,7 +4,7 @@ SHARED_ONLY=    Yes
 
 COMMENT=       network support for the lua language
 DISTNAME=      luasocket-2.0.1
-PKGNAME=       ${DISTNAME}p1
+PKGNAME=       ${DISTNAME}p2
 CATEGORIES=    net
 
 MASTER_SITES=  http://luaforge.net/frs/download.php/1589/
Index: patches/patch-src_http_lua
===================================================================
RCS file: patches/patch-src_http_lua
diff -N patches/patch-src_http_lua
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_http_lua  3 Nov 2008 13:20:06 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/http.lua.orig  Mon Nov  3 23:17:12 2008
++++ src/http.lua       Mon Nov  3 23:17:57 2008
+@@ -242,7 +242,7 @@ local function shouldredirect(reqt, code, headers)
+     return headers.location and
+            string.gsub(headers.location, "%s", "") ~= "" and
+            (reqt.redirect ~= false) and
+-           (code == 301 or code == 302) and
++           (code == 301 or code == 302 or code == 303 or code == 307) and
+            (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD")
+            and (not reqt.nredirects or reqt.nredirects < 5)
+ end

Reply via email to