]> sjero.net Git - wget/blobdiff - src/init.c
[svn] Improvements/fixes to HTTP Content-Disposition header support.
[wget] / src / init.c
index a86006b4071ed6e8e72eb766b441b9afe5ec4334..2e51291a997ed450512a1f4dc1144a810e9ba5f4 100644 (file)
@@ -1,5 +1,5 @@
 /* Reading/parsing the initialization file.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2005 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -14,8 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -51,6 +51,8 @@ so, delete this exception statement from your version.  */
 #include "recur.h"             /* for INFINITE_RECURSION */
 #include "convert.h"           /* for convert_cleanup */
 #include "res.h"               /* for res_cleanup */
+#include "http.h"              /* for http_cleanup */
+#include "retr.h"              /* for output_stream */
 
 /* We want tilde expansion enabled only when reading `.wgetrc' lines;
    otherwise, it will be performed by the shell.  This variable will
@@ -124,6 +126,7 @@ static struct {
   { "connecttimeout",  &opt.connect_timeout,   cmd_time },
   { "continue",                &opt.always_rest,       cmd_boolean },
   { "convertlinks",    &opt.convert_links,     cmd_boolean },
+  { "contentdisposition", &opt.content_disposition, cmd_boolean },
   { "cookies",         &opt.cookies,           cmd_boolean },
   { "cutdirs",         &opt.cut_dirs,          cmd_number },
 #ifdef ENABLE_DEBUG
@@ -161,6 +164,7 @@ static struct {
   { "httpproxy",       &opt.http_proxy,        cmd_string },
   { "httpsproxy",      &opt.https_proxy,       cmd_string },
   { "httpuser",                &opt.http_user,         cmd_string },
+  { "ignorecase",      &opt.ignore_case,       cmd_boolean },
   { "ignorelength",    &opt.ignore_length,     cmd_boolean },
   { "ignoretags",      &opt.ignore_tags,       cmd_vector },
   { "includedirectories", &opt.includes,       cmd_directory_vector },
@@ -170,7 +174,6 @@ static struct {
 #endif
   { "input",           &opt.input_filename,    cmd_file },
   { "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
-  { "killlonger",      &opt.kill_longer,       cmd_boolean },
   { "limitrate",       &opt.limit_rate,        cmd_bytes },
   { "loadcookies",     &opt.cookies_input,     cmd_file },
   { "logfile",         &opt.lfilename,         cmd_file },
@@ -311,6 +314,8 @@ defaults (void)
   opt.restrict_files_os = restrict_windows;
 #endif
   opt.restrict_files_ctrl = true;
+
+  opt.content_disposition = true;
 }
 \f
 /* Return the user's home directory (strdup-ed), or NULL if none is
@@ -560,7 +565,7 @@ parse_line (const char *line, char **com, char **val, int *comind)
   p = line;
 
   cmdstart = p;
-  while (p < end && (ISALPHA (*p) || *p == '_' || *p == '-'))
+  while (p < end && (ISALNUM (*p) || *p == '_' || *p == '-'))
     ++p;
   cmdend = p;
 
@@ -1386,7 +1391,8 @@ check_user_specified_header (const char *s)
 {
   const char *p;
 
-  for (p = s; *p && *p != ':' && !ISSPACE (*p); p++);
+  for (p = s; *p && *p != ':' && !ISSPACE (*p); p++)
+    ;
   /* The header MUST contain `:' preceded by at least one
      non-whitespace character.  */
   if (*p != ':' || p == s)
@@ -1415,7 +1421,6 @@ decode_string (const char *val, const struct decode_item *items, int itemcount,
 
 \f
 void cleanup_html_url (void);
-void http_cleanup (void);
 
 
 /* Free the memory allocated by global variables.  */
@@ -1424,13 +1429,10 @@ cleanup (void)
 {
   /* Free external resources, close files, etc. */
 
-  {
-    extern FILE *output_stream;
-    if (output_stream)
-      fclose (output_stream);
-    /* No need to check for error because Wget flushes its output (and
-       checks for errors) after any data arrives.  */
-  }
+  if (output_stream)
+    fclose (output_stream);
+  /* No need to check for error because Wget flushes its output (and
+     checks for errors) after any data arrives.  */
 
   /* We're exiting anyway so there's no real need to call free()
      hundreds of times.  Skipping the frees will make Wget exit