From owner-freebsd-bugs@FreeBSD.ORG Tue May 8 07:30:04 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 16B8A16A406 for ; Tue, 8 May 2007 07:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id EC88413C46A for ; Tue, 8 May 2007 07:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l487U3Ae057284 for ; Tue, 8 May 2007 07:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l487U3Bh057281; Tue, 8 May 2007 07:30:03 GMT (envelope-from gnats) Resent-Date: Tue, 8 May 2007 07:30:03 GMT Resent-Message-Id: <200705080730.l487U3Bh057281@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Ryan C. Gordon" Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DF94316A401 for ; Tue, 8 May 2007 07:27:15 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id D1BDD13C45A for ; Tue, 8 May 2007 07:27:15 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l487RFUq077838 for ; Tue, 8 May 2007 07:27:15 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l487MEYB075332; Tue, 8 May 2007 07:22:14 GMT (envelope-from nobody) Message-Id: <200705080722.l487MEYB075332@www.freebsd.org> Date: Tue, 8 May 2007 07:22:14 GMT From: "Ryan C. Gordon" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: misc/112515: libfetch doesn't support HTTP 307 "Temporary Redirect" results X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2007 07:30:04 -0000 >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: