]> sjero.net Git - wget/commitdiff
Automated merge.
authorSaint Xavier <wget@sxav.eu>
Thu, 26 Jun 2008 16:10:16 +0000 (18:10 +0200)
committerSaint Xavier <wget@sxav.eu>
Thu, 26 Jun 2008 16:10:16 +0000 (18:10 +0200)
src/ChangeLog
src/Makefile.am
src/build_info.c
src/ftp-ls.c
src/http.c
tests/ChangeLog
tests/Test-proxied-https-auth.px
tests/certs/server-cert.pem [new file with mode: 0644]
tests/certs/server-key.pem [new file with mode: 0644]

index f8aae8b9230f4d9a2571e79b3dad1a8f48043558..9e31b1c44fd89f83f9cef3a22519f9774daefd9e 100644 (file)
@@ -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  <stsc@members.fsf.org>
+
+       * http.c (http_loop): Replace escnonprint() occurence with
+       a quotearg_style() call.
+
+2008-06-24  Micah Cowan  <micah@cowan.name>
+
+       * 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  <stsc@members.fsf.org>
+
+       * http.c: Explicitly initialize and deallocate the message
+       string used by the -nv --spider functionality.
+
+2008-06-22  Steven Schubiger  <schubiger@gmail.com>
+
+       * http.c: Make -nv --spider include the file's name when it
+       exists.
+
+2008-06-22  Micah Cowan  <micah@cowan.name>
+
+       * 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  <wget@sxav.eu>
 
        * iri.h : Make no-op version of parse_charset() return
        NULL.
 
+2008-06-16  Micah Cowan  <micah@cowan.name>
+
+       * 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  <wget@sxav.eu>
 
        * iri.c, iri.h : New files.
@@ -54,7 +86,8 @@
 
 2008-06-13  Micah Cowan  <micah@cowan.name>
 
-       * 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 <com.gmail.hrmadhu>
 
        default.
 
 2008-05-17  Kenny Parnell  <k.parnell@gmail.com>
-       
+
        (cmd_spec_prefer_family): Initialize prefer_family to prefer_none.
 
 2008-05-17  Micah Cowan  <micah@cowan.name>
-       
+
        * main.c (main): Handle Ctrl-D on command-line.
 
 2008-05-15  Steven Schubiger  <schubiger@gmail.com>
 
        * 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.
 
index 379a9b8cd791f535957a49bcef28cbb63a51b3e3..6ae5805d5ba6400354079aa871969c107c72f9f0 100644 (file)
@@ -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
index 129bf7264dae6f5d867a32413bc9b6d3d50b4431..00d5122d89fcae0c9d67eac0e3c589dc07e3bec6 100644 (file)
@@ -90,9 +90,9 @@ const char* (compiled_features[]) =
 #endif
 
 #ifdef HAVE_LIBSSL
-  "+ssl",
+  "+openssl",
 #else
-  "-ssl",
+  "-openssl",
 #endif
 
 #ifdef HAVE_GETTEXT
index e050c5a25460a5444a032e0eaa83a6f1daff8f02..409996c350d2ad2f9e25e030e03b16558b4b9be9 100644 (file)
@@ -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);
index 741ed2c003fb9a29855725c49fec1b86979c2d48..a4571ad7019b99180a1b44ffa1ffbd1d055e6d38 100644 (file)
@@ -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 */
         {
index 3efa37bf22cdb5a249dbac86ef2ebb943d362298..36bc35dc9afb0c782024f787c6a8f54a552e5c9b 100644 (file)
@@ -1,3 +1,13 @@
+2008-06-22  Micah Cowan  <micah@cowan.name>
+
+       * 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  <micah@cowan.name>
 
        * FTPServer.pm, FTPTest.pm, HTTPServer.pm, HTTPTest.pm,
index b732d553bab3f626a5d5e0e4260bfa88d21340e6..a2efe5ebcb5b90a82d1733c00965c4bf177127ff 100755 (executable)
@@ -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 (file)
index 0000000..af653c9
--- /dev/null
@@ -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 (file)
index 0000000..f3e6007
--- /dev/null
@@ -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-----