mirror of
https://github.com/mirror/wget.git
synced 2025-03-14 20:00:15 +08:00
Transfer struct range to wget.h. Make metalink code optional.
This commit is contained in:
parent
198acf4844
commit
47bd180ab0
15
configure.ac
15
configure.ac
@ -89,7 +89,7 @@ test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE([ENABLE_DEBUG], 1,
|
||||
|
||||
AC_ARG_ENABLE(threads,
|
||||
[ --disable-threads disable support for parallel downloads using threads],
|
||||
ENABLE_THREADS=$enableval, ENABLE_THREADS=no)
|
||||
ENABLE_THREADS=$enableval, ENABLE_THREADS=auto)
|
||||
test x"${ENABLE_THREADS}" = xyes && AC_DEFINE([ENABLE_THREADS], 1,
|
||||
[Define if you want the concurrent download support compiled in.])
|
||||
|
||||
@ -356,10 +356,17 @@ AS_IF([test x"$ENABLE_METALINK" != xno],[
|
||||
dnl If metalink module is found
|
||||
LIBS="$LIBMETALINK_LIBS $LIBS"
|
||||
CFLAGS="$LIBMETALINK_CFLAGS $CFLAGS"
|
||||
AC_DEFINE([ENABLE_METALINK], 1,
|
||||
[Define if you want the metalink support compiled in.])
|
||||
|
||||
AC_CHECK_LIB(metalink, metalink_parse_file, [
|
||||
metalink=yes
|
||||
AC_MSG_NOTICE([compiling in support for metalink])
|
||||
if test x"$DISABLE_THREADS" == xyes
|
||||
then
|
||||
AC_MSG_ERROR([Metalink support depends on threads, which are requested to be disabled.])
|
||||
else
|
||||
metalink=yes
|
||||
AC_MSG_NOTICE([compiling in support for metalink])
|
||||
fi
|
||||
], [
|
||||
if test x"$ENABLE_METALINK" == xyes
|
||||
then
|
||||
@ -375,8 +382,8 @@ AS_IF([test x"$ENABLE_METALINK" != xno],[
|
||||
])
|
||||
],[
|
||||
dnl If metalink support is not requested
|
||||
AC_MSG_NOTICE([compiling without support for metalink])
|
||||
metalink=no
|
||||
AC_MSG_NOTICE([compiling without support for metalink])
|
||||
])
|
||||
|
||||
|
||||
|
@ -2713,12 +2713,14 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
|
||||
char *file_name;
|
||||
bool force_full_retrieve = false;
|
||||
|
||||
#ifndef ENABLE_METALINK
|
||||
/* Assert that no value for *LOCAL_FILE was passed. */
|
||||
/* assert (local_file == NULL || *local_file == NULL);*/
|
||||
assert (local_file == NULL || *local_file == NULL);
|
||||
|
||||
/* Set LOCAL_FILE parameter. */
|
||||
/* if (local_file && opt.output_document)
|
||||
*local_file = HYPHENP (opt.output_document) ? NULL : xstrdup (opt.output_document); */
|
||||
if (local_file && opt.output_document)
|
||||
*local_file = HYPHENP (opt.output_document) ? NULL : xstrdup (opt.output_document);
|
||||
#endif
|
||||
|
||||
/* Reset NEWLOC parameter. */
|
||||
*newloc = NULL;
|
||||
|
@ -23,10 +23,7 @@ spawn_thread (struct s_thread_ctx *thread_ctx, char * name, int index, int resou
|
||||
return 1;
|
||||
|
||||
/* TODO: Update this when configuring fallbacking code so that downloading
|
||||
goes on from where the previous resource failed.
|
||||
TODO: size of the bytes allocated by malloc should be recalculated and
|
||||
the string assignment to that space should be readjusted to contain only
|
||||
the files created by wget.(ONLY the files[] elements) */
|
||||
goes on from where the previous resource failed. */
|
||||
if(file_exists_p(thread_ctx[index].file))
|
||||
{
|
||||
command = malloc(sizeof("rm -f ") + sizeof(TEMP_PREFIX) + strlen(name)
|
||||
|
12
src/multi.h
12
src/multi.h
@ -33,9 +33,10 @@ as that of the covered work. */
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
#include "wget.h"
|
||||
|
||||
#include "iri.h"
|
||||
#include "url.h"
|
||||
#include "wget.h"
|
||||
|
||||
#define TEMP_PREFIX "temp_"
|
||||
|
||||
@ -44,15 +45,6 @@ as that of the covered work. */
|
||||
|
||||
#define MIN_CHUNK_SIZE 2048
|
||||
|
||||
struct range {
|
||||
int first_byte;
|
||||
int last_byte;
|
||||
int is_covered;
|
||||
int is_assigned;
|
||||
bool *resources;
|
||||
uerr_t status_least_severe;
|
||||
};
|
||||
|
||||
struct s_thread_ctx
|
||||
{
|
||||
int used;
|
||||
|
27
src/retr.c
27
src/retr.c
@ -37,11 +37,14 @@ as that of the covered work. */
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <metalink/metalink_parser.h>
|
||||
#include <metalink/metalink_types.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#ifdef ENABLE_METALINK
|
||||
#include <metalink/metalink_parser.h>
|
||||
#include <metalink/metalink_types.h>
|
||||
|
||||
#include "metalink.h"
|
||||
#endif
|
||||
#include "exits.h"
|
||||
#include "utils.h"
|
||||
#include "retr.h"
|
||||
@ -694,13 +697,14 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file,
|
||||
url = xstrdup (origurl);
|
||||
if (newloc)
|
||||
*newloc = NULL;
|
||||
/*
|
||||
* GSoC wget - taken into comments to ensure parameter file can be used to
|
||||
* transfer filenames to help assigning the file name.
|
||||
*
|
||||
*if (file)
|
||||
* *file = NULL;
|
||||
*/
|
||||
|
||||
#ifndef ENABLE_METALINK
|
||||
/* Note that, each and every call to retrieve_url(), except the ones made by
|
||||
functions relevant to metalink support, the value of *file is NULL. */
|
||||
if (file)
|
||||
*file = NULL;
|
||||
#endif
|
||||
|
||||
if (!refurl)
|
||||
refurl = opt.referer;
|
||||
|
||||
@ -1003,6 +1007,7 @@ retrieve_from_file (const char *file, bool html, int *count)
|
||||
else
|
||||
input_file = (char *) file;
|
||||
|
||||
#ifdef ENABLE_METALINK
|
||||
if(metalink = metalink_context(input_file))
|
||||
{
|
||||
/*GSoC wget*/
|
||||
@ -1203,7 +1208,7 @@ retrieve_from_file (const char *file, bool html, int *count)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#endif
|
||||
url_list = (html ? get_urls_html (input_file, NULL, NULL, iri)
|
||||
: get_urls_file (input_file));
|
||||
|
||||
@ -1267,7 +1272,9 @@ Removing file due to --delete-after in retrieve_from_file():\n"));
|
||||
|
||||
/* Free the linked list of URL-s. */
|
||||
free_urlpos (url_list);
|
||||
#ifdef ENABLE_METALINK
|
||||
}
|
||||
#endif
|
||||
|
||||
iri_free (iri);
|
||||
|
||||
|
@ -356,6 +356,15 @@ typedef enum
|
||||
UNLINKERR, NEWLOCATION_KEEP_POST
|
||||
} uerr_t;
|
||||
|
||||
struct range {
|
||||
int first_byte;
|
||||
int last_byte;
|
||||
int is_covered;
|
||||
int is_assigned;
|
||||
bool *resources;
|
||||
uerr_t status_least_severe;
|
||||
};
|
||||
|
||||
/* 2005-02-19 SMS.
|
||||
Select an appropriate "orig" suffix and a separator character for
|
||||
adding a unique suffix to a file name.
|
||||
|
Loading…
Reference in New Issue
Block a user