mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fix SIGSEGV in -N / --content-disposition combination
* src/http.c (http_loop): Fix SIGSEGV Reported-by: "Schleusener, Jens" <Jens.Schleusener@t-online.de>
This commit is contained in:
parent
46cd721c0f
commit
218d81f6e5
12
src/http.c
12
src/http.c
@ -3794,7 +3794,6 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
|
|||||||
struct http_stat hstat; /* HTTP status */
|
struct http_stat hstat; /* HTTP status */
|
||||||
struct_stat st;
|
struct_stat st;
|
||||||
bool send_head_first = true;
|
bool send_head_first = true;
|
||||||
char *file_name;
|
|
||||||
bool force_full_retrieve = false;
|
bool force_full_retrieve = false;
|
||||||
|
|
||||||
|
|
||||||
@ -3864,11 +3863,6 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
|
|||||||
if (opt.content_disposition && opt.always_rest)
|
if (opt.content_disposition && opt.always_rest)
|
||||||
send_head_first = true;
|
send_head_first = true;
|
||||||
|
|
||||||
if (!opt.output_document)
|
|
||||||
file_name = url_file_name (opt.trustservernames ? u : original_url, NULL);
|
|
||||||
else
|
|
||||||
file_name = xstrdup (opt.output_document);
|
|
||||||
|
|
||||||
#ifdef HAVE_METALINK
|
#ifdef HAVE_METALINK
|
||||||
if (opt.metalink_over_http)
|
if (opt.metalink_over_http)
|
||||||
{
|
{
|
||||||
@ -3881,7 +3875,7 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
|
|||||||
{
|
{
|
||||||
/* Use conditional get request if requested
|
/* Use conditional get request if requested
|
||||||
* and if timestamp is known at this moment. */
|
* and if timestamp is known at this moment. */
|
||||||
if (opt.if_modified_since && file_exists_p (file_name) && !send_head_first)
|
if (opt.if_modified_since && !send_head_first && got_name && file_exists_p (hstat.local_file))
|
||||||
{
|
{
|
||||||
*dt |= IF_MODIFIED_SINCE;
|
*dt |= IF_MODIFIED_SINCE;
|
||||||
{
|
{
|
||||||
@ -3892,12 +3886,10 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
|
|||||||
}
|
}
|
||||||
/* Send preliminary HEAD request if -N is given and we have existing
|
/* Send preliminary HEAD request if -N is given and we have existing
|
||||||
* destination file or content disposition is enabled. */
|
* destination file or content disposition is enabled. */
|
||||||
else if (file_exists_p (file_name) || opt.content_disposition)
|
else if (opt.content_disposition || file_exists_p (hstat.local_file))
|
||||||
send_head_first = true;
|
send_head_first = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree (file_name);
|
|
||||||
|
|
||||||
/* THE loop */
|
/* THE loop */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user