X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fhttp.c;h=abaa4bdb34e3f31ddb344e0a8f234c07a46462c0;hb=9228f0bf53d3b42459daeb28372196a007de3014;hp=b10960ac916ee832ea53eba7e018adc70c59b78d;hpb=29a66192cf2ceafcc434be59e052c82098a1f824;p=wget diff --git a/src/http.c b/src/http.c index b10960ac..abaa4bdb 100644 --- a/src/http.c +++ b/src/http.c @@ -16,7 +16,17 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wget; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +In addition, as a special exception, the Free Software Foundation +gives permission to link the code of its release of Wget with the +OpenSSL project's "OpenSSL" library (or with modified versions of it +that use the same license as the "OpenSSL" library), and distribute +the linked executables. You must obey the GNU General Public License +in all respects for all of the code used other than "OpenSSL". If you +modify this file, you may extend this exception to your version of the +file, but you are not obligated to do so. If you do not wish to do +so, delete this exception statement from your version. */ #include @@ -574,7 +584,7 @@ struct http_stat char *remote_time; /* remote time-stamp string */ char *error; /* textual HTTP error */ int statcode; /* status code */ - long dltime; /* time of the download */ + double dltime; /* time of the download in msecs */ int no_truncate; /* whether truncating the file is forbidden. */ const char *referer; /* value of the referer header. */ @@ -755,7 +765,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) address_list_release (al); if (sock < 0) - return errno == ECONNREFUSED ? CONREFUSED : CONERROR; + return CONNECT_ERROR (errno); #ifdef HAVE_SSL if (conn->scheme == SCHEME_HTTPS) @@ -1508,8 +1518,12 @@ Refusing to truncate existing file `%s'.\n\n"), *hs->local_file); #### A possible solution to this would be to remember the file position in the output document and to seek to that - position, instead of rewinding. */ - if (!hs->restval && global_download_count == 0) + position, instead of rewinding. + + We don't truncate stdout, since that breaks + "wget -O - [...] >> foo". + */ + if (!hs->restval && global_download_count == 0 && opt.dfp != stdout) { /* This will silently fail for streams that don't correspond to regular files, but that's OK. */ @@ -1600,12 +1614,12 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer, hstat.local_file = local_file; else if (local_file) { - *local_file = url_filename (u); + *local_file = url_file_name (u); hstat.local_file = local_file; } else { - dummy = url_filename (u); + dummy = url_file_name (u); hstat.local_file = &dummy; }