]> sjero.net Git - wget/blobdiff - src/http.c
[svn] Minor fixes prompted by `lint'.
[wget] / src / http.c
index 9043527ac947e0da8995cefbc5f6ea4573a61493..95bb31eacccbea7d7ab8b0ad987382471330c124 100644 (file)
@@ -44,12 +44,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 # endif
 #endif
 
-#ifdef WINDOWS
-# include <winsock.h>
-#else
-# include <netdb.h>            /* for h_errno */
-#endif
-
 #include "wget.h"
 #include "utils.h"
 #include "url.h"
@@ -73,11 +67,6 @@ extern char *version_string;
 #ifndef errno
 extern int errno;
 #endif
-#ifndef h_errno
-# ifndef __CYGWIN__
-extern int h_errno;
-# endif
-#endif
 \f
 static int cookies_loaded_p;
 
@@ -374,6 +363,15 @@ register_persistent (const char *host, unsigned short port, int fd
   DEBUGP (("Registered fd %d for persistent reuse.\n", fd));
 }
 
+#ifdef HAVE_SSL
+# define SHUTDOWN_SSL(ssl) do {                \
+  if (ssl)                             \
+    shutdown_ssl (ssl);                        \
+} while (0)
+#else
+# define SHUTDOWN_SSL(ssl) 
+#endif
+
 /* Return non-zero if a persistent connection is available for
    connecting to HOST:PORT.  */
 
@@ -429,21 +427,16 @@ persistent_available_p (const char *host, unsigned short port
          let's invalidate the persistent connection before returning
          0.  */
       CLOSE (pc_last_fd);
+#ifdef HAVE_SSL
+      SHUTDOWN_SSL (pc_last_ssl);
+      pc_last_ssl = NULL;
+#endif
       invalidate_persistent ();
       return 0;
     }
   return 1;
 }
 
-#ifdef HAVE_SSL
-# define SHUTDOWN_SSL(ssl) do {                \
-  if (ssl)                             \
-    shutdown_ssl (ssl);                        \
-} while (0)
-#else
-# define SHUTDOWN_SSL(ssl) 
-#endif
-
 /* The idea behind these two CLOSE macros is to distinguish between
    two cases: one when the job we've been doing is finished, and we
    want to close the connection and leave, and two when something is
@@ -752,8 +745,13 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
        }
       else
        {
+         /* Use the full path, i.e. one that includes the leading
+            slash and the query string, but is independent of proxy
+            setting.  */
+         char *pth = url_full_path (u);
          wwwauth = create_authorization_line (authenticate_h, user, passwd,
-                                              command, u->path);
+                                              command, pth);
+         xfree (pth);
        }
     }
 
@@ -808,6 +806,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
   if (proxy)
     full_path = xstrdup (u->url);
   else
+    /* Use the full path, i.e. one that includes the leading slash and
+       the query string.  E.g. if u->path is "foo/bar" and u->query is
+       "param=value", full_path will be "/foo/bar?param=value".  */
     full_path = url_full_path (u);
 
   /* Allocate the memory for the request.  */
@@ -2163,7 +2164,7 @@ dump_hash (unsigned char *buf, const unsigned char *hash)
 
 /* Take the line apart to find the challenge, and compose a digest
    authorization header.  See RFC2069 section 2.1.2.  */
-char *
+static char *
 digest_authentication_encode (const char *au, const char *user,
                              const char *passwd, const char *method,
                              const char *path)