Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 190015
Collapse All | Expand All

(-)wget-1.10.2/src/http.c (-1 / +15 lines)
Lines 1874-1882 Link Here
1874
	  else
1874
	  else
1875
	    logputs (LOG_VERBOSE, "\n");
1875
	    logputs (LOG_VERBOSE, "\n");
1876
	}
1876
	}
1877
    }
1877
  }
1878
  int is_acceptable_content_type = 1;
1879
  if(type) is_acceptable_content_type = acceptable_content_type(type);
1878
  xfree_null (type);
1880
  xfree_null (type);
1879
  type = NULL;			/* We don't need it any more.  */
1881
  type = NULL;			/* We don't need it any more.  */
1882
  if(!is_acceptable_content_type)
1883
  {
1884
  	CLOSE_FINISH (sock);
1885
  	return CTYPEREJECTED;
1886
  }
1880
1887
1881
  /* Return if we have no intention of further downloading.  */
1888
  /* Return if we have no intention of further downloading.  */
1882
  if (!(*dt & RETROKF) || head_only)
1889
  if (!(*dt & RETROKF) || head_only)
Lines 2241-2246 Link Here
2241
	  free_hstat (&hstat);
2248
	  free_hstat (&hstat);
2242
	  xfree_null (dummy);
2249
	  xfree_null (dummy);
2243
	  return err;
2250
	  return err;
2251
	case CTYPEREJECTED:
2252
		logprintf (LOG_VERBOSE, _("Not downloading `%s', "
2253
			"content type rejected. -- not retrieving.\n"),
2254
			url_string (u, 1));
2255
		free_hstat (&hstat);
2256
		xfree_null (dummy);
2257
		return err;
2244
	case FWRITEERR: case FOPENERR:
2258
	case FWRITEERR: case FOPENERR:
2245
	  /* Another fatal error.  */
2259
	  /* Another fatal error.  */
2246
	  logputs (LOG_VERBOSE, "\n");
2260
	  logputs (LOG_VERBOSE, "\n");
(-)wget-1.10.2/src/init.c (+2 lines)
Lines 132-137 Link Here
132
  { "checkcertificate", &opt.check_cert,	cmd_boolean },
132
  { "checkcertificate", &opt.check_cert,	cmd_boolean },
133
#endif
133
#endif
134
  { "connecttimeout",	&opt.connect_timeout,	cmd_time },
134
  { "connecttimeout",	&opt.connect_timeout,	cmd_time },
135
  { "contentaccepts", &opt.content_accepts, cmd_vector },
136
  { "contentrejects", &opt.content_rejects, cmd_vector },
135
  { "continue",		&opt.always_rest,	cmd_boolean },
137
  { "continue",		&opt.always_rest,	cmd_boolean },
136
  { "convertlinks",	&opt.convert_links,	cmd_boolean },
138
  { "convertlinks",	&opt.convert_links,	cmd_boolean },
137
  { "cookies",		&opt.cookies,		cmd_boolean },
139
  { "cookies",		&opt.cookies,		cmd_boolean },
(-)wget-1.10.2/src/main.c (+9 lines)
Lines 169-174 Link Here
169
    { "connect-timeout", 0, OPT_VALUE, "connecttimeout", -1 },
169
    { "connect-timeout", 0, OPT_VALUE, "connecttimeout", -1 },
170
    { "continue", 'c', OPT_BOOLEAN, "continue", -1 },
170
    { "continue", 'c', OPT_BOOLEAN, "continue", -1 },
171
    { "convert-links", 'k', OPT_BOOLEAN, "convertlinks", -1 },
171
    { "convert-links", 'k', OPT_BOOLEAN, "convertlinks", -1 },
172
    { "content-type", 0, OPT_VALUE, "contentaccepts", -1 },
173
    { "content-type-exclude", 0, OPT_VALUE, "contentrejects", -1 },
