[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Body skipped for non-GET (was: Segmentation fault with cu
From: |
Ángel González |
Subject: |
Re: [Bug-wget] Body skipped for non-GET (was: Segmentation fault with current development version of wget) |
Date: |
Fri, 21 Jun 2013 21:44:24 +0200 |
User-agent: |
Thunderbird |
On 14/06/13 14:46, Darshit Shah wrote:
Attaching a patch that should (hopefully) fix all the problems listed here.
I have tested it and it looks good to me.
First of all, I successfully used --method today, so thanks for this option.
However, I discovered that the http reply was not being printed (only in
--debug, with "Skipping %d bytes of body: ...").
I ended up commenting the below extract of the patch.
Why is the body ignored if it's not a GET? This seems wrong. Other
methods like POST or PUT *do* return a body. We are also likely to be
interested in the body for other methods unkown to wget (eg. PROPFIND).
And if it's not desired, ignoring wget output is way easier than
recovering it when it's not provided.
Perhaps the intention was to have strcasecmp(opt.method,"HEAD")==0
instead (but the changelog matches the code).
In case this is really somewhere in the standards, can you provide the
exact location?
The above thread talks just about redirects, but in this case there was
no redirect involved (just a PUT which
returned a 200 with a small body). So I'm afraid that fixing the
redirects broke non-redirect case. And yes, we
need more tests.
Best regards
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2013-06-13 Darshit Shah<address@hidden>
+
+ * http.c (gethttp): Follow RFC 2616 and httpbis specifications when
+ handling redirections. Do not suspend the method on 301/302 redirects.
+ (gethttp): If method if not GET, we do not intend to download
+ anything.
--- a/src/http.c
+++ b/src/http.c
@@ -2755,7 +2770,7 @@ read_header:
}
/* Return if we have no intention of further downloading. */
- if ((!(*dt& RETROKF)&& !opt.content_on_error) || head_only)
+ if ((!(*dt& RETROKF)&& !opt.content_on_error) || head_only || (opt.method&&
strcasecmp(opt.method,"GET")!=0))
{
/* In case the caller cares to look... */
hs->len = 0;