Date: Tue, 8 May 2007 07:22:14 GMT From: "Ryan C. Gordon"<icculus@icculus.org> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/112515: libfetch doesn't support HTTP 307 "Temporary Redirect" results Message-ID: <200705080722.l487MEYB075332@www.freebsd.org> Resent-Message-ID: <200705080730.l487U3Bh057281@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 112515 >Category: misc >Synopsis: libfetch doesn't support HTTP 307 "Temporary Redirect" results >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 08 07:30:03 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Ryan C. Gordon >Release: >Organization: >Environment: >Description: (I'm not actually running FreeBSD, I'm just using libfetch's source in a different project. Thank you for writing it, it's really handy!) libfetch has support for HTTP redirects, but doesn't have HTTP result 307 ("Temporary Redirect") in the list of redirecting results, so it fails these requests as an unknown error condition. >How-To-Repeat: Have libfetch attempt to download this URL: http://icculus.org/~icculus/dotplan/secondlife_screenie2.jpg The webserver will redirect you to the same path on a different server, using a 307 result. You should end up here: http://offload1.icculus.org/~icculus/dotplan/secondlife_screenie2.jpg ..which will serve the content as expected...libfetch gives up when it sees the 307 on the first server, though. >Fix: libfetch can handle this if 307 is added to its list of result codes. I have included a patch that makes the above URL work. Patch attached with submission follows: ? libfetch-http-307.diff Index: http.c =================================================================== RCS file: /home/ncvs/src/lib/libfetch/http.c,v retrieving revision 1.77 diff -u -r1.77 http.c --- http.c 24 Aug 2005 12:28:05 -0000 1.77 +++ http.c 8 May 2007 07:12:02 -0000 @@ -92,6 +92,7 @@ #define HTTP_MOVED_PERM 301 #define HTTP_MOVED_TEMP 302 #define HTTP_SEE_OTHER 303 +#define HTTP_TEMP_REDIRECT 307 #define HTTP_NEED_AUTH 401 #define HTTP_NEED_PROXY_AUTH 407 #define HTTP_BAD_RANGE 416 @@ -99,6 +100,7 @@ #define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \ || (xyz) == HTTP_MOVED_TEMP \ + || (xyz) == HTTP_TEMP_REDIRECT \ || (xyz) == HTTP_SEE_OTHER) #define HTTP_ERROR(xyz) ((xyz) > 400 && (xyz) < 599) >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705080722.l487MEYB075332>