summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in11
-rw-r--r--src/htsback.c26
-rw-r--r--src/htscache.c137
-rw-r--r--src/htscore.c4
-rw-r--r--src/htscoremain.c44
-rw-r--r--src/htsglobal.h4
-rw-r--r--src/htslib.c3
-rw-r--r--src/htslib.h10
-rw-r--r--src/htsmodules.c18
-rw-r--r--src/htsname.c4
-rw-r--r--src/htszlib.c34
-rw-r--r--src/htszlib.h1
-rwxr-xr-xsrc/webhttrack2
13 files changed, 206 insertions, 92 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index b22b2fb..1351f2f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -69,6 +69,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
+GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -102,12 +103,9 @@ THREADS_LIBS = @THREADS_LIBS@
V6_FLAG = @V6_FLAG@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -122,22 +120,29 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
+htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
+localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
diff --git a/src/htsback.c b/src/htsback.c
index 2f06b09..91245a7 100644
--- a/src/htsback.c
+++ b/src/htsback.c
@@ -3649,19 +3649,27 @@ int back_checksize(httrackp* opt,lien_back* eback,int check_only_totalsize) {
}
int back_checkmirror(httrackp* opt) {
- // Check max time
+ // Check max size
if ((opt->maxsite>0) && (HTS_STAT.stat_bytes >= opt->maxsite)) {
- if (opt->log) {
- fprintf(opt->log,"More than "LLintP" bytes have been transfered.. giving up"LF,(LLint)opt->maxsite);
- test_flush;
- }
- return 0;
- } else if ((opt->maxtime>0) && ((time_local()-HTS_STAT.stat_timestart)>opt->maxtime)) {
+ if (!opt->state.stop) { /* not yet stopped */
+ if (opt->log) {
+ fprintf(opt->log,"More than "LLintP" bytes have been transfered.. giving up"LF,(LLint)opt->maxsite);
+ test_flush;
+ }
+ /* cancel mirror smoothly */
+ hts_request_stop(opt, 0);
+ }
+ return 1; /* don'k break mirror too sharply for size limits, but stop requested */
+ /*return 0;
+ */
+ }
+ // Check max time
+ if ((opt->maxtime>0) && ((time_local()-HTS_STAT.stat_timestart)>opt->maxtime)) {
if (opt->log) {
fprintf(opt->log,"More than %d seconds passed.. giving up"LF,opt->maxtime);
test_flush;
- }
- return 0;
+ }
+ return 0; /* stop now */
}
return 1; /* Ok, go on */
}
diff --git a/src/htscache.c b/src/htscache.c
index 98ba328..068da05 100644
--- a/src/htscache.c
+++ b/src/htscache.c
@@ -1166,6 +1166,13 @@ int cache_readdata(cache_back* cache,const char* str1,const char* str2,char** in
return 0;
}
+static int hts_rename(httrackp* opt, const char *a, const char *b) {
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: rename %s -> %s (%p %p)"LF, a, b, a, b);
+ }
+ return rename(a, b);
+}
+
// renvoyer uniquement en tête, ou NULL si erreur
// return NULL upon error, and set -1 to r.statuscode
htsblk* cache_header(httrackp* opt,cache_back* cache,const char* adr,const char* fil,htsblk* r) {
@@ -1181,6 +1188,9 @@ htsblk* cache_header(httrackp* opt,cache_back* cache,const char* adr,const char*
void cache_init(cache_back* cache,httrackp* opt) {
// ---
// utilisation du cache: renommer ancien éventuel et charger index
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: enabled=%d, base=%s, ro=%d"LF, (int) opt->cache, fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/"), (int) cache->ro);
+ }
if (opt->cache) {
#if DEBUGCA
printf("cache init: ");
@@ -1207,11 +1217,26 @@ void cache_init(cache_back* cache,httrackp* opt) {
}
/* Remove OLD cache */
- if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip")))
- remove(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip"));
+ if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip"))) {
+ if (remove(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip")) != 0) {
+ int last_errno = errno;
+ if (opt->log!=NULL) {
+ HTS_LOG(opt,LOG_WARNING); fprintf(opt->log,"Cache: error while moving previous cache: %s"LF, strerror(last_errno));
+ }
+ }
+ }
/* Rename */
- rename(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.zip"),fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip"));
+ if (hts_rename(opt, fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.zip"), fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip")) != 0) {
+ int last_errno = errno;
+ if (opt->log!=NULL) {
+ HTS_LOG(opt,LOG_WARNING); fprintf(opt->log,"Cache: error while moving previous cache: %s"LF, strerror(last_errno));
+ }
+ } else {
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: successfully renamed"LF);
+ }
+ }
}
else if ((fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.dat"))) && (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.ndx")))) { // il existe déja un cache précédent.. renommer
#if DEBUGCA
@@ -1233,8 +1258,15 @@ void cache_init(cache_back* cache,httrackp* opt) {
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.ndx")))
remove(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.ndx"));
}
+ } else {
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: no cache found"LF);
+ }
}
-
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: size %d"LF, (int)fsize(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip")));
+ }
+
// charger index cache précédent
if (
(
@@ -1256,23 +1288,23 @@ void cache_init(cache_back* cache,httrackp* opt) {
// Corrupted ZIP file ? Try to repair!
if (cache->zipInput == NULL && !cache->ro) {
- char* name;
- uLong repaired = 0;
- uLong repairedBytes = 0;
- if (!cache->ro) {
- name = fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip");
- } else {
- name = fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.zip");
- }
- if (opt->log) {
- HTS_LOG(opt,LOG_WARNING); fprintf(opt->log,"Cache: damaged cache, trying to repair"LF);
- fflush(opt->log);
- }
- if (unzRepair(name,
- fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/repair.zip"),
- fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/repair.tmp"),
- &repaired, &repairedBytes
- ) == Z_OK) {
+ char* name;
+ uLong repaired = 0;
+ uLong repairedBytes = 0;
+ if (!cache->ro) {
+ name = fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.zip");
+ } else {
+ name = fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.zip");
+ }
+ if (opt->log) {
+ HTS_LOG(opt,LOG_WARNING); fprintf(opt->log,"Cache: damaged cache, trying to repair"LF);
+ fflush(opt->log);
+ }
+ if (unzRepair(name,
+ fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/repair.zip"),
+ fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/repair.tmp"),
+ &repaired, &repairedBytes
+ ) == Z_OK) {
unlink(name);
rename(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/repair.zip"), name);
cache->zipInput = unzOpen(name);
@@ -1291,9 +1323,10 @@ void cache_init(cache_back* cache,httrackp* opt) {
// Opened ?
if (cache->zipInput!=NULL) {
-
+ int zErr;
+
/* Ready directory entries */
- if (unzGoToFirstFile((unzFile) cache->zipInput) == Z_OK) {
+ if ( ( zErr = unzGoToFirstFile((unzFile) cache->zipInput) ) == Z_OK) {
char comment[128];
char BIGSTK filename[HTS_URLMAXSIZE * 4];
int entries = 0;
@@ -1362,8 +1395,12 @@ void cache_init(cache_back* cache,httrackp* opt) {
}
opt->is_update=1; // signaler comme update
+ } else {
+ HTS_LOG(opt,LOG_WARNING); fprintf(opt->log,"Cache: error trying to read the cache: %s"LF, hts_get_zerror(zErr));
}
+ } else {
+ HTS_LOG(opt,LOG_WARNING); fprintf(opt->log,"Cache: error trying to open the cache"LF);
}
} else if (
@@ -1477,15 +1514,19 @@ void cache_init(cache_back* cache,httrackp* opt) {
#endif
}
}
- } // taille cache>0
-
+ } else {
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: no cache found in %s"LF, fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/"));
+ }
+ }
+
#if DEBUGCA
printf("..create cache\n");
#endif
if (!cache->ro) {
// ouvrir caches actuels
structcheck(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/"));
-
+
if (1) {
/* Create ZIP file cache */
cache->zipOutput = (void*) zipOpen(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.zip"), 0);
@@ -1497,16 +1538,16 @@ void cache_init(cache_back* cache,httrackp* opt) {
// renommer
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.lst")))
rename(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.lst"),fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.lst"));
- // ouvrir
- cache->lst=fopen(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.lst"),"wb");
- strcpybuff(opt->state.strc.path, StringBuff(opt->path_html));
- opt->state.strc.lst = cache->lst;
- //{
- //filecreate_params tmp;
- //strcpybuff(tmp.path,StringBuff(opt->path_html)); // chemin
- //tmp.lst=cache->lst; // fichier lst
- //filenote("",&tmp); // initialiser filecreate
- //}
+ // ouvrir
+ cache->lst=fopen(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.lst"),"wb");
+ strcpybuff(opt->state.strc.path, StringBuff(opt->path_html));
+ opt->state.strc.lst = cache->lst;
+ //{
+ //filecreate_params tmp;
+ //strcpybuff(tmp.path,StringBuff(opt->path_html)); // chemin
+ //tmp.lst=cache->lst; // fichier lst
+ //filenote("",&tmp); // initialiser filecreate
+ //}
// supprimer old.txt
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.txt")))
@@ -1533,10 +1574,10 @@ void cache_init(cache_back* cache,httrackp* opt) {
fclose(cache->dat);
cache->dat=NULL;
}
-
+
if (cache->ndx!=NULL) {
char s[256];
-
+
cache_wstr(cache->dat,"CACHE-1.5");
fflush(cache->dat);
cache_wstr(cache->ndx,"CACHE-1.5");
@@ -1545,7 +1586,7 @@ void cache_init(cache_back* cache,httrackp* opt) {
time_gmt_rfc822(s); // date et heure actuelle GMT pour If-Modified-Since..
cache_wstr(cache->ndx,s);
fflush(cache->ndx); // un petit fflush au cas où
-
+
// supprimer old.lst
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.lst")))
remove(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.lst"));
@@ -1554,15 +1595,15 @@ void cache_init(cache_back* cache,httrackp* opt) {
rename(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.lst"),fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.lst"));
// ouvrir
cache->lst=fopen(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/new.lst"),"wb");
- strcpybuff(opt->state.strc.path, StringBuff(opt->path_html));
- opt->state.strc.lst = cache->lst;
+ strcpybuff(opt->state.strc.path, StringBuff(opt->path_html));
+ opt->state.strc.lst = cache->lst;
//{
// filecreate_params tmp;
// strcpybuff(tmp.path,StringBuff(opt->path_html)); // chemin
// tmp.lst=cache->lst; // fichier lst
// filenote("",&tmp); // initialiser filecreate
//}
-
+
// supprimer old.txt
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.txt")))
remove(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-cache/old.txt"));
@@ -1575,16 +1616,20 @@ void cache_init(cache_back* cache,httrackp* opt) {
fprintf(cache->txt,"date\tsize'/'remotesize\tflags(request:Update,Range state:File response:Modified,Chunked,gZipped)\t");
fprintf(cache->txt,"statuscode\tstatus ('servermsg')\tMIME\tEtag|Date\tURL\tlocalfile\t(from URL)"LF);
}
-
+
// test
// cache_writedata(cache->ndx,cache->dat,"//[TEST]//","test1","TEST PIPO",9);
- }
- }
-
+ } // cache->ndx!=NULL
+ } //cache->zipOutput != NULL
+
} else {
cache->lst = cache->dat = cache->ndx = NULL;
}
+ } else {
+ if ((opt->debug>0) && (opt->log!=NULL)) {
+ HTS_LOG(opt,LOG_DEBUG); fprintf(opt->log,"Cache: no cache enabled"LF);
+ }
}
}
diff --git a/src/htscore.c b/src/htscore.c
index 370f529..41c27a0 100644
--- a/src/htscore.c
+++ b/src/htscore.c
@@ -167,7 +167,7 @@ RUN_CALLBACK0(opt, end); \
cache.zipInput = NULL; \
} \
if (cache.olddat) { fclose(cache.olddat); cache.olddat=NULL; } \
- if (cache.lst) { fclose(cache.lst); cache.lst=NULL; } \
+ if (cache.lst) { fclose(cache.lst); cache.lst=opt->state.strc.lst=NULL; } \
if (cache.txt) { fclose(cache.txt); cache.txt=NULL; } \
if (opt->log) fflush(opt->log); \
if (opt->log) fflush(opt->log);\
@@ -1901,7 +1901,7 @@ jump_if_done:
// purger!
if (cache.lst) {
- fclose(cache.lst); cache.lst=NULL;
+ fclose(cache.lst); cache.lst=opt->state.strc.lst=NULL;
if (opt->delete_old) {
FILE *old_lst,*new_lst;
//
diff --git a/src/htscoremain.c b/src/htscoremain.c
index 4231ee0..a118c5f 100644
--- a/src/htscoremain.c
+++ b/src/htscoremain.c
@@ -231,6 +231,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp *opt) {
/* Vérifier argv[] non vide */
if (strnotempty(argv[na])) {
+ assertf(strlen(argv[na]) < HTS_CDLMAXSIZE);
/* Vérifier Commande (alias) */
result=optalias_check(argc,(const char * const *)argv,na,
@@ -1242,23 +1243,32 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp *opt) {
htsmain_free();
return -1;
} else {
- char callbackname[128];
- char* a = argv[na + 1];
- char* pos; /* = strchr(a, '='); */
- for(pos = a ; *pos != '\0' && *pos != '=' && *pos != ',' && *pos != ':' ; pos++);
+ char* pos;
+ na++;
+ for(pos = argv[na] ; *pos != '\0' && *pos != '=' && *pos != ',' && *pos != ':' ; pos++);
/* httrack --wrapper callback[,foo] */
if (*pos == 0 || *pos == ',' || *pos == ':') {
- int ret = plug_wrapper(opt, argv[na + 1], argv[na + 1]);
+ int ret;
+ char *moduleName;
+ if (*pos == ',' || *pos == ':') {
+ *pos = '\0';
+ moduleName = strdupt(argv[na]);
+ *pos = ','; /* foce seperator to ',' */
+ } else {
+ moduleName = strdupt(argv[na]);
+ }
+ ret = plug_wrapper(opt, moduleName, argv[na]);
+ freet(moduleName);
if (ret == 0) {
char BIGSTK tmp[1024 * 2];
- sprintf(tmp, "option %%W : unable to plug the module %s (returncode != 1)", a);
+ sprintf(tmp, "option %%W : unable to plug the module %s (returncode != 1)", argv[na]);
HTS_PANIC_PRINTF(tmp);
htsmain_free();
return -1;
} else if (ret == -1) {
char BIGSTK tmp[1024 * 2];
int last_errno = errno;
- sprintf(tmp, "option %%W : unable to load the module %s: %s (check the library path ?)", a, strerror(last_errno));
+ sprintf(tmp, "option %%W : unable to load the module %s: %s (check the library path ?)", argv[na], strerror(last_errno));
HTS_PANIC_PRINTF(tmp);
htsmain_free();
return -1;
@@ -1266,9 +1276,9 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp *opt) {
}
/* Old style */
/* httrack --wrapper save-name=callback:process,string */
- else if (*pos == '=' && (pos - a) > 0 && (pos - a + 2) < sizeof(callbackname)) {
+ else if (*pos == '=') {
fprintf(stderr, "Syntax error in option %%W : the old (<3.41) API is no more supported!\n");
- HTS_PANIC_PRINTF("Syntax error in option %W : this function needs to be followed by a blank space, and a module name");
+ HTS_PANIC_PRINTF("Syntax error in option %W : the old (<3.41) API is no more supported!");
printf("Example: -%%W check-link=checklink.so:check\n");
htsmain_free();
return -1;
@@ -1776,11 +1786,17 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp *opt) {
} else { // URL/filters
char catbuff[CATBUFF_SIZE];
- char BIGSTK tempo[1024];
- if (strnotempty(url)) strcatbuff(url," "); // espace de séparation
- strcpybuff(tempo,unescape_http_unharm(catbuff,argv[na],1));
- escape_spc_url(tempo);
- strcatbuff(url,tempo);
+ char BIGSTK tempo[CATBUFF_SIZE];
+ const int urlSize = (int) strlen(argv[na]);
+ const int capa = (int) ( strlen(url) + urlSize + 32 );
+ assertf(urlSize < HTS_URLMAXSIZE);
+ if (urlSize < HTS_URLMAXSIZE) {
+ ensureUrlCapacity(url, url_sz, capa);
+ if (strnotempty(url)) strcatbuff(url," "); // espace de séparation
+ strcpybuff(tempo,unescape_http_unharm(catbuff,argv[na],1));
+ escape_spc_url(tempo);
+ strcatbuff(url,tempo);
+ }
} // if argv=- etc.
} // for
diff --git a/src/htsglobal.h b/src/htsglobal.h
index dc39198..5337659 100644
--- a/src/htsglobal.h
+++ b/src/htsglobal.h
@@ -40,8 +40,8 @@ Please visit our Website: http://www.httrack.com
#define HTTRACK_GLOBAL_DEFH
// Version
-#define HTTRACK_VERSION "3.41"
-#define HTTRACK_VERSIONID "3.41.20"
+#define HTTRACK_VERSION "3.42-3"
+#define HTTRACK_VERSIONID "3.42.3"
#define HTTRACK_AFF_VERSION "3.x"
#define HTTRACK_LIB_VERSION "2.0"
diff --git a/src/htslib.c b/src/htslib.c
index c398e3f..aba65fb 100644
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -522,6 +522,7 @@ const char* hts_mime[][2] = {
{ "video/x-ms-asf", "asf" },
{ "video/x-ms-asf", "asr" },
{ "video/x-ms-asf", "asx" },
+ { "video/x-ms-wmv", "wmv" },
{ "x-world/x-vrml", "flr" },
{ "x-world/x-vrml", "vrml" },
{ "x-world/x-vrml", "wrz" },
@@ -3853,8 +3854,6 @@ HTSEXT_API void escape_for_html_print_full(char* s, char* d) {
*d = '\0';
}
-
-
// concat, concatène deux chaines et renvoi le résultat
// permet d'alléger grandement le code
// il faut savoir qu'on ne peut mettre plus de 16 concat() dans une expression
diff --git a/src/htslib.h b/src/htslib.h
index 1061aee..ae5fde7 100644
--- a/src/htslib.h
+++ b/src/htslib.h
@@ -77,10 +77,18 @@ typedef struct t_dnscache t_dnscache;
#define READ_INTERNAL_ERROR (-4)
/* concat */
-HTS_STATIC char* getHtsOptBuff_(httrackp *opt) {
+
+#if ( defined(_WIN32) && defined(_MSC_VER) && ( _MSC_VER >= 1300 ) && (_MSC_VER <= 1310 ) )
+/* NOTE: VC2003 inlining bug in optim mode not respecting function call sequence point */
+#define MSVC2003INLINEBUG __declspec(noinline)
+#else
+#define MSVC2003INLINEBUG
+#endif
+MSVC2003INLINEBUG static char* getHtsOptBuff_(httrackp *opt) {
opt->state.concat.index = ( opt->state.concat.index + 1 ) % 16;
return opt->state.concat.buff[opt->state.concat.index];
}
+#undef MSVC2003INLINEBUG
#define OPT_GET_BUFF(OPT) ( getHtsOptBuff_(OPT) )
// structure pour paramètres supplémentaires lors de la requête
diff --git a/src/htsmodules.c b/src/htsmodules.c
index 1049d36..8f7facc 100644
--- a/src/htsmodules.c
+++ b/src/htsmodules.c
@@ -262,8 +262,14 @@ void htspe_init(void) {
#ifdef _WIN32
handle = LoadLibraryA((char*)"ssleay32");
#else
- /* We are compatible with 0.9.6/7/8 and potentially above */
- handle = dlopen("libssl.so.0.9.8", RTLD_LAZY);
+ /* We are compatible with 0.9.6/7/8/8b and potentially above */
+ handle = dlopen("libssl.so.0.9.8g", RTLD_LAZY); /* added 8g release too (Debarshi Ray) */
+ if (handle == NULL) {
+ handle = dlopen("libssl.so.0.9.8b", RTLD_LAZY);
+ }
+ if (handle == NULL) {
+ handle = dlopen("libssl.so.0.9.8", RTLD_LAZY);
+ }
if (handle == NULL) {
handle = dlopen("libssl.so.0.9.7", RTLD_LAZY);
}
@@ -271,12 +277,12 @@ void htspe_init(void) {
handle = dlopen("libssl.so.0.9.6", RTLD_LAZY);
}
if (handle == NULL) {
- /* Try harder */
- handle = dlopen("libssl.so", RTLD_LAZY);
+ /* Try harder with .0 if any */
+ handle = dlopen("libssl.so.0", RTLD_LAZY);
}
if (handle == NULL) {
- /* Try harder */
- handle = dlopen("libssl.so.0", RTLD_LAZY);
+ /* Try harder with devel link */
+ handle = dlopen("libssl.so", RTLD_LAZY);
}
#endif
ssl_handle = handle;
diff --git a/src/htsname.c b/src/htsname.c
index c0f74d8..1a48f9f 100644
--- a/src/htsname.c
+++ b/src/htsname.c
@@ -395,7 +395,9 @@ int url_savename(char* adr_complete, char* fil_complete, char* save,
mime_from_file[0] = 0;
get_httptype(opt, mime_from_file, fil, 1);
if (!strnotempty(mime_from_file) || strcasecmp(mime_type, mime_from_file) != 0) { /* different mime for this type */
- ext_chg = 1;
+ if (!may_unknown(opt, mime_type)) {
+ ext_chg = 1;
+ }
} else {
ext_chg = 0;
}
diff --git a/src/htszlib.c b/src/htszlib.c
index 9227bbb..30d354d 100644
--- a/src/htszlib.c
+++ b/src/htszlib.c
@@ -140,9 +140,33 @@ int hts_extract_meta(const char* path) {
}
return 0;
}
-
-#else
-
-#error HTS_USEZLIB not defined
-
+
+const char* hts_get_zerror(int err) {
+ switch(err) {
+ case UNZ_OK:
+ return "no error";
+ break;
+ case UNZ_END_OF_LIST_OF_FILE:
+ return "end of list of file";
+ break;
+ case UNZ_ERRNO:
+ return (const char*) strerror(errno);
+ break;
+ case UNZ_PARAMERROR:
+ return "parameter error";
+ break;
+ case UNZ_BADZIPFILE:
+ return "bad zip file";
+ break;
+ case UNZ_INTERNALERROR:
+ return "internal error";
+ break;
+ case UNZ_CRCERROR:
+ return "crc error";
+ break;
+ default:
+ return "unknown error";
+ break;
+ }
+}
#endif
diff --git a/src/htszlib.h b/src/htszlib.h
index 3d91dc3..af396b8 100644
--- a/src/htszlib.h
+++ b/src/htszlib.h
@@ -53,6 +53,7 @@ Please visit our Website: http://www.httrack.com
extern int gz_is_available;
extern int hts_zunpack(char* filename,char* newfile);
extern int hts_extract_meta(const char* path);
+extern const char* hts_get_zerror(int err);
#endif
#endif
diff --git a/src/webhttrack b/src/webhttrack
index 11682c1..430b026 100755
--- a/src/webhttrack
+++ b/src/webhttrack
@@ -7,7 +7,7 @@ BROWSEREXE=
SRCHBROWSEREXE="x-www-browser www-browser iceape mozilla firefox firebird galeon konqueror opera netscape"
if test -n "${BROWSER}"; then
# sensible-browser will f up if BROWSER is not set
-SRCHBROWSEREXE="sensible-browser ${SRCHBROWSEREXE}"
+SRCHBROWSEREXE="xdg-open sensible-browser ${SRCHBROWSEREXE}"
fi
SRCHPATH="/usr/local/bin /usr/share/bin /usr/bin /usr/lib/httrack /usr/local/lib/httrack /usr/local/share/httrack /sw/bin ${HOME}/usr/bin ${HOME}/bin"
SRCHPATH="$SRCHPATH "`echo $PATH | tr ":" " "`