Merge remote-tracking branch 'origin/master' into parallel-wget

This commit is contained in:
Giuseppe Scrivano 2013-07-12 00:16:23 +02:00
commit a528894d13
8 changed files with 101 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2013-07-11 Tomas Hozza <thozza@redhat.com>
* wget.texi: Document --regex-type and --preserve-permissions.
2013-07-04 Giuseppe Scrivano <gscrivano@gnu.org>
* wget.texi (Download Options): Use '@item' instead of '@itemx'.

View File

@ -1845,6 +1845,10 @@ in some rare firewall configurations, active FTP actually works when
passive FTP doesn't. If you suspect this to be the case, use this
option, or set @code{passive_ftp=off} in your init file.
@cindex file permissions
@item --preserve-permissions
Preserve remote file permissions instead of permissions set by umask.
@cindex symbolic links, retrieving
@item --retr-symlinks
Usually, when retrieving @sc{ftp} directories recursively and a symbolic
@ -2086,6 +2090,11 @@ it will be treated as a pattern, rather than a suffix.
@itemx --reject-regex @var{urlregex}
Specify a regular expression to accept or reject the complete URL.
@item --regex-type @var{regextype}
Specify the regular expression type. Possible types are @samp{posix} or
@samp{pcre}. Note that to be able to use @samp{pcre} type, wget has to be
compiled with libpcre support.
@item -D @var{domain-list}
@itemx --domains=@var{domain-list}
Set domains to be followed. @var{domain-list} is a comma-separated list

View File

@ -1,3 +1,23 @@
2013-07-11 Tim Ruehsen <tim.ruehsen@gmx.de>
* gnutls.c (ssl_connect_wget): respect connect timeout.
2013-07-11 Tomas Hozza <thozza@redhat.com>
* ftp.c (ftp_loop): Use ftp_retrieve_glob() also in case
--preserve-permissions was specified.
2013-03-20 Tomas Hozza <thozza@redhat.com>
* http.c (gethttp): Set "sock" to -1 if it's not and we have no
persistent connection
2013-04-26 Tomas Hozza <thozza@redhat.com> (tiny change)
* log.c (redirect_output): Use DEFAULT_LOGFILE in diagnostic message
when `logfile' is NULL.
* utils.c (unique_create): Ensure `logfile' has always a value.
2013-06-26 Darshit Shah <darnir@gmail.com>
* http.c (gethttp): Reverse change by commit 90896 that prevented

View File

@ -2313,11 +2313,11 @@ ftp_loop (struct url *u, char **local_file, int *dt, struct url *proxy,
file_part = u->path;
ispattern = has_wildcards_p (file_part);
}
if (ispattern || recursive || opt.timestamping)
if (ispattern || recursive || opt.timestamping || opt.preserve_perm)
{
/* ftp_retrieve_glob is a catch-all function that gets called
if we need globbing, time-stamping or recursion. Its
third argument is just what we really need. */
if we need globbing, time-stamping, recursion or preserve
permissions. Its third argument is just what we really need. */
res = ftp_retrieve_glob (u, &con,
ispattern ? GLOB_GLOBALL : GLOB_GETONE);
}

View File

@ -374,6 +374,9 @@ static struct transport_implementation wgnutls_transport =
bool
ssl_connect_wget (int fd, const char *hostname)
{
#ifdef F_GETFL
int flags = 0;
#endif
struct wgnutls_transport_context *ctx;
gnutls_session_t session;
int err,alert;
@ -441,11 +444,54 @@ ssl_connect_wget (int fd, const char *hostname)
return false;
}
if (opt.connect_timeout)
{
#ifdef F_GETFL
flags = fcntl (fd, F_GETFL, 0);
if (flags < 0)
return flags;
if (fcntl (fd, F_SETFL, flags | O_NONBLOCK))
return -1;
#else
/* XXX: Assume it was blocking before. */
const int one = 1;
if (ioctl (fd, FIONBIO, &one) < 0)
return -1;
#endif
}
/* We don't stop the handshake process for non-fatal errors */
do
{
err = gnutls_handshake (session);
if (err < 0)
if (opt.connect_timeout && err == GNUTLS_E_AGAIN)
{
if (gnutls_record_get_direction (session))
{
/* wait for writeability */
err = select_fd (fd, opt.connect_timeout, WAIT_FOR_WRITE);
}
else
{
/* wait for readability */
err = select_fd (fd, opt.connect_timeout, WAIT_FOR_READ);
}
if (err <= 0)
{
if (err == 0)
{
errno = ETIMEDOUT;
err = -1;
}
break;
}
if (err <= 0)
break;
}
else if (err < 0)
{
logprintf (LOG_NOTQUIET, "GnuTLS: %s\n", gnutls_strerror (err));
if (err == GNUTLS_E_WARNING_ALERT_RECEIVED ||
@ -461,6 +507,18 @@ ssl_connect_wget (int fd, const char *hostname)
}
while (err == GNUTLS_E_WARNING_ALERT_RECEIVED && gnutls_error_is_fatal (err) == 0);
if (opt.connect_timeout)
{
#ifdef F_GETFL
if (fcntl (fd, F_SETFL, flags) < 0)
return -1;
#else
const int zero = 0;
if (ioctl (fd, FIONBIO, &zero) < 0)
return -1;
#endif
}
if (err < 0)
{
gnutls_deinit (session);

View File

@ -2243,6 +2243,10 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
exec_name, quote (relevant->host));
return HOSTERR;
}
else if (sock != -1)
{
sock = -1;
}
}
if (sock < 0)

View File

@ -871,7 +871,7 @@ redirect_output (void)
can do but disable printing completely. */
fprintf (stderr, _("\n%s received.\n"), redirect_request_signal_name);
fprintf (stderr, _("%s: %s; disabling logging.\n"),
logfile, strerror (errno));
(logfile) ? logfile : DEFAULT_LOGFILE, strerror (errno));
inhibit_logging = true;
}
save_context_p = false;

View File

@ -703,7 +703,7 @@ unique_create (const char *name, bool binary, char **opened_name)
xfree (uname);
uname = unique_name (name, false);
}
if (opened_name && fp != NULL)
if (opened_name)
{
if (fp)
*opened_name = uname;