From: Saint Xavier Date: Thu, 26 Jun 2008 16:10:16 +0000 (+0200) Subject: Automated merge. X-Git-Tag: v1.13~338^2~7^2~6^2~13^2~20 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=d3007f1b3a5d033babe40bc4c56a899eb3b10bfa;hp=3b8b1b82d66a826d178b37b52dd9d158a5bb2ddc Automated merge. --- diff --git a/src/ChangeLog b/src/ChangeLog index f8aae8b9..9e31b1c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,32 @@ * url.c : Convert URLs from locale to UTF-8 allowing a basic support of IRI/IDN +2008-06-24 Steven Schubiger + + * http.c (http_loop): Replace escnonprint() occurence with + a quotearg_style() call. + +2008-06-24 Micah Cowan + + * ftp-ls.c (ftp_index): Don't assume time_t* is compatible with + long*. Fixes crash on Windows, and probably other systems. + +2008-06-22 Steven Schubiger + + * http.c: Explicitly initialize and deallocate the message + string used by the -nv --spider functionality. + +2008-06-22 Steven Schubiger + + * http.c: Make -nv --spider include the file's name when it + exists. + +2008-06-22 Micah Cowan + + * Makefile.am (version.c): Fixed version string invocation so it + once again can't result in unterminated strings, made all the + string vars pointers-to-const, and moved line lengths + below 80 (in Makefile.am, not in version.c). 2008-06-19 Xavier Saint @@ -37,6 +63,12 @@ * iri.h : Make no-op version of parse_charset() return NULL. +2008-06-16 Micah Cowan + + * http.c (http_loop): When hstat.len is higher than the + successfully completed content's length, but it's because we + _set_ it that way, don't abort. + 2008-06-14 Xavier Saint * iri.c, iri.h : New files. @@ -54,7 +86,8 @@ 2008-06-13 Micah Cowan - * build_info.c: ENABLE_NTLM, not HAVE_NTLM. + * build_info.c: ENABLE_NTLM, not HAVE_NTLM; distinguish OpenSSL + from "ssl". 2008-06-13 Madhusudan Hosaagrahara @@ -94,11 +127,11 @@ default. 2008-05-17 Kenny Parnell - + (cmd_spec_prefer_family): Initialize prefer_family to prefer_none. 2008-05-17 Micah Cowan - + * main.c (main): Handle Ctrl-D on command-line. 2008-05-15 Steven Schubiger @@ -137,7 +170,7 @@ * options.h: Add an according boolean member to the options struct. - + * sysdep.h: Comment the defines __EXTENSIONS__ and _GNU_SOURCE out, because they're now defined independently by config.h. diff --git a/src/Makefile.am b/src/Makefile.am index 379a9b8c..6ae5805d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,12 +59,14 @@ version.c: $(wget_SOURCES) $(LDADD) $(srcdir)/Makefile.am echo '/* version.c */' > $@ echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@ echo '' >> $@ - echo -n 'char* version_string = "@VERSION@ ' >> $@ - -hg log -r . --template=' ({node|short})"\n' 2>/dev/null >> $@ + echo -n 'const char *version_string = "@VERSION@"' >> $@ + -hg log -r . --template='" ({node|short})"\n' 2>/dev/null >> $@ echo ';' >> $@ - echo 'char* compilation_string = "'$(COMPILE)'";' | $(ESCAPEQUOTE) >> $@ - echo 'char* link_string = "'$(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) $(LIBS) $(wget_LDADD)'";' | $(ESCAPEQUOTE) >> $@ + echo 'const char *compilation_string = "'$(COMPILE)'";' \ + | $(ESCAPEQUOTE) >> $@ + echo 'const char *link_string = "'$(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) $(LIBS) $(wget_LDADD)'";' \ + | $(ESCAPEQUOTE) >> $@ check_LIBRARIES = libunittest.a libunittest_a_SOURCES = $(wget_SOURCES) test.c test.h diff --git a/src/build_info.c b/src/build_info.c index 129bf726..00d5122d 100644 --- a/src/build_info.c +++ b/src/build_info.c @@ -90,9 +90,9 @@ const char* (compiled_features[]) = #endif #ifdef HAVE_LIBSSL - "+ssl", + "+openssl", #else - "-ssl", + "-openssl", #endif #ifdef HAVE_GETTEXT diff --git a/src/ftp-ls.c b/src/ftp-ls.c index e050c5a2..409996c3 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -894,7 +894,8 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f) "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - struct tm *ptm = localtime ((time_t *)&f->tstamp); + time_t tstamp = f->tstamp; + struct tm *ptm = localtime (&tstamp); fprintf (fp, "%d %s %02d ", ptm->tm_year + 1900, months[ptm->tm_mon], ptm->tm_mday); diff --git a/src/http.c b/src/http.c index 741ed2c0..a4571ad7 100644 --- a/src/http.c +++ b/src/http.c @@ -1297,6 +1297,7 @@ struct http_stat char *remote_time; /* remote time-stamp string */ char *error; /* textual HTTP error */ int statcode; /* status code */ + char *message; /* status message */ wgint rd_size; /* amount of data read from socket */ double dltime; /* time it took to download the data */ const char *referer; /* value of the referer header. */ @@ -1323,6 +1324,7 @@ free_hstat (struct http_stat *hs) xfree_null (hs->rderrmsg); xfree_null (hs->local_file); xfree_null (hs->orig_file_name); + xfree_null (hs->message); /* Guard against being called twice. */ hs->newloc = NULL; @@ -1442,6 +1444,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) hs->newloc = NULL; hs->remote_time = NULL; hs->error = NULL; + hs->message = NULL; conn = u; @@ -1714,6 +1717,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) resp = resp_new (head); statcode = resp_status (resp, &message); + hs->message = xstrdup (message); resp_free (resp); xfree (head); if (statcode != 200) @@ -1796,6 +1800,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) /* Check for status line. */ message = NULL; statcode = resp_status (resp, &message); + hs->message = xstrdup (message); if (!opt.server_response) logprintf (LOG_VERBOSE, "%2d %s\n", statcode, message ? quotearg_style (escape_quoting_style, message) : ""); @@ -2670,19 +2675,20 @@ The sizes do not match (local %s) -- retrieving.\n"), if (opt.spider) { + bool finished = true; if (opt.recursive) { if (*dt & TEXTHTML) { logputs (LOG_VERBOSE, _("\ Remote file exists and could contain links to other resources -- retrieving.\n\n")); + finished = false; } else { logprintf (LOG_VERBOSE, _("\ Remote file exists but does not contain any link -- not retrieving.\n\n")); ret = RETROK; /* RETRUNNEEDED is not for caller. */ - goto exit; } } else @@ -2699,6 +2705,14 @@ but recursion is disabled -- not retrieving.\n\n")); Remote file exists.\n\n")); } ret = RETROK; /* RETRUNNEEDED is not for caller. */ + } + + if (finished) + { + logprintf (LOG_NONVERBOSE, + _("%s URL:%s %2d %s\n"), + tms, u->url, hstat.statcode, + hstat.message ? quotearg_style (escape_quoting_style, hstat.message) : ""); goto exit; } } @@ -2808,10 +2822,18 @@ Remote file exists.\n\n")); printwhat (count, opt.ntry); continue; } - else + else if (hstat.len != hstat.restval) /* Getting here would mean reading more data than requested with content-length, which we never do. */ abort (); + else + { + /* Getting here probably means that the content-length was + * _less_ than the original, local size. We should probably + * truncate or re-read, or something. FIXME */ + ret = RETROK; + goto exit; + } } else /* from now on hstat.res can only be -1 */ { diff --git a/tests/ChangeLog b/tests/ChangeLog index 3efa37bf..36bc35dc 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,13 @@ +2008-06-22 Micah Cowan + + * Test-proxied-https-auth.px: Shift exit code so it falls in the + lower bits, and actually fails when it should. Use dynamic port, + instead of static port. Only run the test if our Wget was built + with HTTPS support. + + * certs/server-cert.pem, certs/server-key.pem: Apparently failed + to add these from 1.11.x repo. Fixed. + 2008-06-12 Micah Cowan * FTPServer.pm, FTPTest.pm, HTTPServer.pm, HTTPTest.pm, diff --git a/tests/Test-proxied-https-auth.px b/tests/Test-proxied-https-auth.px index b732d553..a2efe5eb 100755 --- a/tests/Test-proxied-https-auth.px +++ b/tests/Test-proxied-https-auth.px @@ -3,9 +3,22 @@ use warnings; use strict; use WgetTest; # For $WGETPATH. + +# Have we even built an HTTPS-supporting Wget? +{ + my @version_lines = `${WgetTest::WGETPATH} --version`; + unless (grep /\+(openssl|gnutls)/, @version_lines) { + print "Not running test: Wget under test doesn't support HTTPS.\n"; + exit 0; + } +} + use HTTP::Daemon; use HTTP::Request; -use IO::Socket::SSL 'debug4'; +use IO::Socket::SSL; + +my $SOCKET = HTTP::Daemon->new (LocalAddr => 'localhost', + ReuseAddr => 1) or die "Cannot create server!!!"; sub get_request { my $conn = shift; @@ -26,9 +39,7 @@ sub get_request { sub do_server { my $alrm = alarm 10; - my $s = HTTP::Daemon->new (LocalAddr => 'localhost', - LocalPort => '8080', - ReuseAddr => 1) or die "Cannot create server!!!"; + my $s = $SOCKET; my $conn; my $rqst; my $rspn; @@ -68,6 +79,10 @@ sub do_server { 'Content-Type' => 'text/plain', 'Connection' => 'close', ], "foobarbaz\n"); + $rspn->protocol('HTTP/1.0'); + print "=====\n"; + print $rspn->as_string; + print "\n=====\n"; print $conn $rspn->as_string; } $conn->close; @@ -94,9 +109,11 @@ my $cmdline = $WgetTest::WGETPATH . " --user=fiddle-dee-dee" . " --password=Dodgson -e https_proxy=localhost:{{port}}" . " --no-check-certificate" . " https://no.such.domain/needs-auth.txt"; +$cmdline =~ s/{{port}}/$SOCKET->sockport()/e; my $code = system($cmdline); +system ('rm -f needs-auth.txt'); warn "Got code: $code\n" if $code; kill ('TERM', $pid); -exit $code; +exit ($code >> 8); diff --git a/tests/certs/server-cert.pem b/tests/certs/server-cert.pem new file mode 100644 index 00000000..af653c98 --- /dev/null +++ b/tests/certs/server-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDnDCCAwWgAwIBAgIJAIsoR6UicPPEMA0GCSqGSIb3DQEBBQUAMIGRMQswCQYD +VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTETMBEGA1UEBxMKU2FudGEgQ2xh +YTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRQwEgYDVQQDEwtN +aWNhaCBDb3dhbjEfMB0GCSqGSIb3DQEJARYQbWljYWhAY293YW4ubmFtZTAeFw0w +ODA0MjIwNTQxNDBaFw0wODA1MjIwNTQxNDBaMIGRMQswCQYDVQQGEwJVUzETMBEG +A1UECBMKQ2FsaWZvcm5pYTETMBEGA1UEBxMKU2FudGEgQ2xhYTEhMB8GA1UEChMY +SW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRQwEgYDVQQDEwtNaWNhaCBDb3dhbjEf +MB0GCSqGSIb3DQEJARYQbWljYWhAY293YW4ubmFtZTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEAxgJGqBxMUjykBTWHg0jTAH59WbxV6JLMAirwskri0u9o6m9f +Xw/ZsteKxmypgvwPcDoqZFWF5TB4sEf2l2m7N++mOLtjS9PLBaE8Y0siF1+EMXrI +mffet9PeXXceuTMFx6bTzls7EwLMvmvSynwFK1j9EHH0mFA19MkeQwWG5zECAwEA +AaOB+TCB9jAdBgNVHQ4EFgQU0LEi7ld7tvUls/fmbmn80+b//TAwgcYGA1UdIwSB +vjCBu4AU0LEi7ld7tvUls/fmbmn80+b//TChgZekgZQwgZExCzAJBgNVBAYTAlVT +MRMwEQYDVQQIEwpDYWxpZm9ybmlhMRMwEQYDVQQHEwpTYW50YSBDbGFhMSEwHwYD +VQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFDASBgNVBAMTC01pY2FoIENv +d2FuMR8wHQYJKoZIhvcNAQkBFhBtaWNhaEBjb3dhbi5uYW1lggkAiyhHpSJw88Qw +DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBOSi75jsItAkhiYW0Up1d8 +OFA1saDlxBDm7ZUQTcfxIQL75iYfxMUEWeWPRLmNId96a1PgMT6U2+vKrnoNj8bu +R45xNaFPKxOzp7axWSOp9AJcR6neug2v7lKkKOcQ14dFlKH1AoP+fDuvSAZyfMeC +7fbIfz3XFNxaR4Rd07w/OQ== +-----END CERTIFICATE----- diff --git a/tests/certs/server-key.pem b/tests/certs/server-key.pem new file mode 100644 index 00000000..f3e60071 --- /dev/null +++ b/tests/certs/server-key.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,8B09CBCC4587B80C + +Yikael4jBlULlN5QU2SIN38OsTqbkcNZGVcoT5rpGf2Mh+aLRRnSvpIAOqNbIcEw +T8pOtbic9AUh2YaCUK5xw5ou47t2dkieWB0a/amfOAFiajca+94AI+f1k73D85Y9 +bqCkal7pMzIEh22+qIHrUqJLeZdFOIq/C2j4a8Ymv2qmcQ7aKHfmtM3I1XWqg/ql +GNDwhDxTJ1C6rMvXblDQ5gb4uqdUCw03jVOKTh7kQCNjV6RZqtzFShARiuL2yt4J +l8H116hT6JtyVAm6kQIws0wqYPiIQxgpHQV21OibDh7WwD+i2sN77vnG06bYi7C6 +l8PkHsB2VbR2GjrZXAW1MGrCIVllbouFJ3zhPTr1DsDuCQ7G9dc8J/lviaWCi+HL +aWq99V824sjz0CuzRqdUINx1f2XR53+ltSiyXk77NpyUOj/2nGQd2RhsjC/gLHdU +J5152dOoYRmhftubfNr9Cend76rCkwLhZ1ZOa1LDgkT7HFD+4FIeW02opwGpRo/k +XxOIkI7EF3em1MXfbRq1GEXr/KBkTKKeiaVUYW4klytX9crOZ+Dxv9KZRANAPzuF +Tmx1gO4qJL2d8SXlNbUd4MRwCwK2CgUyUknL9kGkt98N2sYUyJETwSWUWbNnP31g +R0sUKSvJN1k8DfZTpP/8znW1kz+vPa66tuRjBRd96JNUDdqSHHywT4DnR/pUNzdG +uUD4/x4VgEwMcOYOKAFeOInn5pPINecU8EE4SehLODW3YdQW4hnxxaltuXPAkvNo +6ST/6HVi/iSJsfvqUuEEXw/SGRMB0aZ+YEIOn4hVnu+gE8N07tuyvQ== +-----END RSA PRIVATE KEY-----