Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 8938 invoked from network); 26 Jun 2009 01:12:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Jun 2009 01:12:04 -0000 Received: (qmail 24327 invoked by uid 500); 26 Jun 2009 01:12:15 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 24263 invoked by uid 500); 26 Jun 2009 01:12:15 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 24254 invoked by uid 99); 26 Jun 2009 01:12:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jun 2009 01:12:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jun 2009 01:12:03 +0000 Received: by brutus.apache.org (Postfix, from userid 33) id 698BA234C044; Thu, 25 Jun 2009 18:11:41 -0700 (PDT) From: bugzilla@apache.org To: notifications@ant.apache.org Subject: DO NOT REPLY [Bug 47433] New: Issue with "get" task to download a redirected/moved URL (301/302) X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: newchanged X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ant X-Bugzilla-Component: Core tasks X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: jagadesh.munta@sun.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: notifications@ant.apache.org X-Bugzilla-Target-Milestone: 1.8.0 X-Bugzilla-Changed-Fields: Message-ID: Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 25 Jun 2009 18:11:41 -0700 (PDT) X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=47433 Summary: Issue with "get" task to download a redirected/moved URL (301/302) Product: Ant Version: 1.7.1 Platform: All OS/Version: Mac OS X 10.4 Status: NEW Severity: major Priority: P2 Component: Core tasks AssignedTo: notifications@ant.apache.org ReportedBy: jagadesh.munta@sun.com Email thread sent to the dev@ant.apache.org alias. Jagadesh Babu Munta wrote: > Changes again as highlighted (missed couple of lines in earlier email):- > > int responseCode = httpConnection.getResponseCode(); > log("Response Code="+responseCode, logLevel); > // test for 401 result (HTTP only) > if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) { > String message = "HTTP Authorization failure"; > if (ignoreErrors) { > log(message, logLevel); > return false; > } else { > throw new BuildException(message); > } > } else if ((responseCode == HttpURLConnection.HTTP_MOVED_PERM) || > (responseCode == HttpURLConnection.HTTP_MOVED_TEMP)) { > String newLocation = httpConnection.getHeaderField("Location"); > String message = "HTTP URL Moved to "+newLocation; > log(message, logLevel); > setSrc(new URL(newLocation)); > execute(); > } > > } > > > Jagadesh Babu Munta wrote: >> Hi, >> >> I am trying use ANT task "get" to download a redirectored or moved URL "http://hudson-ci.org/latest/hudson.war" >> But it doesn't work. It simply get the moved HTML page than the actual redirected URL. Verified with 1.7.1/1.6.5 versions. >> >> I wonder if any workaround? >> >> In fact, I looked at the Get.java taskdef source code and found that code is not taking care of 301/302 HTTP response code. >> >> I have added a simple code (highlighted) in Get.java and worked fine. >> >> Can some one help me getting the fix into the ant code (or) fixed already (or) if any workaround in the latest (1.7.1) or 1.6.5 ANT bits? >> (I joined Today only to this list. Sorry if any one has already discussed the issue. >> >> if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) { >> String message = "HTTP Authorization failure"; >> if (ignoreErrors) { >> log(message, logLevel); >> return false; >> } else { >> throw new BuildException(message); >> } >> } else if ((responseCode == HttpURLConnection.HTTP_MOVED_PERM) || >> (responseCode == HttpURLConnection.HTTP_MOVED_TEMP)) { >> String newLocation = httpConnection.getHeaderField("Location"); >> String message = "HTTP URL Moved to "+newLocation; >> log(message, logLevel); >> setSrc(new URL(newLocation)); >> execute(); >> } >> >> } >> >> >> >> >> Snapshot (problematic):- >> ------------ >> >> >> [get] Getting: http://hudson-ci.org/latest/hudson.war >> [get] To: /Users/munta/runtests/v3/appserver-sqe/build/pe/i386_dhcp-usca14-133-126.SFBay.Sun.COM_Darwin/hudson/archive/hudson.war >> [get] .. >> [get] last modified = Wed Dec 31 16:00:00 PST 1969 - using current time instead >> >> BUILD SUCCESSFUL >> Total time: 2 seconds >> [dhcp-usca14-133-126:v3/appserver-sqe/hudson] munta% cat /Users/munta/runtests/v3/appserver-sqe/build/pe/i386_dhcp-usca14-133-126.SFBay.Sun.COM_Darwin/hudson/archive/hudson.war >> >> >> 302 Found >> >>

Found

>> The document has moved here.

>>


>>
Apache/1.3.33 Server at hudson-ci.org Port 80
>> >> [dhcp-usca14-133-126:v3/appserver-sqe/hudson] munta% >> >> --- >> >> >> Snapshot (worked fine with above code change) >> --------- >> >> [get] Getting: http://hudson-ci.org/latest/hudson.war >> [get] To: /Users/munta/runtests/v3/appserver-sqe/build/pe/i386_dhcp-usca14-133-126.SFBay.Sun.COM_Darwin/hudson/archive/hudson.war >> [get] Response Code=302 >> [get] HTTP URL Moved to https://hudson.dev.java.net/files/documents/2402/137470/hudson.war >> [get] Getting: https://hudson.dev.java.net/files/documents/2402/137470/hudson.war >> [get] To: /Users/munta/runtests/v3/appserver-sqe/build/pe/i386_dhcp-usca14-133-126.SFBay.Sun.COM_Darwin/hudson/archive/hudson.war >> [get] Response Code=200 >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] .................................................... >> [get] ............................. >> [get] last modified = Tue Jun 23 13:57:19 PDT 2009 >> [get] .. >> [get] last modified = Wed Dec 31 16:00:00 PST 1969 - using current time instead >> >> BUILD SUCCESSFUL >> Total time: 39 seconds >> >> >> Thanks for your time and help. >> -- Jagadesh -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.