172
    { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
174
    { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
173
    { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
175
    { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
174
    { IF_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
176
    { IF_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
Lines 541-546 Link Here
541
       --post-data=STRING      use the POST method; send STRING as the data.\n"),
543
       --post-data=STRING      use the POST method; send STRING as the data.\n"),
542
    N_("\
544
    N_("\
543
       --post-file=FILE        use the POST method; send contents of FILE.\n"),
545
       --post-file=FILE        use the POST method; send contents of FILE.\n"),
546
    N_("\
547
       --content-type=LIST     comma-separated list of accepted content-types.\n"),
548
    N_("\
549
       --content-type-exclude=LIST  comma-separated list of rejected content-types.\n"),
544
    "\n",
550
    "\n",
545
551
546
#ifdef HAVE_SSL
552
#ifdef HAVE_SSL
Lines 942-947 Link Here
942
      else
948
      else
943
	status = retrieve_url (*t, &filename, &redirected_URL, NULL, &dt);
949
	status = retrieve_url (*t, &filename, &redirected_URL, NULL, &dt);
944
950
951
      if(status == CTYPEREJECTED)
952
	  	logprintf (LOG_VERBOSE, _("Not downloading, content type rejected.\n"));
953
945
      if (opt.delete_after && file_exists_p(filename))
954
      if (opt.delete_after && file_exists_p(filename))
946
	{
955
	{
947
	  DEBUGP (("Removing file due to --delete-after in main():\n"));
956
	  DEBUGP (("Removing file due to --delete-after in main():\n"));
(-)wget-1.10.2/src/options.h (+3 lines)
Lines 57-62 Link Here
57
57
58
  int spider;			/* Is Wget in spider mode? */
58
  int spider;			/* Is Wget in spider mode? */
59
59
60
  char **content_accepts;		/* List of content-type patterns to accept. */
61
  char **content_rejects;		/* List of content-type patterns to reject. */
62
60
  char **accepts;		/* List of patterns to accept. */
63
  char **accepts;		/* List of patterns to accept. */
61
  char **rejects;		/* List of patterns to reject. */
64
  char **rejects;		/* List of patterns to reject. */
62
  char **excludes;		/* List of excluded FTP directories. */
65
  char **excludes;		/* List of excluded FTP directories. */
(-)wget-1.10.2/src/recur.c (+3 lines)
Lines 317-322 Link Here
317
	    }
317
	    }
318
	}
318
	}
319
319
320
	if(status == CTYPEREJECTED)
321
		logprintf (LOG_VERBOSE, _("Not downloading, content type rejected.\n"));
322
320
      /* If the downloaded document was HTML, parse it and enqueue the
323
      /* If the downloaded document was HTML, parse it and enqueue the
321
	 links it contains. */
324
	 links it contains. */
322
325
(-)wget-1.10.2/src/utils.c (+18 lines)
Lines 668-673 Link Here
668
  return 1;
668
  return 1;
669
}
669
}
670
670
671
/* Determine whether a content type is acceptable to be downloaded, according to
672
 * commandline options. */
673
int
674
acceptable_content_type (const char *type)
675
{
676
   if (opt.content_accepts)
677
     {
678
       if (opt.content_rejects)
679
   return (in_acclist ((const char *const *)opt.content_accepts, type, 1)
680
       && !in_acclist ((const char *const *)opt.content_rejects, type, 1));
681
       else
682
   return in_acclist ((const char *const *)opt.content_accepts, type, 1);
683
     }
684
   else if (opt.content_rejects)
685
     return !in_acclist ((const char *const *)opt.content_rejects, type, 1);
686
   return 1;
687
}
688
671
/* Compare S1 and S2 frontally; S2 must begin with S1.  E.g. if S1 is
689
/* Compare S1 and S2 frontally; S2 must begin with S1.  E.g. if S1 is
672
   `/something', frontcmp() will return 1 only if S2 begins with
690
   `/something', frontcmp() will return 1 only if S2 begins with
673
   `/something'.  Otherwise, 0 is returned.  */
691
   `/something'.  Otherwise, 0 is returned.  */
(-)wget-1.10.2/src/utils.h (+1 lines)
Lines 79-84 Link Here
79
char *file_merge PARAMS ((const char *, const char *));
79
char *file_merge PARAMS ((const char *, const char *));
80
80
81
int acceptable PARAMS ((const char *));
81
int acceptable PARAMS ((const char *));
82
int acceptable_content_type (const char *);
82
int accdir PARAMS ((const char *s, enum accd));
83
int accdir PARAMS ((const char *s, enum accd));
83
char *suffix PARAMS ((const char *s));
84
char *suffix PARAMS ((const char *s));
84
int match_tail PARAMS ((const char *, const char *, int));
85
int match_tail PARAMS ((const char *, const char *, int));
(-)wget-1.10.2/src/wget.h (-1 / +1 lines)
Lines 294-300 Link Here
294
  CONTNOTSUPPORTED, RETRUNNEEDED, RETRFINISHED, READERR, TRYLIMEXC,
294
  CONTNOTSUPPORTED, RETRUNNEEDED, RETRFINISHED, READERR, TRYLIMEXC,
295
  URLBADPATTERN, FILEBADFILE, RANGEERR, RETRBADPATTERN,
295
  URLBADPATTERN, FILEBADFILE, RANGEERR, RETRBADPATTERN,
296
  RETNOTSUP, ROBOTSOK, NOROBOTS, PROXERR, AUTHFAILED,
296
  RETNOTSUP, ROBOTSOK, NOROBOTS, PROXERR, AUTHFAILED,
297
  QUOTEXC, WRITEFAILED, SSLINITFAILED
297
  QUOTEXC, WRITEFAILED, SSLINITFAILED, CTYPEREJECTED
298
} uerr_t;
298
} uerr_t;
299
299
300
#endif /* WGET_H */
300
#endif /* WGET_H */

Return to bug 190015