]> sjero.net Git - wget/blobdiff - src/http.c
[svn] Implement better sorting and matching of cookies.
[wget] / src / http.c
index 0345e2be274b4da445e5b8bbe23aabcc09676268..83108bce297f9e7086fb4760295a526339ec7939 100644 (file)
@@ -78,6 +78,7 @@ extern int h_errno;
 # endif
 #endif
 \f
+static int cookies_loaded_p;
 
 #define TEXTHTML_S "text/html"
 #define HTTP_ACCEPT "*/*"
@@ -1374,6 +1375,12 @@ http_loop (struct urlinfo *u, char **newloc, int *dt)
   struct http_stat hstat;      /* HTTP status */
   struct stat st;
 
+  /* This used to be done in main(), but it's a better idea to do it
+     here so that we don't go through the hoops if we're just using
+     FTP or whatever. */
+  if (opt.cookies && opt.cookies_input && !cookies_loaded_p)
+    load_cookies (opt.cookies_input);
+
   *newloc = NULL;
 
   /* Warn on (likely bogus) wildcard usage in HTTP.  Don't use