#include "retr.h"
#include "recur.h"
#include "host.h"
+#include "cookies.h"
#ifndef PATH_SEPARATOR
# define PATH_SEPARATOR '/'
/* It's kosher to declare these here because their interface _has_ to
be void foo(void). */
-void url_init PARAMS ((void));
void host_init PARAMS ((void));
/* This just calls the various initialization functions from the
static void
private_initialize (void)
{
- url_init ();
host_init ();
}
\f
--referer=URL include `Referer: URL\' header in HTTP request.\n\
-s, --save-headers save the HTTP headers to file.\n\
-U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.\n\
+ --no-http-keep-alive disable HTTP keep-alive (persistent connections).\n\
+ --cookies=off don't use cookies.\n\
+ --load-cookies=FILE load cookies from FILE before session.\n\
+ --save-cookies=FILE save cookies to FILE after session.\n\
\n"), stdout);
fputs (_("\
FTP options:\n\
{
/* Options without arguments: */
{ "background", no_argument, NULL, 'b' },
+ { "backup-converted", no_argument, NULL, 'K' },
{ "continue", no_argument, NULL, 'c' },
{ "convert-links", no_argument, NULL, 'k' },
- { "backup-converted", no_argument, NULL, 'K' },
{ "debug", no_argument, NULL, 'd' },
{ "delete-after", no_argument, NULL, 136 },
{ "dont-remove-listing", no_argument, NULL, 149 },
- { "email-address", no_argument, NULL, 154 }, /* undocumented (debug) */
{ "follow-ftp", no_argument, NULL, 142 },
{ "force-directories", no_argument, NULL, 'x' },
{ "force-hier", no_argument, NULL, 'x' }, /* obsolete */
{ "base", required_argument, NULL, 'B' },
{ "bind-address", required_argument, NULL, 155 },
{ "cache", required_argument, NULL, 'C' },
+ { "cookies", required_argument, NULL, 160 },
{ "cut-dirs", required_argument, NULL, 145 },
{ "directory-prefix", required_argument, NULL, 'P' },
{ "domains", required_argument, NULL, 'D' },
{ "include-directories", required_argument, NULL, 'I' },
{ "input-file", required_argument, NULL, 'i' },
{ "level", required_argument, NULL, 'l' },
+ { "load-cookies", required_argument, NULL, 161 },
{ "no", required_argument, NULL, 'n' },
{ "output-document", required_argument, NULL, 'O' },
{ "output-file", required_argument, NULL, 'o' },
{ "proxy-user", required_argument, NULL, 143 },
{ "quota", required_argument, NULL, 'Q' },
{ "reject", required_argument, NULL, 'R' },
+ { "save-cookies", required_argument, NULL, 162 },
{ "timeout", required_argument, NULL, 'T' },
{ "tries", required_argument, NULL, 't' },
{ "user-agent", required_argument, NULL, 'U' },
that the options with required arguments must be followed by a ':'.
-- Dan Harkless <wget@harkless.org>] */
while ((c = getopt_long (argc, argv, "\
-hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:",
+hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:C:",
long_options, (int *)0)) != EOF)
{
switch (c)
case 150:
setval ("simplehostcheck", "on");
break;
- case 154:
- /* For debugging purposes. */
- printf ("%s\n", ftp_getaddress ());
- exit (0);
- break;
case 155:
setval ("bindaddress", optarg);
break;
case 153:
setval ("followtags", optarg);
break;
+ case 160:
+ setval ("cookies", optarg);
+ break;
+ case 161:
+ setval ("loadcookies", optarg);
+ break;
+ case 162:
+ setval ("savecookies", optarg);
+ break;
case 157:
setval ("referer", optarg);
break;
DEBUGP (("DEBUG output created by Wget %s on %s.\n\n", version_string,
OS_TYPE));
+
/* Open the output filename if necessary. */
if (opt.output_document)
{
else
{
struct stat st;
- opt.dfp = fopen (opt.output_document, "wb");
+ opt.dfp = fopen (opt.output_document, opt.always_rest ? "ab" : "wb");
if (opt.dfp == NULL)
{
perror (opt.output_document);
_("Download quota (%s bytes) EXCEEDED!\n"),
legible (opt.quota));
}
+
+ if (opt.cookies_output)
+ save_cookies (opt.cookies_output);
+
if (opt.convert_links && !opt.delete_after)
{
convert_all_links ();