httrack 3.41.2

This commit is contained in:
Xavier Roche
2012-03-19 12:59:03 +00:00
parent 64cc4a88da
commit 660b569b09
167 changed files with 9810 additions and 7731 deletions

View File

@@ -54,9 +54,6 @@
/* Check for large files support */
#undef HTS_LFS
/* Default value used */
#undef HTS_PLATFORM
/* Check for libsocket */
#undef LIBSOCKET

36
configure vendored
View File

@@ -1776,7 +1776,7 @@ fi
# Define the identity of the package.
PACKAGE=httrack
VERSION=3.40.4
VERSION=3.41.20
cat >>confdefs.h <<_ACEOF
@@ -1902,7 +1902,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
VERSION_INFO="1:40:0"
VERSION_INFO="2:41:0"
echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
@@ -19038,28 +19038,12 @@ DEFAULT_CFLAGS="-O -g3 -Wall -Wcast-align -Wstrict-prototypes \
### Check for platform
case $host in
AIX)
cat >>confdefs.h <<\_ACEOF
#define HTS_PLATFORM 1
_ACEOF
;;
*-solaris*)
cat >>confdefs.h <<\_ACEOF
#define HTS_PLATFORM 2
_ACEOF
;;
*-linux-gnu | *-irix6*)
cat >>confdefs.h <<\_ACEOF
#define HTS_PLATFORM 3
_ACEOF
;;
*)
cat >>confdefs.h <<\_ACEOF
#define HTS_PLATFORM 3
_ACEOF
;;
esac
#case $host in
#AIX) AC_DEFINE(HTS_PLATFORM, 1, [Defined to build under AIX]);;
#*-solaris*) AC_DEFINE(HTS_PLATFORM, 2, [Defined to build under solaris]);;
#*-linux-gnu | *-irix6*) AC_DEFINE(HTS_PLATFORM, 3, [Defined to build under Linux]);;
#*) AC_DEFINE(HTS_PLATFORM, 3, [Default value used]);;
#esac
### Check size of long and long long.
echo "$as_me:$LINENO: checking for long" >&5
@@ -21655,7 +21639,7 @@ _ACEOF
fi
ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile m4/Makefile libtest/Makefile templates/Makefile lang/Makefile html/Makefile"
ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile m4/Makefile templates/Makefile lang/Makefile html/Makefile libtest/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -22223,10 +22207,10 @@ do
"src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
"m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
"libtest/Makefile" ) CONFIG_FILES="$CONFIG_FILES libtest/Makefile" ;;
"templates/Makefile" ) CONFIG_FILES="$CONFIG_FILES templates/Makefile" ;;
"lang/Makefile" ) CONFIG_FILES="$CONFIG_FILES lang/Makefile" ;;
"html/Makefile" ) CONFIG_FILES="$CONFIG_FILES html/Makefile" ;;
"libtest/Makefile" ) CONFIG_FILES="$CONFIG_FILES libtest/Makefile" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5

View File

@@ -1,7 +1,7 @@
AC_INIT(src/httrack.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(httrack, 3.40.4)
VERSION_INFO="1:40:0"
AM_INIT_AUTOMAKE(httrack, 3.41.20)
VERSION_INFO="2:41:0"
AM_MAINTAINER_MODE
AC_PREREQ(2.50)
@@ -21,12 +21,12 @@ AC_SUBST(DEFAULT_CFLAGS)
AC_SUBST(VERSION_INFO)
### Check for platform
case $host in
AIX) AC_DEFINE(HTS_PLATFORM, 1, [Defined to build under AIX]);;
*-solaris*) AC_DEFINE(HTS_PLATFORM, 2, [Defined to build under solaris]);;
*-linux-gnu | *-irix6*) AC_DEFINE(HTS_PLATFORM, 3, [Defined to build under Linux]);;
*) AC_DEFINE(HTS_PLATFORM, 3, [Default value used]);;
esac
#case $host in
#AIX) AC_DEFINE(HTS_PLATFORM, 1, [Defined to build under AIX]);;
#*-solaris*) AC_DEFINE(HTS_PLATFORM, 2, [Defined to build under solaris]);;
#*-linux-gnu | *-irix6*) AC_DEFINE(HTS_PLATFORM, 3, [Defined to build under Linux]);;
#*) AC_DEFINE(HTS_PLATFORM, 3, [Default value used]);;
#esac
### Check size of long and long long.
AC_CHECK_SIZEOF(long)
@@ -175,8 +175,8 @@ AC_OUTPUT([ Makefile
src/Makefile
man/Makefile
m4/Makefile
libtest/Makefile
templates/Makefile
lang/Makefile
html/Makefile
libtest/Makefile
])

View File

@@ -4,6 +4,16 @@ HTTrack Website Copier release history:
This file lists all changes and fixes that have been made for HTTrack.
3.41-beta
+ New: changed API/ABI to thread-safe ones (libhttrack1 2), big cleanup in all .h definitions
+ Fixed: Major memory usage bug when downloading large sites
+ Fixed: do not rename files if the original MIME type was compatible
+ Fixed: several source fixes for freeBSD (especially time problems)
+ New: option %w to disable specific modules (java, flash..)
+ Fixed: 'no space left in stack for back_add' error
+ Fixed: fixed redirected images with "html" type
+ Fixed: 'Crash adding error, unexpected error found.. [4268]' error
3.40-2
+ Fixed: bogus '.del' filenames with ISO-9660 option
+ Fixed: now merges the header charset even with an empty footer string

View File

@@ -34,7 +34,7 @@ EXTRA_DIST = $(HelpHtml_DATA) $(HelpHtmlimg_DATA) $(HelpHtmlimages_DATA) \
httrack.css
install-data-hook:
if test ! -f $(DESTDIR)$(prefix)/share/httrack/html ; then \
if test ! -L $(DESTDIR)$(prefix)/share/httrack/html ; then \
( cd $(DESTDIR)$(prefix)/share/httrack \
&& mv -f ../doc/httrack/html html \
&& cd ../doc/httrack/ \

View File

@@ -570,7 +570,7 @@ uninstall-am: uninstall-HelpHtmlDATA uninstall-HelpHtmlTxtDATA \
install-data-hook:
if test ! -f $(DESTDIR)$(prefix)/share/httrack/html ; then \
if test ! -L $(DESTDIR)$(prefix)/share/httrack/html ; then \
( cd $(DESTDIR)$(prefix)/share/httrack \
&& mv -f ../doc/httrack/html html \
&& cd ../doc/httrack/ \

View File

@@ -579,7 +579,7 @@ And then, put the email address in your pages through:
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -144,7 +144,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -282,7 +282,7 @@ Libraries should generally handle this peculiar format, however.
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -145,7 +145,7 @@ The command-line version
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -243,7 +243,7 @@ roche at httrack dot com (Xavier ROCHE)<br>
<br><hr><br>
<br>
This program is covered by the GNU General Public License.<br>
HTTrack/HTTrack Website Copier is Copyright (C) 1998-2003 Xavier Roche and other contributors
HTTrack/HTTrack Website Copier is Copyright (C) 1998-2007 Xavier Roche and other contributors
<br>
<!-- ==================== Start epilogue ==================== -->
@@ -259,7 +259,7 @@ roche at httrack dot com (Xavier ROCHE)<br>
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -116,7 +116,8 @@ You can use tens of options (see <tt>httrack --help</tt>) to control precisely t
<br><br>
<li><a href="plug.html">More complex use: plugging external C functions to the httrack library</a></li><br>
For advanced functions, you may have to use external C wrappers ; for example when adding advanced crawl features, such as "tuned" filestructure type
<br><i>Important note: please read the license information of httrack before developing add-ons</i>
<br><i>Important note: please read the license information of httrack before developing add-ons</i><br />
See also the page <a href="plug_330.html">for versions prior to 3.41</a>
<br><br>
<li><a href="library.html">Advanced use: using the library</a></li><br>
The library can be used to write graphical GUIs for httrack, or to run mirrors from a program.
@@ -146,7 +147,7 @@ This page describes the HTTrack cache format.
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -934,7 +934,7 @@ A: <em>Feel free to <a href="contact.html">contact us</a>!
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -2708,7 +2708,7 @@ for only 2 simultaneous sesions.
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -466,7 +466,7 @@ See also: The <a href="faq.html#VF1">FAQ</a><br>
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

File diff suppressed because it is too large Load Diff

View File

@@ -142,7 +142,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -125,7 +125,7 @@ You may also want to check the <tt>httrack.c</tt> and <tt>httrack.h<tt> files to
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -352,7 +352,7 @@ Add debug informations on log files
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -145,7 +145,7 @@ downloads. HTTrack is fully configurable, and has an integrated help system.
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -108,85 +108,215 @@ We'll see there some examples.
<br><br>
The <tt>httrack</tt> commandline tool allows (since the 3.30 release) to plug external functions to various callbacks defined in httrack.<br>
See also: the <tt>httrack-library.h</tt> prototype file, and the <tt>callbacks-example.c</tt> given in the httrack archive.<br>
The <tt>httrack</tt> commandline tool allows (since the 3.30 release) to plug external functions to various callbacks defined in httrack.
The 3.41 release introduces a cleaned up verion of callbacks, with two major changes:
<ul>
<li>Cleaned up function prototypes, with two arguments always passed (the caller carg structure, and the httrackp* object), convenient to pass an user-defined pointer (see <tt>CALLBACKARG_USERDEF(carg)</tt>)</li>
<li>The httrackp* option structure can be directly accessed to plug callbacks (no need to give the callback name and function name in the commandline!)</li>
<li>The callback plug is made through the CHAIN_FUNCTION() helper, allowing to chain multiple callbacks of the same type (the callbacks MUST preserve the chain by calling ancestors)</li>
</ul>
<br>
Example:
<tt>
httrack --wrapper check-html=callback:process_file ..
</tt>
<br>
With the callback.so (or callback.dll) module defined as below:
References:
<ul>
<li>the <tt>httrack-library.h</tt> prototype file
<br />
Note: the <i>Initialization</i>, <i>Main functions</i>, <i>Options handling</i> and <i>Wrapper functions</i> sections are generally the only ones to be considered.
</li>
<li>the <tt>htsdefines.h</tt> prototype file, which describes callback function prototypes</li>
<li>the <tt>htsopt.h</tt> prototype file, which describes the full httrackp* structure</li>
<li>the <tt>callbacks-example*.c</tt> files given in the httrack archive</li>
<li>the <tt>htsjava.c</tt> source file (the java class plugin ; overrides 'detect' and 'parse')</li>
<li>the example given at the end of this document</li>
</ul>
<pre>
int process_file(char* html, int len, char* url_adresse, char* url_fichier) {
printf("now parsing %s%s..\n", url_adresse, url_fichier);
strcpy(currentURLBeingParsed, url_adresse);
strcat(currentURLBeingParsed, url_fichier);
return 1; /* success */
}
</pre>
Below the list of callbacks, and associated external wrappers:<br>
<br />
Below the list of functions to be defined in the module (plugin).<br />
<br />
<table width="100%">
<tr><td><b>"<i>callback name</i>"</b></td><td><b>callback description</b></td><td><b>callback function signature</b></td></tr>
<tr><td><b><i>module function name</i></b></td><td><b>function description</b></td><td><b>function signature</b></td></tr>
<tr><td background="img/fade.gif"><i>hts_plug</i></td><td background="img/fade.gif">
The module entry point. The opt structure can be used to plug callbacks, using the CHAIN_FUNCTION() macro helper. The argv optional argument is the one passed in the commandline as --wrapper parameter.<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)<br />
<tr><td background="img/fade.gif">"<i>init</i>"</td><td background="img/fade.gif"><font color="red">Note: deprecated, should not be used anymore (unsafe callback) - see "start" callback or wrapper_init() module function below this table.</font>Called during initialization ; use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks.<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(void);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>free</i>"</td><td background="img/fade.gif"><font color="red">Note: deprecated, should not be used anymore (unsafe callback) - see "end" callback or wrapper_exit() module function below this table.</font><br />Called during un-initialization<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(void);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>start</i>"</td><td background="img/fade.gif">Called when the mirror starts. The <tt>opt</tt> structure passed lists all options defined for this mirror. You may modify the <tt>opt</tt> structure to fit your needs. Besides, use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks.<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)</td><td background="img/fade.gif"><tt>int (* myfunction)(httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>end</i>"</td><td background="img/fade.gif">Called when the mirror ends<br>return value: 1 upon success, 0 upon error (the mirror will then be considered aborted)</td><td background="img/fade.gif"><tt>int (* myfunction)(void);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>change-options</i>"</td><td background="img/fade.gif">Called when options are to be changed. The <tt>opt</tt> structure passed lists all options, updated to take account of recent changes<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)</td><td background="img/fade.gif"><tt>int (* myfunction)(httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>check-html</i>"</td><td background="img/fade.gif">Called when a document (which may not be an html document) is to be parsed. The <tt>html</tt> address points to the document data, of lenth <tt>len</tt>. The <tt>url_adresse</tt> and <tt>url_fichier</tt> are the address and URI of the file being processed<br>return value: 1 if the parsing can be processed, 0 if the file must be skipped without being parsed</td><td background="img/fade.gif"><tt>int (* myfunction)(char* html,int len,char* url_adresse,char* url_fichier);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>preprocess-html</i>"</td><td background="img/fade.gif">Called when a document (which is an html document) is to be parsed (original, not yet modified document). The <tt>html</tt> address points to the document data address (char**), and the <tt>length</tt> address points to the lenth of this document. Both pointer values (address and size) can be modified to change the document. It is up to the callback function to reallocate the given pointer (using standard C library realloc()/free() functions), which will be free()'ed by the engine. Hence, return of static buffers is strictly forbidden, and the use of strdup() in such cases is advised. The <tt>url_adresse</tt> and <tt>url_fichier</tt> are the address and URI of the file being processed<br>return value: 1 if the new pointers can be applied (default value)</td><td background="img/fade.gif"><tt>int (* myfunction)(char** html,int* len,char* url_adresse,char* url_fichier);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>postprocess-html</i>"</td><td background="img/fade.gif">Called when a document (which is an html document) is parsed and transformed (links rewritten). The <tt>html</tt> address points to the document data address (char**), and the <tt>length</tt> address points to the lenth of this document. Both pointer values (address and size) can be modified to change the document. It is up to the callback function to reallocate the given pointer (using standard C library realloc()/free() functions), which will be free()'ed by the engine. Hence, return of static buffers is strictly forbidden, and the use of strdup() in such cases is advised. The <tt>url_adresse</tt> and <tt>url_fichier</tt> are the address and URI of the file being processed<br>return value: 1 if the new pointers can be applied (default value)</td><td background="img/fade.gif"><tt>int (* myfunction)(char** html,int* len,char* url_adresse,char* url_fichier);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>query</i>"</td><td background="img/fade.gif">Called when the wizard needs to ask a question. The <tt>question</tt> string contains the question for the (human) user<br>return value: the string answer ("" for default reply)</td><td background="img/fade.gif"><tt>char* (* myfunction)(char* question);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>query2</i>"</td><td background="img/fade.gif">Called when the wizard needs to ask a question</td><td background="img/fade.gif"><tt>char* (* myfunction)(char* question);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>query3</i>"</td><td background="img/fade.gif">Called when the wizard needs to ask a question</td><td background="img/fade.gif"><tt>char* (* myfunction)(char* question);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>loop</i>"</td><td background="img/fade.gif">Called periodically (informational, to display statistics)<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int (* myfunction)(lien_back* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,hts_stat_struct* stats);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>check-link</i>"</td><td background="img/fade.gif">Called when a link has to be tested. The <tt>adr</tt> and <tt>fil</tt> are the address and URI of the link being tested. The passed <tt>status</tt> value has the following meaning: 0 if the link is to be accepted by default, 1 if the link is to be refused by default, and -1 if no decision has yet been taken by the engine<br>return value: same meaning as the passed <tt>status</tt> value ; you may generally return -1 to let the engine take the decision by itself</td><td background="img/fade.gif"><tt>int (* myfunction)(char* adr,char* fil,int status);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>check-mime</i>"</td><td background="img/fade.gif">Called when a link download has begun, and needs to be tested against its MIME type. The <tt>adr</tt> and <tt>fil</tt> are the address and URI of the link being tested, and the <tt>mime</tt> string contains the link type being processed. The passed <tt>status</tt> value has the following meaning: 0 if the link is to be accepted by default, 1 if the link is to be refused by default, and -1 if no decision has yet been taken by the engine<br>return value: same meaning as the passed <tt>status</tt> value ; you may generally return -1 to let the engine take the decision by itself</td><td background="img/fade.gif"><tt>int (* myfunction)(char* adr,char* fil,char* mime,int status);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>pause</i>"</td><td background="img/fade.gif">Called when the engine must pause. When the <tt>lockfile</tt> passed is deleted, the function can return<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(char* lockfile);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>save-file</i>"</td><td background="img/fade.gif">Called when a file is to be saved on disk<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(char* file);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>save-file2</i>"</td><td background="img/fade.gif">Called when a file is to be saved or checked on disk<br>The hostname, filename and local filename are given. Two additional flags tells if the file is new (is_new) and is the file is to be modified (is_modified).<br>(!is_new && !is_modified): the file is up-to-date, and will not be modified<br>(is_new && is_modified): a new file will be written (or an updated file is being written)<br>(!is_new && is_modified): a file is being updated (append)<br>(is_new && !is_modified): an empty file will be written ("do not recatch locally erased files")<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(char* hostname,char* filename,char* localfile,int is_new,int is_modified);</tt></td></tr>
<br />
Wrappers can be plugged inside hts_plug() using:<br />
<tt>
CHAIN_FUNCTION(opt, &lt;callback name&gt;, &lt;our callback function name&gt;, &lt;our callback function optional custom pointer argument&gt;);
</tt>
<br />
typedef void (* t_hts_htmlcheck_filesave2)();
<br />
Example:
<br />
<tt>
CHAIN_FUNCTION(opt, check_html, process, userdef);
</tt>
<br />
</td><td background="img/fade.gif"><tt>extern int hts_plug(httrackp *opt, const char* argv);</tt></td></tr>
<!-- -->
<tr><td background="img/fade.gif"><i>hts_unplug</i></td><td background="img/fade.gif">
The module exit point. To free allocated resources without using global variables, use the uninit callback (see below)</td><td background="img/fade.gif"><tt>extern int hts_unplug(httrackp *opt);</tt></td></tr>
</table>
<tr><td background="img/fade.gif">"<i>link-detected</i>"</td><td background="img/fade.gif">Called when a link has been detected<br>return value: 1 if the link can be analyzed, 0 if the link must not even be considered</td><td background="img/fade.gif"><tt>int (* myfunction)(char* link);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>transfer-status</i>"</td><td background="img/fade.gif">Called when a file has been processed (downloaded, updated, or error)<br>return value: must return 1</td><td background="img/fade.gif"><tt>int (* myfunction)(lien_back* back);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>save-name</i>"</td><td background="img/fade.gif">Called when a local filename has to be processed. The <tt>adr_complete</tt> and <tt>fil_complete</tt> are the address and URI of the file being saved ; the <tt>referer_adr</tt> and <tt>referer_fil</tt> are the address and URI of the referer link. The <tt>save</tt> string contains the local filename being used. You may modifiy the <tt>save</tt> string to fit your needs, up to 1024 bytes (note: filename collisions, if any, will be handled by the engine by renaming the file into file-2.ext, file-3.ext ..).<br>return value: must return 1</td><td background="img/fade.gif"><tt>int (* myfunction)(char* adr_complete,char* fil_complete,char* referer_adr,char* referer_fil,char* save);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>send-header</i>"</td><td background="img/fade.gif">Called when HTTP headers are to be sent to the remote server. The <tt>buff</tt> buffer contains text headers, <tt>adr</tt> and <tt>fil</tt> the URL, and <tt>referer_adr</tt> and <tt>referer_fil</tt> the referer URL. The <tt>outgoing</tt> structure contains all information related to the current slot.<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int (* myfunction)(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, htsblk* outgoing);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>receive-header</i>"</td><td background="img/fade.gif">Called when HTTP headers are recevived from the remote server. The <tt>buff</tt> buffer contains text headers, <tt>adr</tt> and <tt>fil</tt> the URL, and <tt>referer_adr</tt> and <tt>referer_fil</tt> the referer URL. The <tt>incoming</tt> structure contains all information related to the current slot.<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int (* myfunction)(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, htsblk* incoming);</tt></td></tr>
<br />
Note that all callbacks (except init and uninit) take as first two argument:
<ul>
<li>the t_hts_callbackarg structure<br />
this structure holds the callback chain (parent callbacks defined before the current callback) pointers, and the user-defined pointer ; see <tt>CALLBACKARG_USERDEF(carg)</tt>)
</li>
<li>the httrackp structure<br />
this structure, holding all current httrack options and mirror state, can be read or mofidied
</li>
</ul>
<br />
Below the list of callbacks, and associated external wrappers.
<table width="100%">
<tr><td><b><i>callback name</i></b></td><td><b>callback description</b></td><td><b>callback function signature</b></td></tr>
<tr><td background="img/fade.gif"><i>init</i></td><td background="img/fade.gif">Note: the use the "start" callback is advised. Called during initialization.<br>return value: none</td><td background="img/fade.gif"><tt>void mycallback(t_hts_callbackarg *carg);</tt></td></tr>
<tr><td background="img/fade.gif"><i>uninit</i></td><td background="img/fade.gif">Note: the use os the "end" callback is advised.<br />Called during un-initialization<br>return value: none</td><td background="img/fade.gif"><tt>void mycallback(t_hts_callbackarg *carg);</tt></td></tr>
<tr><td background="img/fade.gif"><i>start</i></td><td background="img/fade.gif">Called when the mirror starts. The <tt>opt</tt> structure passed lists all options defined for this mirror. You may modify the <tt>opt</tt> structure to fit your needs.<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif"><i>end</i></td><td background="img/fade.gif">Called when the mirror ends<br>return value: 1 upon success, 0 upon error (the mirror will then be considered aborted)</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif"><i>chopt</i></td><td background="img/fade.gif">Called when options are to be changed. The <tt>opt</tt> structure passed lists all options, updated to take account of recent changes<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif"><i>preprocess</i></td><td background="img/fade.gif">Called when a document (which is an html document) is to be parsed (original, not yet modified document). The <tt>html</tt> address points to the document data address (char**), and the <tt>length</tt> address points to the lenth of this document. Both pointer values (address and size) can be modified to change the document. It is up to the callback function to reallocate the given pointer (using the hts_realloc()/hts_free() library functions), which will be free()'ed by the engine. Hence, return of static buffers is strictly forbidden, and the use of hts_strdup() in such cases is advised. The <tt>url_address</tt> and <tt>url_file</tt> are the address and URI of the file being processed<br>return value: 1 if the new pointers can be applied (default value)</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char** html, int* len, const char* url_address, const char* url_file);</tt></td></tr>
<tr><td background="img/fade.gif"><i>postprocess</i></td><td background="img/fade.gif">Called when a document (which is an html document) is parsed and transformed (links rewritten). The <tt>html</tt> address points to the document data address (char**), and the <tt>length</tt> address points to the lenth of this document. Both pointer values (address and size) can be modified to change the document. It is up to the callback function to reallocate the given pointer (using the hts_realloc()/hts_free() library functions), which will be free()'ed by the engine. Hence, return of static buffers is strictly forbidden, and the use of hts_strdup() in such cases is advised. The <tt>url_address</tt> and <tt>url_file</tt> are the address and URI of the file being processed<br>return value: 1 if the new pointers can be applied (default value)</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char** html, int* len, const char* url_address, const char* url_file);</tt></td></tr>
<tr><td background="img/fade.gif"><i>check_html</i></td><td background="img/fade.gif">Called when a document (which may not be an html document) is to be parsed. The <tt>html</tt> address points to the document data, of lenth <tt>len</tt>. The <tt>url_address</tt> and <tt>url_file</tt> are the address and URI of the file being processed<br>return value: 1 if the parsing can be processed, 0 if the file must be skipped without being parsed</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file);</tt></td></tr>
<tr><td background="img/fade.gif"><i>query</i></td><td background="img/fade.gif">Called when the wizard needs to ask a question. The <tt>question</tt> string contains the question for the (human) user<br>return value: the string answer ("" for default reply)</td><td background="img/fade.gif"><tt>const char* mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* question);</tt></td></tr>
<tr><td background="img/fade.gif"><i>query2</i></td><td background="img/fade.gif">Called when the wizard needs to ask a question</td><td background="img/fade.gif"><tt>const char* mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* question);</tt></td></tr>
<tr><td background="img/fade.gif"><i>query3</i></td><td background="img/fade.gif">Called when the wizard needs to ask a question</td><td background="img/fade.gif"><tt>const char* mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* question);</tt></td></tr>
<tr><td background="img/fade.gif"><i>loop</i></td><td background="img/fade.gif">Called periodically (informational, to display statistics)<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, lien_back* back, int back_max, int back_index, int lien_tot, int lien_ntot, int stat_time, hts_stat_struct* stats);</tt></td></tr>
<tr><td background="img/fade.gif"><i>check_link</i></td><td background="img/fade.gif">Called when a link has to be tested. The <tt>adr</tt> and <tt>fil</tt> are the address and URI of the link being tested. The passed <tt>status</tt> value has the following meaning: 0 if the link is to be accepted by default, 1 if the link is to be refused by default, and -1 if no decision has yet been taken by the engine<br>return value: same meaning as the passed <tt>status</tt> value ; you may generally return -1 to let the engine take the decision by itself</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* adr, const char* fil, int status);</tt></td></tr>
<tr><td background="img/fade.gif"><i>check_mime</i></td><td background="img/fade.gif">Called when a link download has begun, and needs to be tested against its MIME type. The <tt>adr</tt> and <tt>fil</tt> are the address and URI of the link being tested, and the <tt>mime</tt> string contains the link type being processed. The passed <tt>status</tt> value has the following meaning: 0 if the link is to be accepted by default, 1 if the link is to be refused by default, and -1 if no decision has yet been taken by the engine<br>return value: same meaning as the passed <tt>status</tt> value ; you may generally return -1 to let the engine take the decision by itself</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* adr, const char* fil, const char* mime, int status);</tt></td></tr>
<tr><td background="img/fade.gif"><i>pause</i></td><td background="img/fade.gif">Called when the engine must pause. When the <tt>lockfile</tt> passed is deleted, the function can return<br>return value: none</td><td background="img/fade.gif"><tt>void mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* lockfile);</tt></td></tr>
<tr><td background="img/fade.gif"><i>filesave</i></td><td background="img/fade.gif">Called when a file is to be saved on disk<br>return value: none</td><td background="img/fade.gif"><tt>void mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* file);</tt></td></tr>
<tr><td background="img/fade.gif"><i>filesave2</i></td><td background="img/fade.gif">Called when a file is to be saved or checked on disk<br>The hostname, filename and local filename are given. Two additional flags tells if the local file is new (is_new), if the local file is to be modified (is_modified), and if the file was not updated remotely (not_updated).<br>(!is_new && !is_modified): the file is up-to-date, and will not be modified<br>(is_new && is_modified): a new file will be written (or an updated file is being written)<br>(!is_new && is_modified): a file is being updated (append)<br>(is_new && !is_modified): an empty file will be written ("do not recatch locally erased files")<br>not_updated: the file was not re-downloaded because it was up-to-date (no data transfered again)<br><br>return value: none</td><td background="img/fade.gif"><tt>void mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* hostname, const char* filename, const char* localfile, int is_new, int is_modified, int not_updated);</tt></td></tr>
<tr><td background="img/fade.gif"><i>linkdetected</i></td><td background="img/fade.gif">Called when a link has been detected<br>return value: 1 if the link can be analyzed, 0 if the link must not even be considered</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char* link);</tt></td></tr>
<tr><td background="img/fade.gif"><i>linkdetected2</i></td><td background="img/fade.gif">Called when a link has been detected<br>return value: 1 if the link can be analyzed, 0 if the link must not even be considered</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char* link, const const char* tag_start);</tt></td></tr>
<tr><td background="img/fade.gif"><i>xfrstatus</i></td><td background="img/fade.gif">Called when a file has been processed (downloaded, updated, or error)<br>return value: must return 1</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, lien_back* back);</tt></td></tr>
<tr><td background="img/fade.gif"><i>savename</i></td><td background="img/fade.gif">Called when a local filename has to be processed. The <tt>adr_complete</tt> and <tt>fil_complete</tt> are the address and URI of the file being saved ; the <tt>referer_adr</tt> and <tt>referer_fil</tt> are the address and URI of the referer link. The <tt>save</tt> string contains the local filename being used. You may modifiy the <tt>save</tt> string to fit your needs, up to 1024 bytes (note: filename collisions, if any, will be handled by the engine by renaming the file into file-2.ext, file-3.ext ..).<br>return value: must return 1</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save);</tt></td></tr>
<tr><td background="img/fade.gif"><i>sendhead</i></td><td background="img/fade.gif">Called when HTTP headers are to be sent to the remote server. The <tt>buff</tt> buffer contains text headers, <tt>adr</tt> and <tt>fil</tt> the URL, and <tt>referer_adr</tt> and <tt>referer_fil</tt> the referer URL. The <tt>outgoing</tt> structure contains all information related to the current slot.<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing);</tt></td></tr>
<tr><td background="img/fade.gif"><i>receivehead</i></td><td background="img/fade.gif">Called when HTTP headers are recevived from the remote server. The <tt>buff</tt> buffer contains text headers, <tt>adr</tt> and <tt>fil</tt> the URL, and <tt>referer_adr</tt> and <tt>referer_fil</tt> the referer URL. The <tt>incoming</tt> structure contains all information related to the current slot.<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming);</tt></td></tr>
<tr><td background="img/fade.gif"><i>detect</i></td><td background="img/fade.gif">Called when an unknown document is to be parsed. The <tt>str</tt> structure contains all information related to the document.<br>return value: 1 if the type is known and can be parsed, 0 if the document type is unknown</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, htsmoduleStruct* str);</tt></td></tr>
<tr><td background="img/fade.gif"><i>parse</i></td><td background="img/fade.gif">The <tt>str</tt> structure contains all information related to the document.<br>return value: 1 if the document was successfully parsed, 0 if an error occured</td><td background="img/fade.gif"><tt>int mycallback(t_hts_callbackarg *carg, httrackp* opt, htsmoduleStruct* str);</tt></td></tr>
</table>
<br><br>
Below additional function names that can be defined inside the module (DLL/.so):<br>
<table width="100%" ID="Table1">
<tr><td><b>"<i>module function name</i>"</b></td><td><b>function description</b></td></tr>
<tr><td background="img/fade.gif"><i>int <b>function-name</b>_init(char *args);</i></td><td background="img/fade.gif">Called when a function named <b>function-name</b> is extracted from the current module (same as wrapper_init). The optional <tt>args</tt> provides additional commandline parameters. Returns 1 upon success, 0 if the function should not be extracted.</td></tr>
<tr><td background="img/fade.gif"><i>int wrapper_init(char *fname, char *args);</i></td><td background="img/fade.gif">Called when a function named <tt>fname</tt> is extracted from the current module. The optional <tt>args</tt> provides additional commandline parameters. Besides, use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks. Returns 1 upon success, 0 if the function should not be extracted.</td></tr>
<tr><td background="img/fade.gif"><i>int wrapper_exit(void);</i></td><td background="img/fade.gif">Called when the module is unloaded. The function should return 1 (but the result is ignored).</td></tr>
</table>
<br><br>
Below additional function names that can be defined inside the optional libhttrack-plugin module (libhttrack-plugin.dll or libhttrack-plugin.so) searched inside common library path:<br>
<table width="100%" ID="Table2">
<tr><td><b>"<i>module function name</i>"</b></td><td><b>function description</b></td></tr>
<tr><td background="img/fade.gif"><i>void plugin_init(void);</i></td><td background="img/fade.gif">Called if the module (named libhttrack-plugin.(so|dll)) is found in the library path. Use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks.</td></tr>
</table>
<br><br>
Note: the optional libhttrack-plugin module (libhttrack-plugin.dll or libhttrack-plugin.so), if found in the library environment, is loaded automatically, and its <tt>hts_plug()</tt> function being called.<br />
<br />
An example is generally more efficient than anything else, so let's write our first module, aimed to stupidely print all parsed html files:
<table width="100%" border="2">
<tr><td>
<pre>
/* system includes */
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
/* standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* local function called as "check_html" callback */
static int process_file(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt,
/*other parameters are callback-specific*/
char* html, int len, const char* url_address, const char* url_file) {
void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt,
html, len, url_address, url_file)) {
return 0; /* abort */
}
}
printf("file %s%s content: %s\n", url_address, url_file, html);
return 1; /* success */
}
/* local function called as "end" callback */
static int end_of_mirror(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt) {
void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/
/* processing */
fprintf(stderr, "That's all, folks!\n");
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
/* status is ok on our side, return other callabck's status */
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}
/*
module entry point
the function name and prototype MUST match this prototype
*/
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
/* optional argument passed in the commandline we won't be using here */
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* plug callback functions */
CHAIN_FUNCTION(opt, check_html, process_file, /*optional user-defined arg*/NULL);
CHAIN_FUNCTION(opt, end, end_of_mirror, /*optional user-defined arg*/NULL);
return 1; /* success */
}
/*
module exit point
the function name and prototype MUST match this prototype
*/
EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) {
fprintf(stder, "Module unplugged");
return 1; /* success */
}
</pre>
</td></tr></table>
<br />
Compile this file ; for example:
<br />
<tt>
gcc -O -g3 -shared -o mylibrary.so myexample.c
</tt>
<br />
and plug the module using the commandline ; for example:
<br />
<tt>
httrack --wrapper mylibrary http://www.example.com
</tt>
<br />
or, if some parameters are desired:
<br />
<tt>
httrack --wrapper mylibrary,myparameter-string http://www.example.com
</tt>
<br />
(the "myparameter-string" string will be available in the 'arg' parameter passed to the hts_plug entry point)
<br />
<br><br>
<!-- ==================== Start epilogue ==================== -->
@@ -202,7 +332,7 @@ Below additional function names that can be defined inside the optional libhttra
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

215
html/plug_330.html Normal file
View File

@@ -0,0 +1,215 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="HTTrack is an easy-to-use website mirror utility. It allows you to download a World Wide website from the Internet to a local directory,building recursively all structures, getting html, images, and other files from the server to your computer. Links are rebuiltrelatively so that you can freely browse to the local site (works with any browser). You can mirror several sites together so that you can jump from one toanother. You can, also, update an existing mirror site, or resume an interrupted download. The robot is fully configurable, with an integrated help" />
<meta name="keywords" content="httrack, HTTRACK, HTTrack, winhttrack, WINHTTRACK, WinHTTrack, offline browser, web mirror utility, aspirateur web, surf offline, web capture, www mirror utility, browse offline, local site builder, website mirroring, aspirateur www, internet grabber, capture de site web, internet tool, hors connexion, unix, dos, windows 95, windows 98, solaris, ibm580, AIX 4.0, HTS, HTGet, web aspirator, web aspirateur, libre, GPL, GNU, free software" />
<title>HTTrack Website Copier - Offline Browser</title>
<style type="text/css">
<!--
body {
margin: 0; padding: 0; margin-bottom: 15px; margin-top: 8px;
background: #77b;
}
body, td {
font: 14px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}
#subTitle {
background: #000; color: #fff; padding: 4px; font-weight: bold;
}
#siteNavigation a, #siteNavigation .current {
font-weight: bold; color: #448;
}
#siteNavigation a:link { text-decoration: none; }
#siteNavigation a:visited { text-decoration: none; }
#siteNavigation .current { background-color: #ccd; }
#siteNavigation a:hover { text-decoration: none; background-color: #fff; color: #000; }
#siteNavigation a:active { text-decoration: none; background-color: #ccc; }
a:link { text-decoration: underline; color: #00f; }
a:visited { text-decoration: underline; color: #000; }
a:hover { text-decoration: underline; color: #c00; }
a:active { text-decoration: underline; }
#pageContent {
clear: both;
border-bottom: 6px solid #000;
padding: 10px; padding-top: 20px;
line-height: 1.65em;
background-image: url(images/bg_rings.gif);
background-repeat: no-repeat;
background-position: top right;
}
#pageContent, #siteNavigation {
background-color: #ccd;
}
.imgLeft { float: left; margin-right: 10px; margin-bottom: 10px; }
.imgRight { float: right; margin-left: 10px; margin-bottom: 10px; }
hr { height: 1px; color: #000; background-color: #000; margin-bottom: 15px; }
h1 { margin: 0; font-weight: bold; font-size: 2em; }
h2 { margin: 0; font-weight: bold; font-size: 1.6em; }
h3 { margin: 0; font-weight: bold; font-size: 1.3em; }
h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
.blak { background-color: #000; }
.hide { display: none; }
.tableWidth { min-width: 400px; }
.tblRegular { border-collapse: collapse; }
.tblRegular td { padding: 6px; background-image: url(fade.gif); border: 2px solid #99c; }
.tblHeaderColor, .tblHeaderColor td { background: #99c; }
.tblNoBorder td { border: 0; }
// -->
</style>
</head>
<table width="76%" border="0" align="center" cellspacing="0" cellpadding="0" class="tableWidth">
<tr>
<td><img src="images/header_title_4.gif" width="400" height="34" alt="HTTrack Website Copier" title="" border="0" id="title" /></td>
</tr>
</table>
<table width="76%" border="0" align="center" cellspacing="0" cellpadding="3" class="tableWidth">
<tr>
<td id="subTitle">Open Source offline browser</td>
</tr>
</table>
<table width="76%" border="0" align="center" cellspacing="0" cellpadding="0" class="tableWidth">
<tr class="blak">
<td>
<table width="100%" border="0" align="center" cellspacing="1" cellpadding="0">
<tr>
<td colspan="6">
<table width="100%" border="0" align="center" cellspacing="0" cellpadding="10">
<tr>
<td id="pageContent">
<!-- ==================== End prologue ==================== -->
<h2 align="center"><em>HTTrack Programming page - plugging functions<br >
releases 3.30 to 3.40 (not beyond)
</em></h2>
<br>
You can write external functions to be plugged in the httrack library very easily.
We'll see there some examples.
<br><br>
The <tt>httrack</tt> commandline tool allows (since the 3.30 release) to plug external functions to various callbacks defined in httrack.<br>
See also: the <tt>httrack-library.h</tt> prototype file, and the <tt>callbacks-example.c</tt> given in the httrack archive.<br>
<br>
Example:
<tt>
httrack --wrapper check-html=callback:process_file ..
</tt>
<br>
With the callback.so (or callback.dll) module defined as below:
<pre>
int process_file(char* html, int len, char* url_adresse, char* url_fichier) {
printf("now parsing %s%s..\n", url_adresse, url_fichier);
strcpy(currentURLBeingParsed, url_adresse);
strcat(currentURLBeingParsed, url_fichier);
return 1; /* success */
}
</pre>
Below the list of callbacks, and associated external wrappers:<br>
<table width="100%">
<tr><td><b>"<i>callback name</i>"</b></td><td><b>callback description</b></td><td><b>callback function signature</b></td></tr>
<tr><td background="img/fade.gif">"<i>init</i>"</td><td background="img/fade.gif"><font color="red">Note: deprecated, should not be used anymore (unsafe callback) - see "start" callback or wrapper_init() module function below this table.</font>Called during initialization ; use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks.<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(void);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>free</i>"</td><td background="img/fade.gif"><font color="red">Note: deprecated, should not be used anymore (unsafe callback) - see "end" callback or wrapper_exit() module function below this table.</font><br />Called during un-initialization<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(void);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>start</i>"</td><td background="img/fade.gif">Called when the mirror starts. The <tt>opt</tt> structure passed lists all options defined for this mirror. You may modify the <tt>opt</tt> structure to fit your needs. Besides, use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks.<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)</td><td background="img/fade.gif"><tt>int (* myfunction)(httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>end</i>"</td><td background="img/fade.gif">Called when the mirror ends<br>return value: 1 upon success, 0 upon error (the mirror will then be considered aborted)</td><td background="img/fade.gif"><tt>int (* myfunction)(void);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>change-options</i>"</td><td background="img/fade.gif">Called when options are to be changed. The <tt>opt</tt> structure passed lists all options, updated to take account of recent changes<br>return value: 1 upon success, 0 upon error (the mirror will then be aborted)</td><td background="img/fade.gif"><tt>int (* myfunction)(httrackp* opt);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>check-html</i>"</td><td background="img/fade.gif">Called when a document (which may not be an html document) is to be parsed. The <tt>html</tt> address points to the document data, of lenth <tt>len</tt>. The <tt>url_adresse</tt> and <tt>url_fichier</tt> are the address and URI of the file being processed<br>return value: 1 if the parsing can be processed, 0 if the file must be skipped without being parsed</td><td background="img/fade.gif"><tt>int (* myfunction)(char* html,int len,char* url_adresse,char* url_fichier);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>preprocess-html</i>"</td><td background="img/fade.gif">Called when a document (which is an html document) is to be parsed (original, not yet modified document). The <tt>html</tt> address points to the document data address (char**), and the <tt>length</tt> address points to the lenth of this document. Both pointer values (address and size) can be modified to change the document. It is up to the callback function to reallocate the given pointer (using standard C library realloc()/free() functions), which will be free()'ed by the engine. Hence, return of static buffers is strictly forbidden, and the use of strdup() in such cases is advised. The <tt>url_adresse</tt> and <tt>url_fichier</tt> are the address and URI of the file being processed<br>return value: 1 if the new pointers can be applied (default value)</td><td background="img/fade.gif"><tt>int (* myfunction)(char** html,int* len,char* url_adresse,char* url_fichier);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>postprocess-html</i>"</td><td background="img/fade.gif">Called when a document (which is an html document) is parsed and transformed (links rewritten). The <tt>html</tt> address points to the document data address (char**), and the <tt>length</tt> address points to the lenth of this document. Both pointer values (address and size) can be modified to change the document. It is up to the callback function to reallocate the given pointer (using standard C library realloc()/free() functions), which will be free()'ed by the engine. Hence, return of static buffers is strictly forbidden, and the use of strdup() in such cases is advised. The <tt>url_adresse</tt> and <tt>url_fichier</tt> are the address and URI of the file being processed<br>return value: 1 if the new pointers can be applied (default value)</td><td background="img/fade.gif"><tt>int (* myfunction)(char** html,int* len,char* url_adresse,char* url_fichier);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>query</i>"</td><td background="img/fade.gif">Called when the wizard needs to ask a question. The <tt>question</tt> string contains the question for the (human) user<br>return value: the string answer ("" for default reply)</td><td background="img/fade.gif"><tt>char* (* myfunction)(char* question);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>query2</i>"</td><td background="img/fade.gif">Called when the wizard needs to ask a question</td><td background="img/fade.gif"><tt>char* (* myfunction)(char* question);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>query3</i>"</td><td background="img/fade.gif">Called when the wizard needs to ask a question</td><td background="img/fade.gif"><tt>char* (* myfunction)(char* question);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>loop</i>"</td><td background="img/fade.gif">Called periodically (informational, to display statistics)<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int (* myfunction)(lien_back* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,hts_stat_struct* stats);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>check-link</i>"</td><td background="img/fade.gif">Called when a link has to be tested. The <tt>adr</tt> and <tt>fil</tt> are the address and URI of the link being tested. The passed <tt>status</tt> value has the following meaning: 0 if the link is to be accepted by default, 1 if the link is to be refused by default, and -1 if no decision has yet been taken by the engine<br>return value: same meaning as the passed <tt>status</tt> value ; you may generally return -1 to let the engine take the decision by itself</td><td background="img/fade.gif"><tt>int (* myfunction)(char* adr,char* fil,int status);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>check-mime</i>"</td><td background="img/fade.gif">Called when a link download has begun, and needs to be tested against its MIME type. The <tt>adr</tt> and <tt>fil</tt> are the address and URI of the link being tested, and the <tt>mime</tt> string contains the link type being processed. The passed <tt>status</tt> value has the following meaning: 0 if the link is to be accepted by default, 1 if the link is to be refused by default, and -1 if no decision has yet been taken by the engine<br>return value: same meaning as the passed <tt>status</tt> value ; you may generally return -1 to let the engine take the decision by itself</td><td background="img/fade.gif"><tt>int (* myfunction)(char* adr,char* fil,char* mime,int status);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>pause</i>"</td><td background="img/fade.gif">Called when the engine must pause. When the <tt>lockfile</tt> passed is deleted, the function can return<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(char* lockfile);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>save-file</i>"</td><td background="img/fade.gif">Called when a file is to be saved on disk<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(char* file);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>save-file2</i>"</td><td background="img/fade.gif">Called when a file is to be saved or checked on disk<br>The hostname, filename and local filename are given. Two additional flags tells if the file is new (is_new) and is the file is to be modified (is_modified).<br>(!is_new && !is_modified): the file is up-to-date, and will not be modified<br>(is_new && is_modified): a new file will be written (or an updated file is being written)<br>(!is_new && is_modified): a file is being updated (append)<br>(is_new && !is_modified): an empty file will be written ("do not recatch locally erased files")<br>return value: none</td><td background="img/fade.gif"><tt>void (* myfunction)(char* hostname,char* filename,char* localfile,int is_new,int is_modified);</tt></td></tr>
typedef void (* t_hts_htmlcheck_filesave2)();
<tr><td background="img/fade.gif">"<i>link-detected</i>"</td><td background="img/fade.gif">Called when a link has been detected<br>return value: 1 if the link can be analyzed, 0 if the link must not even be considered</td><td background="img/fade.gif"><tt>int (* myfunction)(char* link);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>transfer-status</i>"</td><td background="img/fade.gif">Called when a file has been processed (downloaded, updated, or error)<br>return value: must return 1</td><td background="img/fade.gif"><tt>int (* myfunction)(lien_back* back);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>save-name</i>"</td><td background="img/fade.gif">Called when a local filename has to be processed. The <tt>adr_complete</tt> and <tt>fil_complete</tt> are the address and URI of the file being saved ; the <tt>referer_adr</tt> and <tt>referer_fil</tt> are the address and URI of the referer link. The <tt>save</tt> string contains the local filename being used. You may modifiy the <tt>save</tt> string to fit your needs, up to 1024 bytes (note: filename collisions, if any, will be handled by the engine by renaming the file into file-2.ext, file-3.ext ..).<br>return value: must return 1</td><td background="img/fade.gif"><tt>int (* myfunction)(char* adr_complete,char* fil_complete,char* referer_adr,char* referer_fil,char* save);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>send-header</i>"</td><td background="img/fade.gif">Called when HTTP headers are to be sent to the remote server. The <tt>buff</tt> buffer contains text headers, <tt>adr</tt> and <tt>fil</tt> the URL, and <tt>referer_adr</tt> and <tt>referer_fil</tt> the referer URL. The <tt>outgoing</tt> structure contains all information related to the current slot.<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int (* myfunction)(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, htsblk* outgoing);</tt></td></tr>
<tr><td background="img/fade.gif">"<i>receive-header</i>"</td><td background="img/fade.gif">Called when HTTP headers are recevived from the remote server. The <tt>buff</tt> buffer contains text headers, <tt>adr</tt> and <tt>fil</tt> the URL, and <tt>referer_adr</tt> and <tt>referer_fil</tt> the referer URL. The <tt>incoming</tt> structure contains all information related to the current slot.<br>return value: 1 if the mirror can continue, 0 if the mirror must be aborted</td><td background="img/fade.gif"><tt>int (* myfunction)(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, htsblk* incoming);</tt></td></tr>
</table>
<br><br>
Below additional function names that can be defined inside the module (DLL/.so):<br>
<table width="100%" ID="Table1">
<tr><td><b>"<i>module function name</i>"</b></td><td><b>function description</b></td></tr>
<tr><td background="img/fade.gif"><i>int <b>function-name</b>_init(char *args);</i></td><td background="img/fade.gif">Called when a function named <b>function-name</b> is extracted from the current module (same as wrapper_init). The optional <tt>args</tt> provides additional commandline parameters. Returns 1 upon success, 0 if the function should not be extracted.</td></tr>
<tr><td background="img/fade.gif"><i>int wrapper_init(char *fname, char *args);</i></td><td background="img/fade.gif">Called when a function named <tt>fname</tt> is extracted from the current module. The optional <tt>args</tt> provides additional commandline parameters. Besides, use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks. Returns 1 upon success, 0 if the function should not be extracted.</td></tr>
<tr><td background="img/fade.gif"><i>int wrapper_exit(void);</i></td><td background="img/fade.gif">Called when the module is unloaded. The function should return 1 (but the result is ignored).</td></tr>
</table>
<br><br>
Below additional function names that can be defined inside the optional libhttrack-plugin module (libhttrack-plugin.dll or libhttrack-plugin.so) searched inside common library path:<br>
<table width="100%" ID="Table2">
<tr><td><b>"<i>module function name</i>"</b></td><td><b>function description</b></td></tr>
<tr><td background="img/fade.gif"><i>void plugin_init(void);</i></td><td background="img/fade.gif">Called if the module (named libhttrack-plugin.(so|dll)) is found in the library path. Use of htswrap_add (see <tt>httrack-library.h</tt>) is permitted inside this function to setup other callbacks.</td></tr>
</table>
<br><br>
<br><br>
<!-- ==================== Start epilogue ==================== -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>
</body>
</html>

View File

@@ -250,7 +250,7 @@ Script example:
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -162,7 +162,7 @@ ${LANG_K3} : ${HTTRACK_WEB}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -218,7 +218,7 @@ ${do:end-if}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -139,7 +139,7 @@ ${error}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -167,7 +167,7 @@ ${do:loadhash}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -213,7 +213,7 @@ ${path}/${projname}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -174,7 +174,7 @@ ${do:end-if}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -200,7 +200,7 @@ ${LANG_THANKYOU}!
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -229,7 +229,7 @@ ${do:end-if}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -221,7 +221,7 @@ ${LANG_IOPT10}:
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -321,7 +321,7 @@ ${LANG_W3}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -247,7 +247,7 @@ ${listid:build:LISTDEF_3}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -211,7 +211,7 @@ ${do:output-mode:}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -262,7 +262,7 @@ ${listid:travel3:LISTDEF_11}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -255,7 +255,7 @@ ${LANG_I46}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -291,7 +291,7 @@ ${LANG_I64b}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -227,7 +227,7 @@ ${LANG_I43b}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -219,7 +219,7 @@ ${LANG_B13}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -256,7 +256,7 @@ ${listid:robots:LISTDEF_8}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -237,7 +237,7 @@ ${listid:logtype:LISTDEF_9}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -271,7 +271,7 @@ ${LANG_H20} ${info.currentjob}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -343,7 +343,7 @@ ${do:end-if:}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -276,7 +276,7 @@ ${do:output-mode:}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -378,7 +378,7 @@ ${do:output-mode:}
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
<td id="footer"><small><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></small></td>
</tr>
</table>

View File

@@ -141,7 +141,7 @@ You may encounter minor differences (in the display, or in various options) betw
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -128,7 +128,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -143,7 +143,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -157,7 +157,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -151,7 +151,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -128,7 +128,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -127,7 +127,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -144,7 +144,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -145,7 +145,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -150,7 +150,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -182,7 +182,7 @@ In this case, HTTrack won't check the type, because it has learned that "foo" is
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -181,7 +181,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -145,7 +145,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -112,11 +112,11 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<br><br>
<!-- -->
<li>Exclude link(s)</li>
<br><small>This button lets you add a filter to authorize either a directory, a domain, a certain file type...
<br><small>This button lets you add a filter to exclude either a directory, a domain, a certain file type...
<br>See <a href="#add">below</a> to find out how to add a filter rule...
</small><br><br>
<!-- -->
<li>Exclude link(s)</li>
<li>Include link(s)</li>
<br><small>This button lets you add a filter to authorize either a directory, a domain, a certain file type...
<br>See <a href="#add">below</a> to find out how to add a filter rule...
</small><br><br>
@@ -176,7 +176,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -165,7 +165,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -162,7 +162,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -151,7 +151,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -141,7 +141,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -156,7 +156,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
<table width="76%" border="0" align="center" valign="bottom" cellspacing="0" cellpadding="0">
<tr>
<td id="footer"><small>&copy; 2003 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
<td id="footer"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Leto Kauler.</small></td>
</tr>
</table>

View File

@@ -5,3 +5,5 @@ langrootdir = $(datadir)/httrack
langroot_DATA = ../lang.def ../lang.indexes
EXTRA_DIST = $(lang_DATA) $(langroot_DATA)
#dist-hook:

View File

@@ -335,6 +335,8 @@ uninstall-am: uninstall-info-am uninstall-langDATA \
ps ps-am uninstall uninstall-am uninstall-info-am \
uninstall-langDATA uninstall-langrootDATA
#dist-hook:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -20,22 +20,31 @@ AM_LDFLAGS = -L../src
libbaselinks_la_SOURCES = callbacks-example-baselinks.c
libbaselinks_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libbaselinks_la_LDFLAGS = -version-info 1:0:0
libchangecontent_la_SOURCES = callbacks-example-changecontent.c
libchangecontent_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libchangecontent_la_LDFLAGS = -version-info 1:0:0
libcontentfilter_la_SOURCES = callbacks-example-contentfilter.c
libcontentfilter_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libcontentfilter_la_LDFLAGS = -version-info 1:0:0
libdisplayheader_la_SOURCES = callbacks-example-displayheader.c
libdisplayheader_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libdisplayheader_la_LDFLAGS = -version-info 1:0:0
libfilename_la_SOURCES = callbacks-example-filename.c
libfilename_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilename_la_LDFLAGS = -version-info 1:0:0
libfilename2_la_SOURCES = callbacks-example-filename2.c
libfilename2_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilename2_la_LDFLAGS = -version-info 1:0:0
libfilename_la_SOURCES = callbacks-example-filename.c
libfilename_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilename_la_LDFLAGS = -version-info 1:0:0
libfilenameiisbug_la_SOURCES = callbacks-example-filenameiisbug.c
libfilenameiisbug_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilenameiisbug_la_LDFLAGS = -version-info 1:0:0
liblistlinks_la_SOURCES = callbacks-example-listlinks.c
liblistlinks_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
liblistlinks_la_LDFLAGS = -version-info 1:0:0
pkglib_LTLIBRARIES = libbaselinks.la libcontentfilter.la libdisplayheader.la libfilename.la libfilename2.la libfilenameiisbug.la liblistlinks.la
liblog_la_SOURCES = callbacks-example-log.c
liblog_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
liblog_la_LDFLAGS = -version-info 1:0:0
libsimple_la_SOURCES = callbacks-example-simple.c
libsimple_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libsimple_la_LDFLAGS = -version-info 1:0:0
pkglib_LTLIBRARIES = libbaselinks.la libchangecontent.la libcontentfilter.la libdisplayheader.la libfilename2.la libfilename.la libfilenameiisbug.la liblistlinks.la liblog.la libsimple.la

View File

@@ -163,25 +163,34 @@ AM_LDFLAGS = -L../src
libbaselinks_la_SOURCES = callbacks-example-baselinks.c
libbaselinks_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libbaselinks_la_LDFLAGS = -version-info 1:0:0
libchangecontent_la_SOURCES = callbacks-example-changecontent.c
libchangecontent_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libchangecontent_la_LDFLAGS = -version-info 1:0:0
libcontentfilter_la_SOURCES = callbacks-example-contentfilter.c
libcontentfilter_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libcontentfilter_la_LDFLAGS = -version-info 1:0:0
libdisplayheader_la_SOURCES = callbacks-example-displayheader.c
libdisplayheader_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libdisplayheader_la_LDFLAGS = -version-info 1:0:0
libfilename_la_SOURCES = callbacks-example-filename.c
libfilename_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilename_la_LDFLAGS = -version-info 1:0:0
libfilename2_la_SOURCES = callbacks-example-filename2.c
libfilename2_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilename2_la_LDFLAGS = -version-info 1:0:0
libfilename_la_SOURCES = callbacks-example-filename.c
libfilename_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilename_la_LDFLAGS = -version-info 1:0:0
libfilenameiisbug_la_SOURCES = callbacks-example-filenameiisbug.c
libfilenameiisbug_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libfilenameiisbug_la_LDFLAGS = -version-info 1:0:0
liblistlinks_la_SOURCES = callbacks-example-listlinks.c
liblistlinks_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
liblistlinks_la_LDFLAGS = -version-info 1:0:0
pkglib_LTLIBRARIES = libbaselinks.la libcontentfilter.la libdisplayheader.la libfilename.la libfilename2.la libfilenameiisbug.la liblistlinks.la
liblog_la_SOURCES = callbacks-example-log.c
liblog_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
liblog_la_LDFLAGS = -version-info 1:0:0
libsimple_la_SOURCES = callbacks-example-simple.c
libsimple_la_LIBADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
libsimple_la_LDFLAGS = -version-info 1:0:0
pkglib_LTLIBRARIES = libbaselinks.la libchangecontent.la libcontentfilter.la libdisplayheader.la libfilename2.la libfilename.la libfilenameiisbug.la liblistlinks.la liblog.la libsimple.la
subdir = libtest
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -192,6 +201,9 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
libbaselinks_la_DEPENDENCIES =
am_libbaselinks_la_OBJECTS = callbacks-example-baselinks.lo
libbaselinks_la_OBJECTS = $(am_libbaselinks_la_OBJECTS)
libchangecontent_la_DEPENDENCIES =
am_libchangecontent_la_OBJECTS = callbacks-example-changecontent.lo
libchangecontent_la_OBJECTS = $(am_libchangecontent_la_OBJECTS)
libcontentfilter_la_DEPENDENCIES =
am_libcontentfilter_la_OBJECTS = callbacks-example-contentfilter.lo
libcontentfilter_la_OBJECTS = $(am_libcontentfilter_la_OBJECTS)
@@ -210,17 +222,26 @@ libfilenameiisbug_la_OBJECTS = $(am_libfilenameiisbug_la_OBJECTS)
liblistlinks_la_DEPENDENCIES =
am_liblistlinks_la_OBJECTS = callbacks-example-listlinks.lo
liblistlinks_la_OBJECTS = $(am_liblistlinks_la_OBJECTS)
liblog_la_DEPENDENCIES =
am_liblog_la_OBJECTS = callbacks-example-log.lo
liblog_la_OBJECTS = $(am_liblog_la_OBJECTS)
libsimple_la_DEPENDENCIES =
am_libsimple_la_OBJECTS = callbacks-example-simple.lo
libsimple_la_OBJECTS = $(am_libsimple_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/callbacks-example-baselinks.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-changecontent.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-contentfilter.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-displayheader.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-filename.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-filename2.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-filenameiisbug.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-listlinks.Plo
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-listlinks.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-log.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/callbacks-example-simple.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@@ -228,14 +249,15 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libbaselinks_la_SOURCES) $(libcontentfilter_la_SOURCES) \
$(libdisplayheader_la_SOURCES) $(libfilename_la_SOURCES) \
$(libfilename2_la_SOURCES) $(libfilenameiisbug_la_SOURCES) \
$(liblistlinks_la_SOURCES)
DIST_SOURCES = $(libbaselinks_la_SOURCES) $(libchangecontent_la_SOURCES) \
$(libcontentfilter_la_SOURCES) $(libdisplayheader_la_SOURCES) \
$(libfilename_la_SOURCES) $(libfilename2_la_SOURCES) \
$(libfilenameiisbug_la_SOURCES) $(liblistlinks_la_SOURCES) \
$(liblog_la_SOURCES) $(libsimple_la_SOURCES)
DATA = $(exemples_DATA)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libbaselinks_la_SOURCES) $(libcontentfilter_la_SOURCES) $(libdisplayheader_la_SOURCES) $(libfilename_la_SOURCES) $(libfilename2_la_SOURCES) $(libfilenameiisbug_la_SOURCES) $(liblistlinks_la_SOURCES)
SOURCES = $(libbaselinks_la_SOURCES) $(libchangecontent_la_SOURCES) $(libcontentfilter_la_SOURCES) $(libdisplayheader_la_SOURCES) $(libfilename_la_SOURCES) $(libfilename2_la_SOURCES) $(libfilenameiisbug_la_SOURCES) $(liblistlinks_la_SOURCES) $(liblog_la_SOURCES) $(libsimple_la_SOURCES)
all: all-am
@@ -276,6 +298,8 @@ clean-pkglibLTLIBRARIES:
done
libbaselinks.la: $(libbaselinks_la_OBJECTS) $(libbaselinks_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(libbaselinks_la_LDFLAGS) $(libbaselinks_la_OBJECTS) $(libbaselinks_la_LIBADD) $(LIBS)
libchangecontent.la: $(libchangecontent_la_OBJECTS) $(libchangecontent_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(libchangecontent_la_LDFLAGS) $(libchangecontent_la_OBJECTS) $(libchangecontent_la_LIBADD) $(LIBS)
libcontentfilter.la: $(libcontentfilter_la_OBJECTS) $(libcontentfilter_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(libcontentfilter_la_LDFLAGS) $(libcontentfilter_la_OBJECTS) $(libcontentfilter_la_LIBADD) $(LIBS)
libdisplayheader.la: $(libdisplayheader_la_OBJECTS) $(libdisplayheader_la_DEPENDENCIES)
@@ -288,6 +312,10 @@ libfilenameiisbug.la: $(libfilenameiisbug_la_OBJECTS) $(libfilenameiisbug_la_DEP
$(LINK) -rpath $(pkglibdir) $(libfilenameiisbug_la_LDFLAGS) $(libfilenameiisbug_la_OBJECTS) $(libfilenameiisbug_la_LIBADD) $(LIBS)
liblistlinks.la: $(liblistlinks_la_OBJECTS) $(liblistlinks_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(liblistlinks_la_LDFLAGS) $(liblistlinks_la_OBJECTS) $(liblistlinks_la_LIBADD) $(LIBS)
liblog.la: $(liblog_la_OBJECTS) $(liblog_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(liblog_la_LDFLAGS) $(liblog_la_OBJECTS) $(liblog_la_LIBADD) $(LIBS)
libsimple.la: $(libsimple_la_OBJECTS) $(libsimple_la_DEPENDENCIES)
$(LINK) -rpath $(pkglibdir) $(libsimple_la_LDFLAGS) $(libsimple_la_OBJECTS) $(libsimple_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
@@ -296,12 +324,15 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-baselinks.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-changecontent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-contentfilter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-displayheader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-filename.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-filename2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-filenameiisbug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-listlinks.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-log.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks-example-simple.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \

View File

@@ -3,89 +3,116 @@
Can be useful to make copies of site's archives using site's URL base href as root reference
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example.c
- use the --wrapper option in httrack:
httrack --wrapper check-html=callback:process_file
--wrapper link-detected=callback:check_detectedlink
httrack --wrapper mycallback ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Local function definitions */
static int process_file(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file);
static int check_detectedlink(t_hts_callbackarg *carg, httrackp* opt, char* link);
static int check_detectedlink_end(t_hts_callbackarg *carg, httrackp *opt);
/* Function definitions */
EXTERNAL_FUNCTION int process_file(char* html, int len, char* url_adresse, char* url_fichier);
EXTERNAL_FUNCTION int check_detectedlink(char* link);
EXTERNAL_FUNCTION int check_detectedlink_init(char* initString);
EXTERNAL_FUNCTION int check_detectedlink_exit(void);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
static char base[HTS_URLMAXSIZE + 2] = "";
/*
"check-html" callback
typedef int (* t_hts_htmlcheck)(char* html,int len,char* url_adresse,char* url_fichier);
/*
module entry point
*/
EXTERNAL_FUNCTION int process_file(char* html, int len, char* url_adresse, char* url_fichier) {
/* Disable base href, if any */
char* prevBase = strstr(html, "<BASE HREF=\"");
if (prevBase != NULL) {
prevBase[1] = 'X';
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Check args */
fprintf(stderr, "Plugged..\n");
if (arg == NULL || *arg == '\0' || strlen(arg) >= HTS_URLMAXSIZE / 2) {
fprintf(stderr, "** callback error: arguments expected or bad arguments\n");
fprintf(stderr, "usage: httrack --wrapper modulename,base\n");
fprintf(stderr, "example: httrack --wrapper callback,http://www.example.com/\n");
return 0; /* failed */
} else {
char *callbacks_userdef = strdup(arg); /* userdef */
/* Plug callback functions */
CHAIN_FUNCTION(opt, check_html, process_file, callbacks_userdef);
CHAIN_FUNCTION(opt, linkdetected, check_detectedlink, callbacks_userdef);
CHAIN_FUNCTION(opt, end, check_detectedlink_end, callbacks_userdef);
fprintf(stderr, "Using root '%s'\n", callbacks_userdef);
}
return 1; /* success */
}
/*
"link-detected" callback
typedef int (* t_hts_htmlcheck_linkdetected)(char* link);
*/
EXTERNAL_FUNCTION int check_detectedlink(char* link) {
if (!base[0]) {
fprintf(stderr, "** ERROR! check_detectedlink_init() was not called by httrack - you are probably using an old version (<3.31) or called the wrapper with bad arguments\n");
fprintf(stderr, "** bailing out..\n");
exit(1);
static int process_file(t_hts_callbackarg *carg, httrackp* opt, char* html, int len, const char* url_address, const char* url_file) {
char* prevBase;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) {
return 0; /* Abort */
}
}
/* Disable base href, if any */
if ( ( prevBase = strstr(html, "<BASE HREF=\"") ) != NULL) {
prevBase[1] = 'X';
}
return 1; /* success */
}
static int check_detectedlink(t_hts_callbackarg *carg, httrackp* opt, char* link) {
const char *base = (char*) CALLBACKARG_USERDEF(carg);
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, linkdetected) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, linkdetected)(CALLBACKARG_PREV_CARG(carg), opt, link)) {
return 0; /* Abort */
}
}
/* The incoming (read/write) buffer is at least HTS_URLMAXSIZE bytes long */
if (strncmp(link, "http://", 7) == 0 || strncmp(link, "https://", 8) == 0) {
char temp[HTS_URLMAXSIZE * 2];
strcpy(temp, base);
strcat(temp, link);
strcpy(link, temp);
strcpy(temp, base);
strcat(temp, link);
strcpy(link, temp);
}
return 1; /* success */
}
/* <wrappername>_init() will be called, if exists, upon startup */
EXTERNAL_FUNCTION int check_detectedlink_init(char* initString) {
fprintf(stderr, "Plugged..\n");
if (initString != NULL && *initString != '\0' && strlen(initString) < HTS_URLMAXSIZE / 2) {
strcpy(base, initString);
fprintf(stderr, "Using root '%s'\n", base);
return 1; /* success */
} else {
fprintf(stderr, "** callback error: arguments expected or bad arguments\n");
fprintf(stderr, "usage: httrack --wrapper save-name=callback:mysavename,base\n");
fprintf(stderr, "example: httrack --wrapper save-name=callback:mysavename,http://www.example.com/\n");
return 0; /* failed */
}
}
static int check_detectedlink_end(t_hts_callbackarg *carg, httrackp *opt) {
char *base = (char*) CALLBACKARG_USERDEF(carg);
/* <wrappername>_exit() will be called, if exists, upon exit */
EXTERNAL_FUNCTION int check_detectedlink_exit(void) {
fprintf(stderr, "Unplugged ..\n");
return 1; /* success (result ignored anyway in xx_exit) */
if (base != NULL) {
free(base);
base = NULL;
}
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}

View File

@@ -0,0 +1,65 @@
/*
HTTrack external callbacks example : display all incoming request headers
Example of <wrappername>_init and <wrappername>_exit call (httrack >> 3.31)
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
httrack --wrapper mycallback ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Local function definitions */
static int postprocess(t_hts_callbackarg *carg, httrackp *opt,
char** html, int* len,
const char* url_address, const char* url_file);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/*
module entry point
*/
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Plug callback functions */
CHAIN_FUNCTION(opt, postprocess, postprocess, NULL);
return 1; /* success */
}
static int postprocess(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) {
char *old = *html;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, postprocess) != NULL) {
if (CALLBACKARG_PREV_FUN(carg, postprocess)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) {
/* Modified *html */
old = *html;
}
}
/* Process */
*html = strdup(*html);
hts_free(old);
return 1;
}

View File

@@ -3,32 +3,33 @@
Example of <wrappername>_init and <wrappername>_exit call (httrack >> 3.31)
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example-contentfilter.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example-contentfilter.c
- use the --wrapper option in httrack:
httrack --wrapper save-name=callback:process,string[,string..]
httrack --wrapper mycallback,stringtofind,stringtofind.. ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Function definitions */
EXTERNAL_FUNCTION int process(char* html, int len, char* address, char* filename);
EXTERNAL_FUNCTION int wrapper_init(char* module, char* initString);
EXTERNAL_FUNCTION int wrapper_exit(void);
/* Local function definitions */
static int process(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* address, const char* filename);
static int end(t_hts_callbackarg *carg, httrackp *opt);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/* TOLOWER */
#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a
@@ -38,24 +39,74 @@ EXTERNAL_FUNCTION int wrapper_exit(void);
This sample just crawls pages that contains certain keywords, and skips the other ones
*/
static char stringfilter[8192];
static char* stringfilters[128];
static int initialized = 0;
typedef struct t_my_userdef {
char stringfilter[8192];
char* stringfilters[128];
} t_my_userdef;
/*
"check-html" callback
from htsdefines.h:
typedef int (* t_hts_htmlcheck)(char* html,int len,char* address,char* filename);
/*
module entry point
*/
EXTERNAL_FUNCTION int process(char* html, int len, char* address, char* filename) {
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Check args */
if (arg == NULL || *arg == '\0') {
fprintf(stderr, "** callback error: arguments expected or bad arguments\n");
fprintf(stderr, "usage: httrack --wrapper callback,stringtofind,stringtofind..\n");
fprintf(stderr, "example: httrack --wrapper callback,apple,orange,lemon\n");
return 0;
} else {
t_my_userdef *userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); /* userdef */
char * const stringfilter = userdef->stringfilter;
char** const stringfilters = userdef->stringfilters;
/* */
char* a = stringfilter;
int i = 0;
fprintf(stderr, "** info: wrapper_init(%s) called!\n", arg);
fprintf(stderr, "** callback example: crawling pages only if specific keywords are found\n");
/* stringfilters = split(arg, ','); */
strcpy(stringfilter, arg);
while(a != NULL) {
stringfilters[i] = a;
a = strchr(a, ',');
if (a != NULL) {
*a = '\0';
a ++;
}
fprintf(stderr, "** callback info: will crawl pages with '%s' in them\n", stringfilters[i]);
i++;
}
stringfilters[i++] = NULL;
/* Plug callback functions */
CHAIN_FUNCTION(opt, check_html, process, userdef);
CHAIN_FUNCTION(opt, end, end, userdef);
}
return 1; /* success */
}
static int process(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* address, const char* filename) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
char * const stringfilter = userdef->stringfilter;
char** const stringfilters = userdef->stringfilters;
/* */
int i = 0;
int getIt = 0;
char* pos;
if (!initialized) {
fprintf(stderr, "** ERROR! process_init() was not called by httrack - you are probably using an old version (<3.31)\n");
fprintf(stderr, "** bailing out..\n");
exit(1);
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, address, filename)) {
return 0; /* Abort */
}
}
/* Process */
if (strcmp(address, "primary") == 0 && strcmp(filename, "/primary") == 0) /* primary page (list of links) */
return 1;
while(stringfilters[i] != NULL && ! getIt) {
@@ -82,39 +133,18 @@ EXTERNAL_FUNCTION int process(char* html, int len, char* address, char* filename
}
}
/* <wrappername>_init() will be called, if exists, upon startup */
EXTERNAL_FUNCTION int wrapper_init(char* module, char* initString) {
char* a = stringfilter;
int i = 0;
fprintf(stderr, "** info: wrapper_init(%s, %s) called!\n", module, initString);
fprintf(stderr, "** callback example: crawling pages only if specific keywords are found\n");
if (initString == NULL || *initString == '\0') {
fprintf(stderr, "** callback error: arguments expected or bad arguments\n");
fprintf(stderr, "usage: httrack --wrapper save-name=callback:process,stringtofind,stringtofind..\n");
fprintf(stderr, "example: httrack --wrapper save-name=callback:process,apple,orange,lemon\n");
return 0;
static int end(t_hts_callbackarg *carg, httrackp *opt) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
fprintf(stderr, "** info: wrapper_exit() called!\n");
if (userdef != NULL) {
free(userdef);
userdef = NULL;
}
/* stringfilters = split(initString, ','); */
strcpy(stringfilter, initString);
while(a != NULL) {
stringfilters[i] = a;
a = strchr(a, ',');
if (a != NULL) {
*a = '\0';
a ++;
}
fprintf(stderr, "** callback info: will crawl pages with '%s' in them\n", stringfilters[i]);
i++;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
stringfilters[i++] = NULL;
initialized = 1; /* we're ok */
return 1; /* success */
}
/* <wrappername>_exit() will be called, if exists, upon exit */
EXTERNAL_FUNCTION int wrapper_exit(void) {
fprintf(stderr, "** info: wrapper_exit() called!\n");
initialized = 0;
return 1; /* success (result ignored anyway in xx_exit) */
}

View File

@@ -3,55 +3,64 @@
Example of <wrappername>_init and <wrappername>_exit call (httrack >> 3.31)
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example-contentfilter.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example-displayheader.c
- use the --wrapper option in httrack:
httrack --wrapper save-name=callback:process,string[,string..]
httrack --wrapper mycallback ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Local function definitions */
static int process(t_hts_callbackarg *carg, httrackp *opt,
char* buff, const char* adr, const char* fil,
const char* referer_adr, const char* referer_fil,
htsblk* incoming);
/* Function definitions */
EXTERNAL_FUNCTION int process(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, void* incoming);
EXTERNAL_FUNCTION int wrapper_init(char* module, char* initString);
EXTERNAL_FUNCTION int wrapper_exit(void);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/*
"receive-header" callback
from htsdefines.h:
typedef int (* t_hts_htmlcheck_receivehead)(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, htsblk* incoming);
/*
module entry point
*/
EXTERNAL_FUNCTION int process(char* buff, char* adr, char* fil, char* referer_adr, char* referer_fil, void* incoming) {
printf("[ %s%s ]\n%s\n", adr, fil, buff);
return 1; /* success */
}
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Plug callback functions */
CHAIN_FUNCTION(opt, receivehead, process, NULL);
/* <wrappername>_init() will be called, if exists, upon startup */
static char* thisModule = NULL;
EXTERNAL_FUNCTION int wrapper_init(char* module, char* initString) {
fprintf(stderr, "Plugged %s\n", module);
thisModule = module;
return 1; /* success */
}
/* <wrappername>_exit() will be called, if exists, upon exit */
EXTERNAL_FUNCTION int wrapper_exit(void) {
fprintf(stderr, "Unplugged %s\n", thisModule);
return 1; /* success (result ignored anyway in xx_exit) */
static int process(t_hts_callbackarg *carg, httrackp *opt,
char* buff, const char* adr, const char* fil,
const char* referer_adr, const char* referer_fil,
htsblk* incoming) {
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, receivehead) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, receivehead)(CALLBACKARG_PREV_CARG(carg), opt, buff, adr, fil, referer_adr, referer_fil, incoming)) {
return 0; /* Abort */
}
}
/* Process */
printf("[ %s%s ]\n%s\n", adr, fil, buff);
return 1; /* success */
}

View File

@@ -2,30 +2,35 @@
HTTrack external callbacks example : changing the destination filename
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example-filename.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example-filename.c
- use the --wrapper option in httrack:
httrack --wrapper save-name=callback:mysavename
httrack --wrapper mycallback ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Function definitions */
EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save);
/* Local function definitions */
static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/* Options settings */
#include "htsopt.h"
/* TOLOWER */
#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a
@@ -46,18 +51,35 @@ EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* r
This sample can be improved, for example, to make a map of a website.
*/
/*
"check-html" callback
from htsdefines.h:
typedef int (* t_hts_htmlcheck_savename)(char* adr_complete,char* fil_complete,char* referer_adr,char* referer_fil,char* save);
/*
module entry point
*/
EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save) {
char* a = save;
while(*a) {
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Plug callback functions */
CHAIN_FUNCTION(opt, savename, mysavename, NULL);
return 1; /* success */
}
static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) {
char* a;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) {
return 0; /* Abort */
}
}
/* Process */
for(a = save ; *a != 0 ; a++) {
char c = TOLOWER(*a);
if (c >= 'a' && c <= 'z')
*a = ( ( ( c - 'a' ) + 13 ) % 26 ) + 'a'; // ROT-13
a++;
}
return 1; /* success */

View File

@@ -1,34 +1,31 @@
/*
HTTrack external callbacks example : changing the destination filename
Example of <wrappername>_init and <wrappername>_exit call (httrack >> 3.31)
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example-filename.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example-filename.c
- use the --wrapper option in httrack:
httrack --wrapper save-name=callback:mysavename,string1,string2
httrack --wrapper mycallback,string1,string2 ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Function definitions */
EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save);
EXTERNAL_FUNCTION int wrapper_init(char* module, char* initString);
EXTERNAL_FUNCTION int wrapper_exit(void);
static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save);
static int myend(t_hts_callbackarg *carg, httrackp *opt);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/* TOLOWER */
#define TOLOWER_(a) (a >= 'A' && a <= 'Z') ? (a + ('a' - 'A')) : a
@@ -40,24 +37,82 @@ EXTERNAL_FUNCTION int wrapper_exit(void);
httrack --wrapper save-name=callback:mysavename,string1,string2 ..
*/
static char string1[256];
static char string2[256];
static int initialized = 0;
typedef struct t_my_userdef {
char string1[256];
char string2[256];
} t_my_userdef;
/*
"check-html" callback
from htsdefines.h:
typedef int (* t_hts_htmlcheck_savename)(char* adr_complete,char* fil_complete,char* referer_adr,char* referer_fil,char* save);
/*
module entry point
*/
EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save) {
char* buff = strdup(save);
char* a = buff;
char* b = save;
if (!initialized) {
fprintf(stderr, "** ERROR! mysavename_init() was not called by httrack - you are probably using an old version (<3.31)\n");
fprintf(stderr, "** bailing out..\n");
exit(1);
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Check args */
if (arg == NULL || *arg == '\0' || strchr(arg, ',') == NULL) {
fprintf(stderr, "** callback error: arguments expected or bad arguments\n");
fprintf(stderr, "usage: httrack --wrapper save-name=callback:mysavename,string1,string2\n");
fprintf(stderr, "example: httrack --wrapper save-name=callback:mysavename,foo,bar\n");
return 0; /* failed */
} else {
char *pos = strchr(arg, ',');
t_my_userdef *userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef));
char * const string1 = userdef->string1;
char * const string2 = userdef->string2;
/* Split args */
fprintf(stderr, "** info: wrapper_init(%s) called!\n", arg);
fprintf(stderr, "** callback example: changing destination filename word by another one\n");
string1[0] = string1[1] = '\0';
strncat(string1, arg, pos - arg);
strcpy(string2, pos + 1);
fprintf(stderr, "** callback info: will replace %s by %s in filenames!\n", string1, string2);
/* Plug callback functions */
CHAIN_FUNCTION(opt, savename, mysavename, userdef);
CHAIN_FUNCTION(opt, end, myend, userdef);
}
return 1; /* success */
}
static int myend(t_hts_callbackarg *carg, httrackp *opt) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
fprintf(stderr, "** info: wrapper_exit() called!\n");
if (userdef != NULL) {
free(userdef);
userdef = NULL;
}
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}
static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
char * const string1 = userdef->string1;
char * const string2 = userdef->string2;
/* */
char *buff, *a, *b;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) {
return 0; /* Abort */
}
}
/* Process */
buff = strdup(save);
a = buff;
b = save;
*b = '\0'; /* the "save" variable points to a buffer with "sufficient" space */
while(*a) {
if (strncmp(a, string1, (int)strlen(string1)) == 0) {
@@ -70,31 +125,6 @@ EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* r
}
}
free(buff);
return 1; /* success */
}
/* <wrappername>_init() will be called, if exists, upon startup */
EXTERNAL_FUNCTION int wrapper_init(char* module, char* initString) {
char* pos;
fprintf(stderr, "** info: wrapper_init(%s, %s) called!\n", module, initString);
fprintf(stderr, "** callback example: changing destination filename word by another one\n");
if (initString == NULL || *initString == '\0' || (pos = strchr(initString, ',') ) == NULL) {
fprintf(stderr, "** callback error: arguments expected or bad arguments\n");
fprintf(stderr, "usage: httrack --wrapper save-name=callback:mysavename,string1,string2\n");
fprintf(stderr, "example: httrack --wrapper save-name=callback:mysavename,foo,bar\n");
return 0;
}
string1[0] = string1[1] = '\0';
strncat(string1, initString, pos - initString);
strcpy(string2, pos + 1);
fprintf(stderr, "** callback info: will replace %s by %s in filenames!\n", string1, string2);
initialized = 1; /* we're ok */
return 1; /* success */
}
/* <wrappername>_exit() will be called, if exists, upon exit */
EXTERNAL_FUNCTION int wrapper_exit(void) {
fprintf(stderr, "** info: wrapper_exit() called!\n");
initialized = 0;
return 1; /* success (result ignored anyway in xx_exit) */
}

View File

@@ -2,43 +2,57 @@
HTTrack external callbacks example : changing folder names ending with ".com"
with ".c0m" as a workaround of IIS bug (see KB 275601)
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example-filename.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example-filename.c
- use the --wrapper option in httrack:
httrack --wrapper save-name=callback:mysavename
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Function definitions */
EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save);
static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/*
module entry point
*/
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
CHAIN_FUNCTION(opt, savename, mysavename, NULL);
return 1; /* success */
}
/*
Replaces all "offending" IIS extensions (exe, dll..) with "nice" ones
*/
/*
"check-html" callback
from htsdefines.h:
typedef int (* t_hts_htmlcheck_savename)(char* adr_complete,char* fil_complete,char* referer_adr,char* referer_fil,char* save);
*/
EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save) {
static int mysavename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete, const char* fil_complete, const char* referer_adr, const char* referer_fil, char* save) {
static const char* iisBogus[] = { ".com", ".exe", ".dll", ".sh", NULL };
static const char* iisBogusReplace[] = { ".c0m", ".ex3", ".dl1", ".5h", NULL }; /* MUST be the same sizes */
char* a;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, savename) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, savename)(CALLBACKARG_PREV_CARG(carg), opt, adr_complete, fil_complete, referer_adr, referer_fil, save)) {
return 0; /* Abort */
}
}
/* Process */
for(a = save ; *a != '\0' ; a++) {
int i;
for(i = 0 ; iisBogus[i] != NULL ; i++) {
@@ -50,5 +64,6 @@ EXTERNAL_FUNCTION int mysavename(char* adr_complete, char* fil_complete, char* r
}
}
}
return 1; /* success */
}

View File

@@ -2,35 +2,35 @@
HTTrack external callbacks example
.c file
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
- compile this file as a module (callback.so or callback.dll)
example:
(with gcc)
gcc -O -g3 -Wall -D_REENTRANT -DINET6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -shared -o callback.so callbacks-example.c
or (with visual c++)
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"callback.dll" callbacks-example.c
- use the --wrapper option in httrack:
httrack --wrapper check-html=callback:process_file
--wrapper link-detected=callback:check_detectedlink
--wrapper loop=callback:check_loop
httrack --wrapper mycallback ..
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* "External" */
#ifdef _WIN32
#define EXTERNAL_FUNCTION __declspec(dllexport)
#else
#define EXTERNAL_FUNCTION
#endif
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Function definitions */
EXTERNAL_FUNCTION int process_file(char* html, int len, char* url_adresse, char* url_fichier);
EXTERNAL_FUNCTION int check_detectedlink(char* link);
EXTERNAL_FUNCTION int check_loop(void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats);
EXTERNAL_FUNCTION int check_void(void);
static int process_file(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* url_address, const char* url_file);
static int check_detectedlink(t_hts_callbackarg *carg, httrackp *opt, char* link);
static int check_loop(t_hts_callbackarg *carg, httrackp *opt, void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats);
static int end(t_hts_callbackarg *carg, httrackp *opt);
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
/*
This sample just lists all links in documents with the parent link:
@@ -38,42 +38,96 @@ EXTERNAL_FUNCTION int check_void(void);
This sample can be improved, for example, to make a map of a website.
*/
static char currentURLBeingParsed[2048];
typedef struct t_my_userdef {
char currentURLBeingParsed[2048];
} t_my_userdef;
/*
"check-html" callback
typedef int (* t_hts_htmlcheck)(char* html,int len,char* url_adresse,char* url_fichier);
/*
module entry point
*/
EXTERNAL_FUNCTION int process_file(char* html, int len, char* url_adresse, char* url_fichier) {
printf("now parsing %s%s..\n", url_adresse, url_fichier);
strcpy(currentURLBeingParsed, url_adresse);
strcat(currentURLBeingParsed, url_fichier);
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
t_my_userdef *userdef;
/* */
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* Create user-defined structure */
userdef = (t_my_userdef*) malloc(sizeof(t_my_userdef)); /* userdef */
userdef->currentURLBeingParsed[0] = '\0';
/* Plug callback functions */
CHAIN_FUNCTION(opt, check_html, process_file, userdef);
CHAIN_FUNCTION(opt, end, end, userdef);
CHAIN_FUNCTION(opt, linkdetected, check_detectedlink, userdef);
CHAIN_FUNCTION(opt, loop, check_loop, userdef);
return 1; /* success */
}
/*
"link-detected" callback
typedef int (* t_hts_htmlcheck_linkdetected)(char* link);
*/
EXTERNAL_FUNCTION int check_detectedlink(char* link) {
static int process_file(t_hts_callbackarg *carg, httrackp *opt, char* html, int len, const char* url_address, const char* url_file) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
char * const currentURLBeingParsed = userdef->currentURLBeingParsed;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt, html, len, url_address, url_file)) {
return 0; /* Abort */
}
}
/* Process */
printf("now parsing %s%s..\n", url_address, url_file);
strcpy(currentURLBeingParsed, url_address);
strcat(currentURLBeingParsed, url_file);
return 1; /* success */
}
static int check_detectedlink(t_hts_callbackarg *carg, httrackp *opt, char* link) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
char * const currentURLBeingParsed = userdef->currentURLBeingParsed;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, linkdetected) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, linkdetected)(CALLBACKARG_PREV_CARG(carg), opt, link)) {
return 0; /* Abort */
}
}
/* Process */
printf("[%s] -> [%s]\n", currentURLBeingParsed, link);
return 1; /* success */
}
/*
"loop" callback
typedef int (* t_hts_htmlcheck_loop)(void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats);
*/
EXTERNAL_FUNCTION int check_loop(void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats) {
static int check_loop(t_hts_callbackarg *carg, httrackp *opt, void* back,int back_max,int back_index,int lien_tot,int lien_ntot,int stat_time,void* stats) {
static int fun_animation=0;
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, loop) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, loop)(CALLBACKARG_PREV_CARG(carg), opt, back, back_max, back_index, lien_tot, lien_ntot, stat_time, stats)) {
return 0; /* Abort */
}
}
/* Process */
printf("%c\r", "/-\\|"[(fun_animation++)%4]);
return 1;
}
/*
a default callback for testing purpose
*/
EXTERNAL_FUNCTION int check_void(void) {
printf("\n* * * default callback function called! * * *\n\n");
return 1;
static int end(t_hts_callbackarg *carg, httrackp *opt) {
t_my_userdef *userdef = (t_my_userdef*) CALLBACKARG_USERDEF(carg);
fprintf(stderr, "** info: wrapper_exit() called!\n");
if (userdef != NULL) {
free(userdef);
userdef = NULL;
}
/* Call parent functions if multiple callbacks are chained. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}

114
libtest/callbacks-example-log.c Executable file
View File

@@ -0,0 +1,114 @@
/*
HTTrack external callbacks example : dumy plugin, aimed to log for debugging purpose
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
httrack --wrapper mycallback ..
*/
/* system includes */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
EXTERNAL_FUNCTION int hts_unplug(httrackp *opt);
/* local function called as "check_html" callback */
static int process_file(t_hts_callbackarg *carg, httrackp *opt,
char* html, int len, const char* url_address, const char* url_file) {
void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/
char *fmt;
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt,
html, len, url_address, url_file)) {
return 0; /* abort */
}
}
/* log */
fprintf(stderr, "* parsing file %s%s\n", url_address, url_file);
fmt = malloc(strlen(url_address) + strlen(url_file) + 128);
sprintf(fmt, " parsing file %s%s", url_address, url_file);
hts_log(opt, "log-wrapper-info", fmt);
free(fmt);
return 1; /* success */
}
static int start_of_mirror(t_hts_callbackarg *carg, httrackp *opt) {
const char *arginfo = (char*) CALLBACKARG_USERDEF(carg);
fprintf(stderr, "* mirror start\n");
hts_log(opt, arginfo, "mirror started");
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
/* status is ok on our side, return other callabck's status */
return CALLBACKARG_PREV_FUN(carg, start)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}
/* local function called as "end" callback */
static int end_of_mirror(t_hts_callbackarg *carg, httrackp *opt) {
const char *arginfo = (char*) CALLBACKARG_USERDEF(carg);
fprintf(stderr, "* mirror end\n");
hts_log(opt, arginfo, "mirror ended");
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
/* status is ok on our side, return other callabck's status */
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}
/*
module entry point
the function name and prototype MUST match this prototype
*/
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
/* optional argument passed in the commandline we won't be using here */
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* plug callback functions */
if (arg == NULL)
arg = "log-wrapper-info";
hts_log(opt, arg, "* plugging functions");
CHAIN_FUNCTION(opt, check_html, process_file, (char*) arg);
CHAIN_FUNCTION(opt, start, start_of_mirror, (char*) arg);
CHAIN_FUNCTION(opt, end, end_of_mirror, (char*) arg);
hts_log(opt, arg, "* module successfully plugged");
return 1; /* success */
}
/*
module exit point
the function name and prototype MUST match this prototype
*/
EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) {
hts_log(opt, "log-wrapper-info", "* module successfully unplugged");
return 1;
}

View File

@@ -0,0 +1,89 @@
/*
HTTrack external callbacks example : print all downloaded html documents
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -O -g3 -Wall -D_REENTRANT -shared -o mycallback.so callbacks-example.c -lhttrack1
With MS-Visual C++:
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack1.lib
Note: the httrack library linker option is only necessary when using libhttrack's functions inside the callback
How to use:
httrack --wrapper mycallback ..
*/
/* system includes */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* external functions */
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv);
EXTERNAL_FUNCTION int hts_unplug(httrackp *opt);
/* local function called as "check_html" callback */
static int process_file(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt,
/*other parameters are callback-specific*/
char* html, int len, const char* url_address, const char* url_file) {
void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, check_html) != NULL) {
if (!CALLBACKARG_PREV_FUN(carg, check_html)(CALLBACKARG_PREV_CARG(carg), opt,
html, len, url_address, url_file)) {
return 0; /* abort */
}
}
printf("file %s%s content: %s\n", url_address, url_file, html);
return 1; /* success */
}
/* local function called as "end" callback */
static int end_of_mirror(t_hts_callbackarg /*the carg structure, holding various information*/*carg, /*the option settings*/httrackp *opt) {
void *ourDummyArg = (void*) CALLBACKARG_USERDEF(carg); /*optional user-defined arg*/
/* processing */
fprintf(stderr, "That's all, folks!\n");
/* call parent functions if multiple callbacks are chained. you can skip this part, if you don't want previous callbacks to be called. */
if (CALLBACKARG_PREV_FUN(carg, end) != NULL) {
/* status is ok on our side, return other callabck's status */
return CALLBACKARG_PREV_FUN(carg, end)(CALLBACKARG_PREV_CARG(carg), opt);
}
return 1; /* success */
}
/*
module entry point
the function name and prototype MUST match this prototype
*/
EXTERNAL_FUNCTION int hts_plug(httrackp *opt, const char* argv) {
/* optional argument passed in the commandline we won't be using here */
const char *arg = strchr(argv, ',');
if (arg != NULL)
arg++;
/* plug callback functions */
CHAIN_FUNCTION(opt, check_html, process_file, /*optional user-defined arg*/NULL);
CHAIN_FUNCTION(opt, end, end_of_mirror, /*optional user-defined arg*/NULL);
return 1; /* success */
}
/*
module exit point
the function name and prototype MUST match this prototype
*/
EXTERNAL_FUNCTION int hts_unplug(httrackp *opt) {
fprintf(stderr, "Module unplugged");
return 1; /* success */
}

View File

@@ -2,29 +2,32 @@
HTTrack library example
.c file
To Build on Windows:
- install winhttrack
- set the proper path in the project settings (especially for the httrack lib and dll)
- compile in multithreaded DLL
- avoid precompiled headers with VC
Prerequisites:
- install winhttrack
- set the proper path in the project settings (especially for the httrack lib and dll)
To Build on Linux:
- install httrack
- link with libhttrack.so and compile using something like:
gcc example.c -I/usr/include/httrack -lhttrack
How to build: (callback.so or callback.dll)
With GNU-GCC:
gcc -I/usr/include/httrack -O -g3 -Wall -D_REENTRANT -o example example.c -lhttrack1
With MS-Visual C++:
cl -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.exe" callbacks-example.c wsock32.lib libhttrack.lib
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#endif
/* Standard httrack module includes */
#include "httrack-library.h"
#include "htsopt.h"
#include "htsdefines.h"
/* Local definitions */
#include "example.h"
/*
* Name: main
* Description: main() function
@@ -39,6 +42,8 @@ int main(void) {
char _argv[][256] = {"httrack_test" , "<URL>" , "-r3" , "--testscan" , "" };
char* argv[] = {NULL , NULL , NULL , NULL , NULL};
int argc = 0;
httrackp *opt;
int ret;
while(strlen(_argv[argc])) {
argv[argc]=_argv[argc];
argc++;
@@ -49,40 +54,7 @@ int main(void) {
scanf("%s",argv[1]);
printf("Test: 1 depth\n");
hts_init();
htswrap_add("init",httrack_wrapper_init);
htswrap_add("free",httrack_wrapper_uninit);
htswrap_add("start",httrack_wrapper_start);
htswrap_add("change-options",httrack_wrapper_chopt);
htswrap_add("end",httrack_wrapper_end);
htswrap_add("check-html",httrack_wrapper_checkhtml);
htswrap_add("loop",httrack_wrapper_loop);
htswrap_add("query",httrack_wrapper_query);
htswrap_add("query2",httrack_wrapper_query2);
htswrap_add("query3",httrack_wrapper_query3);
htswrap_add("check-link",httrack_wrapper_check);
htswrap_add("pause",httrack_wrapper_pause);
htswrap_add("save-file",httrack_wrapper_filesave);
htswrap_add("link-detected",httrack_wrapper_linkdetected);
htswrap_add("transfer-status",httrack_wrapper_xfrstatus);
/* Then, launch the mirror */
hts_main(argc,argv);
/* Wait for a key */
printf("\nPress ENTER key to exit\n");
scanf("%s",argv[1]);
/* That's all! */
return 0;
}
/* CALLBACK FUNCTIONS */
/* Initialize the Winsock */
void CDECL httrack_wrapper_init(void) {
printf("Engine started\n");
/* Initialize the library */
#ifdef _WIN32
{
WORD wVersionRequested; // requested version WinSock API
@@ -100,59 +72,130 @@ void CDECL httrack_wrapper_init(void) {
}
}
#endif
hts_init();
}
void CDECL httrack_wrapper_uninit(void) {
printf("Engine exited\n");
/* Create option settings and set callbacks (wrappers) */
opt = hts_create_opt();
CHAIN_FUNCTION(opt, init, httrack_wrapper_init, NULL);
CHAIN_FUNCTION(opt, uninit, httrack_wrapper_uninit, NULL);
CHAIN_FUNCTION(opt, start, httrack_wrapper_start, NULL);
CHAIN_FUNCTION(opt, end, httrack_wrapper_end, NULL);
CHAIN_FUNCTION(opt, chopt, httrack_wrapper_chopt, NULL);
CHAIN_FUNCTION(opt, preprocess, httrack_wrapper_preprocesshtml, NULL);
CHAIN_FUNCTION(opt, postprocess, httrack_wrapper_postprocesshtml, NULL);
CHAIN_FUNCTION(opt, check_html, httrack_wrapper_checkhtml, NULL);
CHAIN_FUNCTION(opt, query, httrack_wrapper_query, NULL);
CHAIN_FUNCTION(opt, query2, httrack_wrapper_query2, NULL);
CHAIN_FUNCTION(opt, query3, httrack_wrapper_query3, NULL);
CHAIN_FUNCTION(opt, loop, httrack_wrapper_loop, NULL);
CHAIN_FUNCTION(opt, check_link, httrack_wrapper_check, NULL);
CHAIN_FUNCTION(opt, check_mime, httrack_wrapper_check_mime, NULL);
CHAIN_FUNCTION(opt, pause, httrack_wrapper_pause, NULL);
CHAIN_FUNCTION(opt, filesave, httrack_wrapper_filesave, NULL);
CHAIN_FUNCTION(opt, filesave2, httrack_wrapper_filesave2, NULL);
CHAIN_FUNCTION(opt, linkdetected, httrack_wrapper_linkdetected, NULL);
CHAIN_FUNCTION(opt, linkdetected2, httrack_wrapper_linkdetected2, NULL);
CHAIN_FUNCTION(opt, xfrstatus, httrack_wrapper_xfrstatus, NULL);
CHAIN_FUNCTION(opt, savename, httrack_wrapper_savename, NULL);
CHAIN_FUNCTION(opt, sendhead, httrack_wrapper_sendheader, NULL);
CHAIN_FUNCTION(opt, receivehead, httrack_wrapper_receiveheader, NULL);
/* Then, launch the mirror */
ret = hts_main2(argc, argv, opt);
/* Wait for a key */
printf("\nPress ENTER key to exit\n");
scanf("%s",argv[1]);
/* Clear option state */
hts_free_opt(opt);
hts_uninit();
#ifdef _WIN32
WSACleanup();
#endif
/* That's all! */
return 0;
}
int CDECL httrack_wrapper_start(httrackp* opt) {
/* CALLBACK FUNCTIONS */
/* Initialize the Winsock */
static void CDECL httrack_wrapper_init(t_hts_callbackarg *carg) {
printf("Engine started\n");
}
static void CDECL httrack_wrapper_uninit(t_hts_callbackarg *carg) {
printf("Engine exited\n");
}
static int CDECL httrack_wrapper_start(t_hts_callbackarg *carg, httrackp* opt) {
printf("Start of mirror\n");
return 1;
}
int CDECL httrack_wrapper_chopt(httrackp* opt) {
return CDECL httrack_wrapper_start(opt);
static int CDECL httrack_wrapper_chopt(t_hts_callbackarg *carg, httrackp* opt) {
return 1;
}
int CDECL httrack_wrapper_end(void) {
static int CDECL httrack_wrapper_end(t_hts_callbackarg *carg, httrackp* opt) {
printf("End of mirror\n");
return 1;
}
int CDECL httrack_wrapper_checkhtml(char* html,int len,char* url_adresse,char* url_fichier) {
printf("Parsing html file: http://%s%s\n",url_adresse,url_fichier);
static int CDECL httrack_wrapper_checkhtml(t_hts_callbackarg *carg, httrackp *opt, char* html,int len,const char* url_address,const char* url_file) {
printf("Parsing html file: http://%s%s\n",url_address,url_file);
return 1;
}
int CDECL httrack_wrapper_loop(void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats) {
static int CDECL httrack_wrapper_loop(t_hts_callbackarg *carg, httrackp *opt, void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats) {
/* printf("..httrack_wrapper_loop called\n"); */
return 1;
}
char* CDECL httrack_wrapper_query(char* question) {
static const char* CDECL httrack_wrapper_query(t_hts_callbackarg *carg, httrackp *opt, const char* question) {
/* Answer is No */
return "N";
}
char* CDECL httrack_wrapper_query2(char* question) {
static const char* CDECL httrack_wrapper_query2(t_hts_callbackarg *carg, httrackp *opt, const char* question) {
/* Answer is No */
return "N";
}
char* CDECL httrack_wrapper_query3(char* question) {
static const char* CDECL httrack_wrapper_query3(t_hts_callbackarg *carg, httrackp *opt, const char* question) {
/* Answer is "" */
return "";
}
int CDECL httrack_wrapper_check(char* adr,char* fil,int status) {
static int CDECL httrack_wrapper_check(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,int status) {
printf("Link status tested: http://%s%s\n",adr,fil);
return -1;
}
void CDECL httrack_wrapper_pause(char* lockfile) {
static void CDECL httrack_wrapper_pause(t_hts_callbackarg *carg, httrackp *opt, const char* lockfile) {
/* Wait until lockfile is removed.. */
}
void CDECL httrack_wrapper_filesave(char* file) {
static void CDECL httrack_wrapper_filesave(t_hts_callbackarg *carg, httrackp *opt, const char* file) {
}
int CDECL httrack_wrapper_linkdetected(char* link) {
static int CDECL httrack_wrapper_linkdetected(t_hts_callbackarg *carg, httrackp *opt, char* link) {
printf("Link detected: %s\n",link);
return 1;
}
int CDECL httrack_wrapper_xfrstatus(void* back) {
static int CDECL httrack_wrapper_xfrstatus(t_hts_callbackarg *carg, httrackp *opt, void* back) {
return 1;
}
static int CDECL httrack_wrapper_preprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) {
return 1;
}
static int CDECL httrack_wrapper_postprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file) {
return 1;
}
static int CDECL httrack_wrapper_check_mime(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,const char* mime,int status) {
return -1;
}
static void CDECL httrack_wrapper_filesave2(t_hts_callbackarg *carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified,int not_updated) {
}
static int CDECL httrack_wrapper_linkdetected2(t_hts_callbackarg *carg, httrackp *opt, char* link, const char* start_tag) {
return 1;
}
static int CDECL httrack_wrapper_savename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete,const char* fil_complete,const char* referer_adr,const char* referer_fil,char* save) {
return 1;
}
static int CDECL httrack_wrapper_sendheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing) {
return 1;
}
static int CDECL httrack_wrapper_receiveheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming) {
return 1;
}

View File

@@ -1,95 +0,0 @@
# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=example - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "example.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "example - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "C:\Dev" /I "C:\Dev\IPv6Kit\inc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib libhttrack.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "example - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "C:\Dev\IPv6Kit\inc" /I "C:\Dev" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib libhttrack.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "example - Win32 Release"
# Name "example - Win32 Debug"
# Begin Source File
SOURCE=.\example.c
# End Source File
# Begin Source File
SOURCE=.\example.h
# End Source File
# End Target
# End Project

View File

@@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "example"=".\example.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -9,19 +9,26 @@
#define CDECL
#endif
void CDECL httrack_wrapper_init(void);
void CDECL httrack_wrapper_uninit(void);
int CDECL httrack_wrapper_start(httrackp* opt);
int CDECL httrack_wrapper_chopt(httrackp* opt);
int CDECL httrack_wrapper_end(void);
int CDECL httrack_wrapper_checkhtml(char* html,int len,char* url_adresse,char* url_fichier);
int CDECL httrack_wrapper_loop(void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats);
char* CDECL httrack_wrapper_query(char* question);
char* CDECL httrack_wrapper_query2(char* question);
char* CDECL httrack_wrapper_query3(char* question);
int CDECL httrack_wrapper_check(char* adr,char* fil,int status);
void CDECL httrack_wrapper_pause(char* lockfile);
void CDECL httrack_wrapper_filesave(char* file);
int CDECL httrack_wrapper_linkdetected(char* link);
int CDECL httrack_wrapper_xfrstatus(void* back);
static void CDECL httrack_wrapper_init(t_hts_callbackarg *carg);
static void CDECL httrack_wrapper_uninit(t_hts_callbackarg *carg);
static int CDECL httrack_wrapper_start(t_hts_callbackarg *carg, httrackp* opt);
static int CDECL httrack_wrapper_chopt(t_hts_callbackarg *carg, httrackp* opt);
static int CDECL httrack_wrapper_end(t_hts_callbackarg *carg, httrackp* opt);
static int CDECL httrack_wrapper_checkhtml(t_hts_callbackarg *carg, httrackp *opt, char* html,int len,const char* url_address,const char* url_file);
static int CDECL httrack_wrapper_loop(t_hts_callbackarg *carg, httrackp *opt, void* _back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats);
static const char* CDECL httrack_wrapper_query(t_hts_callbackarg *carg, httrackp *opt, const char* question);
static const char* CDECL httrack_wrapper_query2(t_hts_callbackarg *carg, httrackp *opt, const char* question);
static const char* CDECL httrack_wrapper_query3(t_hts_callbackarg *carg, httrackp *opt, const char* question);
static int CDECL httrack_wrapper_check(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,int status);
static void CDECL httrack_wrapper_pause(t_hts_callbackarg *carg, httrackp *opt, const char* lockfile);
static void CDECL httrack_wrapper_filesave(t_hts_callbackarg *carg, httrackp *opt, const char* file);
static int CDECL httrack_wrapper_linkdetected(t_hts_callbackarg *carg, httrackp *opt, char* link);
static int CDECL httrack_wrapper_xfrstatus(t_hts_callbackarg *carg, httrackp *opt, void* back);
static int CDECL httrack_wrapper_preprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file);
static int CDECL httrack_wrapper_postprocesshtml(t_hts_callbackarg *carg, httrackp *opt, char** html,int* len,const char* url_address,const char* url_file);
static int CDECL httrack_wrapper_check_mime(t_hts_callbackarg *carg, httrackp *opt, const char* adr,const char* fil,const char* mime,int status);
static void CDECL httrack_wrapper_filesave2(t_hts_callbackarg *carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified,int not_updated);
static int CDECL httrack_wrapper_linkdetected2(t_hts_callbackarg *carg, httrackp *opt, char* link, const char* start_tag);
static int CDECL httrack_wrapper_savename(t_hts_callbackarg *carg, httrackp *opt, const char* adr_complete,const char* fil_complete,const char* referer_adr,const char* referer_fil,char* save);
static int CDECL httrack_wrapper_sendheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing);
static int CDECL httrack_wrapper_receiveheader(t_hts_callbackarg *carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming);

View File

@@ -1,2 +0,0 @@
#define HTS_ANALYSTE 1

View File

@@ -32,3 +32,25 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
========================================================================
MAKEFILE PROJECT : libtest Project Overview
========================================================================
AppWizard has created this libtest project for you.
This file contains a summary of what you will find in each of the files that
make up your libtest project.
libtest.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
This project allows you to build/clean/rebuild from within Visual Studio by calling the commands you have input
in the wizard. The build command can be nmake or any other tool you use.
This project does not contain any files, so there are none displayed in Solution Explorer.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,13 +1,15 @@
.\" Process this file with
.\" groff -man -Tascii httrack.1
.\"
.TH httrack 1 "HTTrack version 3.40-2 (compiled Apr 9 2006)" "httrack website copier"
.TH httrack 1 "Jan 2007" "httrack website copier"
.SH NAME
httrack \- offline browser : copy websites to a local directory
.SH SYNOPSIS
.B httrack [ url ]... [ -filter ]... [ +filter ]... [
.B-O, --path
] [
.B -%O, --chroot
] [
.B -w, --mirror
] [
.B -W, --mirror-wizard
@@ -106,6 +108,8 @@ httrack \- offline browser : copy websites to a local directory
] [
.B -@iN, --protocol[=N]
] [
.B -%w, --disable-module
] [
.B -F, --user-agent
] [
.B -%R, --referer
@@ -208,6 +212,9 @@ mirror[,path
cache
and
logfiles]) (--path <param>)
.IP -%O
chroot path to, must be r00t (-%O root
path) (--chroot <param>)
.SS Action options:
.IP -w
@@ -309,7 +316,7 @@ accept cookies in cookies.txt (0=do not accept,* 1=accept) (--cookies[=N])
.IP -u
check document type if unknown (cgi,asp..) (u0 don t check, * u1 check but /, u2 check always) (--check-type[=N])
.IP -j
*parse Java Classes (j0 don t parse) (--parse-java[=N])
*parse Java Classes (j0 don t parse, bitmask: |1 parse default, |2 don t parse .class |4 don t parse .js |8 don t be aggressive) (--parse-java[=N])
.IP -sN
follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always, 3=always (even strict rules)) (--robots[=N])
.IP -%h
@@ -328,6 +335,8 @@ assume that a type (cgi,asp..) is always linked with a mime type (-%A php3,cgi=t
also be used to force a specific file type: --assume foo.cgi=text/html
.IP -@iN
internet protocol (0=both ipv6+ipv4, 4=ipv4 only, 6=ipv6 only) (--protocol[=N])
.IP -%w
disable a specific external mime module (-%w htsswf -%w htsjava) (--disable-module <param>)
.SS Browser ID:
.IP -F
@@ -415,7 +424,7 @@ type test (-#2 /foo/bar.php)
.IP -#C
cache list (-#C *.com/spider*.gif (--debug-cache <param>)
.IP -#R
cache repair (damaged cache) (--debug-oldftp)
cache repair (damaged cache) (--repair-cache)
.IP -#d
debug parser (--debug-parsing)
.IP -#E
@@ -435,7 +444,7 @@ display ugly progress information (--advanced-progressinfo)
.IP -#P
catch URL (--catch-url)
.IP -#R
old FTP routines (debug) (--debug-oldftp)
old FTP routines (debug) (--repair-cache)
.IP -#T
generate transfer ops. log every minutes (--debug-xfrstats)
.IP -#u
@@ -459,7 +468,7 @@ execute system command after each files ($0 is the filename: -V "rm \$0") (--use
.IP -%U
run the engine with another id when called as root (-%U smith) (--user <param>)
.IP -%W
use an external library function as a wrapper (-%W link-detected=foo.so:myfunction[,myparameters]) (--callback <param>)
use an external library function as a wrapper (-%W myfoo.so[,myparameters]) (--callback <param>)
.SS Details: Option N
.IP -N0
@@ -571,50 +580,7 @@ foo.cgi?q=45 -> foo4B54.html?q=45 (relative URI, default)
force http/1.0 requests (-%h)
.SS Details: Option %W: External callbacks prototypes
.SS init : void (* myfunction)(void);
.SS free : void (* myfunction)(void);
.SS start : int (* myfunction)(httrackp* opt);
.SS end : int (* myfunction)(void);
.SS change-options : int (* myfunction)(httrackp* opt);
.SS preprocess-html : int (* myfunction)(char** html,int* len,char* url
adresse,char* url
fichier);
.SS postprocess-html : int (* myfunction)(char** html,int* len,char* url
adresse,char* url
fichier);
.SS check-html : int (* myfunction)(char* html,int len,char* url
adresse,char* url
fichier);
.SS query : char* (* myfunction)(char* question);
.SS query2 : char* (* myfunction)(char* question);
.SS query3 : char* (* myfunction)(char* question);
.SS loop : int (* myfunction)(lien
back* back,int back
max,int back
index,int lien
tot,int lien
ntot,int stat
time,hts
stat
struct* stats);
.SS check-link : int (* myfunction)(char* adr,char* fil,int status);
.SS pause : void (* myfunction)(char* lockfile);
.SS save-file : void (* myfunction)(char* file);
.SS save-file2 : void (* myfunction)(char* hostname,char* filename,char* localfile,int is
new,int is
modified);
.SS link-detected : int (* myfunction)(char* link);
.SS link-detected2 : int (* myfunction)(char* link, char* start
tag);
.SS transfer-status : int (* myfunction)(lien
back* back);
.SS save-name : int (* myfunction)(char* adr
complete,char* fil
complete,char* referer
adr,char* referer
fil,char* save);
.SS And <wrappername>
init() functions if defined, called upon plug
.SS see htsdefines.h
.SH FILES
.I /etc/httrack.conf
.RS

View File

@@ -1,16 +1,17 @@
#SUBDIRS = swf
DevIncludesdir = $(includedir)/httrack
DevIncludes_DATA = httrack-library.h \
DevIncludes_DATA = \
httrack-library.h \
htsglobal.h \
htsopt.h \
htswrap.h \
htssystem.h \
htsconfig.h \
../config.h \
htsmodules.h \
htsbasenet.h \
htsbauth.h
htsbauth.h \
htsdefines.h
INCLUDES = \
@DEFAULT_CFLAGS@ \
@@ -29,7 +30,7 @@ htsserver_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
proxytrack_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS)
proxytrack_CFLAGS = $(AM_CFLAGS) -DNO_MALLOCT
lib_LTLIBRARIES = libhttrack.la
lib_LTLIBRARIES = libhttrack.la libhtsjava.la
htsserver_SOURCES = htsserver.c htsserver.h htsweb.c htsweb.h
proxytrack_SOURCES = proxy/main.c \
@@ -42,10 +43,10 @@ whttrackrun_SCRIPTS = webhttrack
libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
htscatchurl.c htsfilters.c htsftp.c htshash.c htsinthash.c \
htshelp.c htsjava.c htslib.c htscoremain.c \
htshelp.c htslib.c htscoremain.c \
htsname.c htsrobots.c htstools.c htswizard.c \
htsalias.c htsthread.c htsindex.c htsbauth.c \
htsmd5.c htszlib.c htsnostatic.c htswrap.c \
htsmd5.c htszlib.c htswrap.c \
htsmodules.c \
md5.c \
htsmms.c \
@@ -55,22 +56,23 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
htsbasenet.h htsbauth.h htscache.h htscatchurl.h \
htsconfig.h htscore.h htsparse.h htscoremain.h htsdefines.h \
htsfilters.h htsftp.h htsglobal.h htshash.h htsinthash.h \
htshelp.h htsindex.h htsjava.h htslib.h htsmd5.h \
htsmodules.h htsname.h htsnet.h htsnostatic.h \
htsopt.h htsrobots.h htssystem.h htsthread.h \
htshelp.h htsindex.h htslib.h htsmd5.h \
htsmodules.h htsname.h htsnet.h \
htsopt.h htsrobots.h htsthread.h \
htstools.h htswizard.h htswrap.h htszlib.h \
htsstrings.h httrack-library.h \
md5.h \
htsmms.h \
minizip/crypt.h minizip/ioapi.h minizip/mztools.h minizip/unzip.h minizip/zip.h \
mmsrip/error.h mmsrip/mms.h
libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(DL_LIBS) $(SOCKET_LIBS)
libhttrack_la_LDFLAGS = -version-info $(VERSION_INFO)
libhtsjava_la_SOURCES = htsjava.c htsjava.h
libhtsjava_la_LIBADD = $(THREADS_LIBS) $(DL_LIBS)
libhtsjava_la_LDFLAGS = -version-info $(VERSION_INFO)
EXTRA_DIST = httrack.h webhttrack \
httrack.dsp httrack.dsw \
webhttrack.dsp webhttrack.dsw \
minizip/ChangeLogUnzip \
minizip/iowin32.c \
minizip/iowin32.h \
@@ -86,4 +88,5 @@ EXTRA_DIST = httrack.h webhttrack \
proxy/changelog.txt \
proxy/proxystrings.h \
proxy/proxytrack.h \
proxy/store.h
proxy/store.h \
*.dsw *.dsp *.vcproj

View File

@@ -144,16 +144,17 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
DevIncludesdir = $(includedir)/httrack
DevIncludes_DATA = httrack-library.h \
DevIncludes_DATA = \
httrack-library.h \
htsglobal.h \
htsopt.h \
htswrap.h \
htssystem.h \
htsconfig.h \
../config.h \
htsmodules.h \
htsbasenet.h \
htsbauth.h
htsbauth.h \
htsdefines.h
INCLUDES = \
@@ -174,7 +175,7 @@ htsserver_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS) -lhttrack
proxytrack_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS)
proxytrack_CFLAGS = $(AM_CFLAGS) -DNO_MALLOCT
lib_LTLIBRARIES = libhttrack.la
lib_LTLIBRARIES = libhttrack.la libhtsjava.la
htsserver_SOURCES = htsserver.c htsserver.h htsweb.c htsweb.h
proxytrack_SOURCES = proxy/main.c \
@@ -188,10 +189,10 @@ whttrackrun_SCRIPTS = webhttrack
libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
htscatchurl.c htsfilters.c htsftp.c htshash.c htsinthash.c \
htshelp.c htsjava.c htslib.c htscoremain.c \
htshelp.c htslib.c htscoremain.c \
htsname.c htsrobots.c htstools.c htswizard.c \
htsalias.c htsthread.c htsindex.c htsbauth.c \
htsmd5.c htszlib.c htsnostatic.c htswrap.c \
htsmd5.c htszlib.c htswrap.c \
htsmodules.c \
md5.c \
htsmms.c \
@@ -201,9 +202,9 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
htsbasenet.h htsbauth.h htscache.h htscatchurl.h \
htsconfig.h htscore.h htsparse.h htscoremain.h htsdefines.h \
htsfilters.h htsftp.h htsglobal.h htshash.h htsinthash.h \
htshelp.h htsindex.h htsjava.h htslib.h htsmd5.h \
htsmodules.h htsname.h htsnet.h htsnostatic.h \
htsopt.h htsrobots.h htssystem.h htsthread.h \
htshelp.h htsindex.h htslib.h htsmd5.h \
htsmodules.h htsname.h htsnet.h \
htsopt.h htsrobots.h htsthread.h \
htstools.h htswizard.h htswrap.h htszlib.h \
htsstrings.h httrack-library.h \
md5.h \
@@ -211,13 +212,14 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
minizip/crypt.h minizip/ioapi.h minizip/mztools.h minizip/unzip.h minizip/zip.h \
mmsrip/error.h mmsrip/mms.h
libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(DL_LIBS) $(SOCKET_LIBS)
libhttrack_la_LDFLAGS = -version-info $(VERSION_INFO)
libhtsjava_la_SOURCES = htsjava.c htsjava.h
libhtsjava_la_LIBADD = $(THREADS_LIBS) $(DL_LIBS)
libhtsjava_la_LDFLAGS = -version-info $(VERSION_INFO)
EXTRA_DIST = httrack.h webhttrack \
httrack.dsp httrack.dsw \
webhttrack.dsp webhttrack.dsw \
minizip/ChangeLogUnzip \
minizip/iowin32.c \
minizip/iowin32.h \
@@ -233,7 +235,8 @@ EXTRA_DIST = httrack.h webhttrack \
proxy/changelog.txt \
proxy/proxystrings.h \
proxy/proxytrack.h \
proxy/store.h
proxy/store.h \
*.dsw *.dsp *.vcproj
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -242,14 +245,17 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(lib_LTLIBRARIES)
libhtsjava_la_DEPENDENCIES =
am_libhtsjava_la_OBJECTS = htsjava.lo
libhtsjava_la_OBJECTS = $(am_libhtsjava_la_OBJECTS)
libhttrack_la_DEPENDENCIES =
am_libhttrack_la_OBJECTS = htscore.lo htsparse.lo htsback.lo htscache.lo \
htscatchurl.lo htsfilters.lo htsftp.lo htshash.lo htsinthash.lo \
htshelp.lo htsjava.lo htslib.lo htscoremain.lo htsname.lo \
htsrobots.lo htstools.lo htswizard.lo htsalias.lo htsthread.lo \
htsindex.lo htsbauth.lo htsmd5.lo htszlib.lo htsnostatic.lo \
htswrap.lo htsmodules.lo md5.lo htsmms.lo ioapi.lo mztools.lo \
unzip.lo zip.lo error.lo mms.lo
htshelp.lo htslib.lo htscoremain.lo htsname.lo htsrobots.lo \
htstools.lo htswizard.lo htsalias.lo htsthread.lo htsindex.lo \
htsbauth.lo htsmd5.lo htszlib.lo htswrap.lo htsmodules.lo \
md5.lo htsmms.lo ioapi.lo mztools.lo unzip.lo zip.lo error.lo \
mms.lo
libhttrack_la_OBJECTS = $(am_libhttrack_la_OBJECTS)
bin_PROGRAMS = proxytrack$(EXEEXT) httrack$(EXEEXT) htsserver$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
@@ -288,7 +294,6 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/htsjava.Plo ./$(DEPDIR)/htslib.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/htsmd5.Plo ./$(DEPDIR)/htsmms.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/htsmodules.Plo ./$(DEPDIR)/htsname.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/htsnostatic.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/htsparse.Plo ./$(DEPDIR)/htsrobots.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/htsserver.Po ./$(DEPDIR)/htsthread.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/htstools.Plo ./$(DEPDIR)/htsweb.Po \
@@ -314,12 +319,12 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libhttrack_la_SOURCES) $(htsserver_SOURCES) httrack.c \
$(proxytrack_SOURCES)
DIST_SOURCES = $(libhtsjava_la_SOURCES) $(libhttrack_la_SOURCES) \
$(htsserver_SOURCES) httrack.c $(proxytrack_SOURCES)
DATA = $(DevIncludes_DATA)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libhttrack_la_SOURCES) $(htsserver_SOURCES) httrack.c $(proxytrack_SOURCES)
SOURCES = $(libhtsjava_la_SOURCES) $(libhttrack_la_SOURCES) $(htsserver_SOURCES) httrack.c $(proxytrack_SOURCES)
all: all-am
@@ -358,6 +363,8 @@ clean-libLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libhtsjava.la: $(libhtsjava_la_OBJECTS) $(libhtsjava_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libhtsjava_la_LDFLAGS) $(libhtsjava_la_OBJECTS) $(libhtsjava_la_LIBADD) $(LIBS)
libhttrack.la: $(libhttrack_la_OBJECTS) $(libhttrack_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libhttrack_la_LDFLAGS) $(libhttrack_la_OBJECTS) $(libhttrack_la_LIBADD) $(LIBS)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
@@ -445,7 +452,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsmms.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsmodules.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsname.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsnostatic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsparse.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsrobots.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsserver.Po@am__quote@

View File

@@ -174,7 +174,7 @@ regen:
" <BR>"LF\
" <BR>"LF\
" <H6 ALIGN=\"RIGHT\">"LF\
" <I>Mirror and index made by HTTrack Website Copier [XR&amp;CO'2006]</I>"LF\
" <I>Mirror and index made by HTTrack Website Copier [XR&amp;CO'2007]</I>"LF\
" </H6>"LF\
" %s"LF\
" <!-- Thanks for using HTTrack Website Copier! -->"LF\
@@ -193,7 +193,7 @@ regen:
""LF\
"<table width=\"76%%\" border=\"0\" align=\"center\" valign=\"bottom\" cellspacing=\"0\" cellpadding=\"0\">"LF\
" <tr>"LF\
" <td id=\"footer\"><small>&copy; 2006 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" <td id=\"footer\"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" </tr>"LF\
"</table>"LF\
""LF\
@@ -324,7 +324,7 @@ regen:
" </TABLE>"LF\
" <BR>"LF\
" <H6 ALIGN=\"RIGHT\">"LF\
" <I>Mirror and index made by HTTrack Website Copier [XR&CO'2006]</I>"LF\
" <I>Mirror and index made by HTTrack Website Copier [XR&CO'2007]</I>"LF\
" </H6>"LF\
" %s"LF\
" <!-- Thanks for using HTTrack Website Copier! -->"LF\
@@ -342,7 +342,7 @@ regen:
""LF\
"<table width=\"76%%\" border=\"0\" align=\"center\" valign=\"bottom\" cellspacing=\"0\" cellpadding=\"0\">"LF\
" <tr>"LF\
" <td id=\"footer\"><small>&copy; 2006 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" <td id=\"footer\"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" </tr>"LF\
"</table>"LF\
""LF\
@@ -483,7 +483,7 @@ regen:
""LF\
"<table width=\"76%%\" height=\"100%%\" border=\"0\" align=\"center\" valign=\"bottom\" cellspacing=\"0\" cellpadding=\"0\">"LF\
" <tr>"LF\
" <td id=\"footer\"><small>&copy; 2006 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" <td id=\"footer\"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" </tr>"LF\
"</table>"LF\
""LF\
@@ -620,7 +620,7 @@ regen:
""LF\
"<table width=\"76%%\" height=\"100%%\" border=\"0\" align=\"center\" valign=\"bottom\" cellspacing=\"0\" cellpadding=\"0\">"LF\
" <tr>"LF\
" <td id=\"footer\"><small>&copy; 2006 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" <td id=\"footer\"><small>&copy; 2007 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
" </tr>"LF\
"</table>"LF\
""LF\

View File

@@ -66,7 +66,7 @@ void hts_lowcase(char* s);
} \
argv[0]=(buff+ptr); \
strcpybuff(argv[0],token); \
ptr += (strlen(argv[0])+1); \
ptr += (int) (strlen(argv[0])+1); \
argc++
// END OF COPY OF cmdl_ins in htsmain.c
@@ -172,6 +172,7 @@ const char* hts_optalias[][4] = {
{"display","-%v","single","show files transfered and other funny realtime information"},
{"dos83","-L0","single",""},
{"iso9660","-L2","single",""},
{"disable-module","-%w","param1",""},
/* */
/* DEPRECATED */
@@ -193,7 +194,7 @@ const char* hts_optalias[][4] = {
{"advanced-maxlinks","-#L","single",""},
{"advanced-progressinfo","-#p","single","deprecated"},
{"catch-url","-#P","single","catch complex URL through proxy"},
{"debug-oldftp","-#R","single",""},
/*{"debug-oldftp","-#R","single",""},*/
{"debug-xfrstats","-#T","single",""},
{"advanced-wait","-#u","single",""},
{"debug-ratestats","-#Z","single",""},
@@ -544,11 +545,11 @@ char* hts_gethome(void) {
}
/* Convert ~/foo into /home/smith/foo */
void expand_home(char* str) {
if (str[0] == '~') {
void expand_home(String *str) {
if (StringSub(*str, 1) == '~') {
char BIGSTK tempo[HTS_URLMAXSIZE*2];
strcpybuff(tempo,hts_gethome());
strcatbuff(tempo,str+1);
strcpybuff(str,tempo);
strcpybuff(tempo, hts_gethome());
strcatbuff(tempo, StringBuff(*str) + 1);
StringCopy(*str, tempo);
}
}

View File

@@ -55,7 +55,7 @@ const char* optalias_value(int p);
const char* opttype_value(int p);
const char* opthelp_value(int p);
char* hts_gethome(void);
void expand_home(char* str);
void expand_home(String *str);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -39,19 +39,34 @@ Please visit our Website: http://www.httrack.com
#define HTSBACK_DEFH
#include "htsglobal.h"
#include "htsbasenet.h"
#include "htscore.h"
typedef enum BackStatusCode {
STATUSCODE_INVALID = -1,
STATUSCODE_TIMEOUT = -2,
STATUSCODE_SLOW = -3,
STATUSCODE_CONNERROR = -4,
STATUSCODE_NON_FATAL = -5,
STATUSCODE_SSL_HANDSHAKE = -6,
STATUSCODE_TOO_BIG = -7,
STATUSCODE_TEST_OK = -10
} BackStatusCode;
#if HTS_XGETHOST
#if USE_BEGINTHREAD
#include "htsthread.h"
#endif
#endif
/* Forward definitions */
#ifndef HTS_DEF_FWSTRUCT_httrackp
#define HTS_DEF_FWSTRUCT_httrackp
typedef struct httrackp httrackp;
#endif
#ifndef HTS_DEF_FWSTRUCT_struct_back
#define HTS_DEF_FWSTRUCT_struct_back
typedef struct struct_back struct_back;
#endif
#ifndef HTS_DEF_FWSTRUCT_cache_back
#define HTS_DEF_FWSTRUCT_cache_back
typedef struct cache_back cache_back;
#endif
#ifndef HTS_DEF_FWSTRUCT_lien_back
#define HTS_DEF_FWSTRUCT_lien_back
typedef struct lien_back lien_back;
#endif
#ifndef HTS_DEF_FWSTRUCT_htsblk
#define HTS_DEF_FWSTRUCT_htsblk
typedef struct htsblk htsblk;
#endif
/* Library internal definictions */
#ifdef HTS_INTERNAL_BYTECODE
@@ -63,17 +78,17 @@ void back_free(struct_back** sback);
// backing
#define BACK_ADD_TEST "(dummy)"
#define BACK_ADD_TEST2 "(dummy2)"
int back_index(struct_back* sback,char* adr,char* fil,char* sav);
int back_index(httrackp* opt, struct_back* sback,char* adr,char* fil,char* sav);
int back_available(struct_back* sback);
LLint back_incache(struct_back* sback);
int back_done_incache(struct_back* sback);
HTS_INLINE int back_exist(struct_back* sback,char* adr,char* fil,char* sav);
HTS_INLINE int back_exist(struct_back* sback,httrackp* opt,char* adr,char* fil,char* sav);
int back_nsoc(struct_back* sback);
int back_nsoc_overall(struct_back* sback);
int back_add(struct_back* sback,httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* referer_adr,char* referer_fil,int test,int* pass2_ptr);
int back_add_if_not_exists(struct_back* sback,httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* referer_adr,char* referer_fil,int test,int* pass2_ptr);
int back_add(struct_back* sback,httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* referer_adr,char* referer_fil,int test);
int back_add_if_not_exists(struct_back* sback,httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* referer_adr,char* referer_fil,int test);
int back_stack_available(struct_back* sback);
int back_search(httrackp* opt, cache_back* cache, struct_back* sback);
int back_search(httrackp* opt, struct_back* sback);
int back_search_quick(struct_back* sback);
void back_clean(httrackp* opt,cache_back* cache,struct_back* sback);
int back_cleanup_background(httrackp* opt,cache_back* cache,struct_back* sback);
@@ -83,10 +98,15 @@ int back_searchlive(httrackp* opt, struct_back* sback, char* search_addr);
void back_connxfr(htsblk* src, htsblk* dst);
void back_move(lien_back* src, lien_back* dst);
void back_copy_static(const lien_back* src, lien_back* dst);
int back_serialize(FILE *fp, const lien_back* src);
int back_unserialize(FILE *fp, lien_back** dst);
void back_set_finished(struct_back* sback, int p);
void back_set_locked(struct_back* sback, int p);
void back_set_unlocked(struct_back* sback, int p);
int back_delete(httrackp* opt,cache_back* cache,struct_back* sback,int p);
void back_index_unlock(struct_back* sback, int p);
int back_clear_entry(lien_back* back);
int back_flush_output(httrackp* opt, cache_back* cache, struct_back* sback, int p);
int back_set_passe2_ptr(httrackp* opt, cache_back* cache, struct_back* sback, int p, int* pass2_ptr);
void back_delete_all(httrackp* opt, cache_back* cache, struct_back* sback);
int back_maydelete(httrackp* opt, cache_back* cache, struct_back* sback, int p);
void back_maydeletehttp(httrackp* opt, cache_back* cache, struct_back* sback, int p);
@@ -97,15 +117,15 @@ void back_infostr(struct_back* sback,int i,int j,char* s);
LLint back_transfered(LLint add,struct_back* sback);
// hostback
#if HTS_XGETHOST
void back_solve(lien_back* sback);
int host_wait(lien_back* sback);
void back_solve(httrackp *opt,lien_back* sback);
int host_wait(httrackp *opt, lien_back* sback);
#endif
int back_checksize(httrackp* opt,lien_back* eback,int check_only_totalsize);
int back_checkmirror(httrackp* opt);
#if HTS_XGETHOST
#if USE_BEGINTHREAD
PTHREAD_TYPE PTHREAD_TYPE_FNC Hostlookup(void* iadr_p);
void Hostlookup(void* iadr_p);
#endif
#endif

View File

@@ -43,6 +43,7 @@ extern "C" {
#endif
#include "htsglobal.h"
#include "htsstrings.h"
#include <string.h>
#include <time.h>
@@ -50,7 +51,7 @@ extern "C" {
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#if ( defined(_WIN32) ||defined(HAVE_SYS_TYPES_H) )
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
@@ -60,16 +61,25 @@ extern "C" {
#include <dlfcn.h>
#endif
#ifndef _WIN32
#include <errno.h>
#endif
#if HTS_WIN
#ifdef _WIN32
#else
#include <fcntl.h>
#endif
#include <assert.h>
/* GCC extension */
#ifndef HTS_UNUSED
#ifdef __GNUC__
#define HTS_UNUSED __attribute__ ((unused))
#define HTS_STATIC static __attribute__ ((unused))
#else
#define HTS_UNUSED
#define HTS_STATIC static
#endif
#endif
#undef min
#undef max
#define min(a,b) ((a)>(b)?(b):(a))
@@ -149,6 +159,35 @@ extern HTSEXT_API t_abortLog abortLog__;
} \
} while(0)
/* logging */
typedef enum {
LOG_DEBUG,
LOG_INFO,
LOG_WARNING,
LOG_ERROR,
LOG_PANIC
} HTS_LogType;
#define HTS_LOG(OPT,TYPE) do { \
int last_errno = errno; \
switch(TYPE) { \
case LOG_DEBUG: \
fspc(OPT,(OPT)->log, "debug"); \
break; \
case LOG_INFO: \
fspc(OPT,(OPT)->log, "info"); \
break; \
case LOG_WARNING: \
fspc(OPT,(OPT)->log, "warning"); \
break; \
case LOG_ERROR: \
fspc(OPT,(OPT)->log, "error"); \
break; \
case LOG_PANIC: \
fspc(OPT,(OPT)->log, "panic"); \
break; \
} \
errno = last_errno; \
} while(0)
/* regular malloc's() */
#ifndef HTS_TRACE_MALLOC
@@ -194,6 +233,7 @@ extern HTSEXT_API int htsMemoryFastXfr;
/*
*/
#define stringdup()
#ifdef STRDEBUG

View File

@@ -31,14 +31,14 @@ Please visit our Website: http://www.httrack.com
/* ------------------------------------------------------------ */
/* File: Basic net definitions */
/* Used in .c and .h files that needs T_SOC and so */
/* Used in .c and .h files that needs hostent and so */
/* Author: Xavier Roche */
/* ------------------------------------------------------------ */
#ifndef HTS_DEFBASENETH
#define HTS_DEFBASENETH
#if HTS_WIN
#ifdef _WIN32
#if HTS_INET6==0
#include <winsock2.h>
@@ -57,13 +57,11 @@ Please visit our Website: http://www.httrack.com
#endif
typedef SOCKET T_SOC;
typedef struct hostent FAR t_hostent;
typedef struct hostent FAR t_hostent;
#else
#define HTS_USESCOPEID
#define INVALID_SOCKET -1
typedef int T_SOC;
typedef struct hostent t_hostent;
#endif
@@ -178,4 +176,76 @@ extern SSL_CTX *openssl_ctx;
#endif
#endif
/** RFC2616 status-codes ('statuscode' member of htsblk) **/
typedef enum HTTPStatusCode {
HTTP_CONTINUE = 100,
HTTP_SWITCHING_PROTOCOLS = 101,
HTTP_OK = 200,
HTTP_CREATED = 201,
HTTP_ACCEPTED = 202,
HTTP_NON_AUTHORITATIVE_INFORMATION = 203,
HTTP_NO_CONTENT = 204,
HTTP_RESET_CONTENT = 205,
HTTP_PARTIAL_CONTENT = 206,
HTTP_MULTIPLE_CHOICES = 300,
HTTP_MOVED_PERMANENTLY = 301,
HTTP_FOUND = 302,
HTTP_SEE_OTHER = 303,
HTTP_NOT_MODIFIED = 304,
HTTP_USE_PROXY = 305,
HTTP_TEMPORARY_REDIRECT = 307,
HTTP_BAD_REQUEST = 400,
HTTP_UNAUTHORIZED = 401,
HTTP_PAYMENT_REQUIRED = 402,
HTTP_FORBIDDEN = 403,
HTTP_NOT_FOUND = 404,
HTTP_METHOD_NOT_ALLOWED = 405,
HTTP_NOT_ACCEPTABLE = 406,
HTTP_PROXY_AUTHENTICATION_REQUIRED = 407,
HTTP_REQUEST_TIME_OUT = 408,
HTTP_CONFLICT = 409,
HTTP_GONE = 410,
HTTP_LENGTH_REQUIRED = 411,
HTTP_PRECONDITION_FAILED = 412,
HTTP_REQUEST_ENTITY_TOO_LARGE = 413,
HTTP_REQUEST_URI_TOO_LARGE = 414,
HTTP_UNSUPPORTED_MEDIA_TYPE = 415,
HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
HTTP_EXPECTATION_FAILED = 417,
HTTP_INTERNAL_SERVER_ERROR = 500,
HTTP_NOT_IMPLEMENTED = 501,
HTTP_BAD_GATEWAY = 502,
HTTP_SERVICE_UNAVAILABLE = 503,
HTTP_GATEWAY_TIME_OUT = 504,
HTTP_HTTP_VERSION_NOT_SUPPORTED = 505
} HTTPStatusCode;
/** Internal HTTrack status-codes ('statuscode' member of htsblk) **/
typedef enum BackStatusCode {
STATUSCODE_INVALID = -1,
STATUSCODE_TIMEOUT = -2,
STATUSCODE_SLOW = -3,
STATUSCODE_CONNERROR = -4,
STATUSCODE_NON_FATAL = -5,
STATUSCODE_SSL_HANDSHAKE = -6,
STATUSCODE_TOO_BIG = -7,
STATUSCODE_TEST_OK = -10
} BackStatusCode;
/** HTTrack status ('status' member of of 'lien_back') **/
typedef enum HTTrackStatus {
STATUS_ALIVE = -103,
STATUS_FREE = -1,
STATUS_READY = 0,
STATUS_TRANSFER = 1,
STATUS_CHUNK_CR = 97,
STATUS_CHUNK_WAIT = 98,
STATUS_WAIT_HEADERS = 99,
STATUS_CONNECTING = 100,
STATUS_WAIT_DNS = 101,
STATUS_SSL_WAIT_HANDSHAKE = 102,
STATUS_FTP_TRANSFER = 1000,
STATUS_FTP_READY = 1001
} HTTrackStatus;
#endif

View File

@@ -44,14 +44,13 @@ Please visit our Website: http://www.httrack.com
#include "htsglobal.h"
#include "htslib.h"
#include "htsnostatic.h"
/* END specific definitions */
// gestion des cookie
// ajoute, dans l'ordre
// !=0 : erreur
int cookie_add(t_cookie* cookie,char* cook_name,char* cook_value,char* domain,char* path) {
char buffer[8192];
char* a=cookie->data;
char* insert;
char cook[16384];
@@ -72,7 +71,7 @@ int cookie_add(t_cookie* cookie,char* cook_name,char* cook_value,char* domain,ch
insert=a; // insérer ici
while (*a) {
if ( strlen(cookie_get(a,2)) < strlen(path) ) // long. path (le + long est prioritaire)
if ( strlen(cookie_get(buffer, a,2)) < strlen(path) ) // long. path (le + long est prioritaire)
a=cookie->data+strlen(cookie->data); // fin
else {
a=strchr(a,'\n'); // prochain champ
@@ -127,20 +126,21 @@ int cookie_del(t_cookie* cookie,char* cook_name,char* domain,char* path) {
// path est aligné à droite et cook_name peut être vide (chercher alors tout cookie)
// .doubleclick.net TRUE / FALSE 1999999999 id A
char* cookie_find(char* s,char* cook_name,char* domain,char* path) {
char buffer[8192];
char* a=s;
while (*a) {
int t;
if (strnotempty(cook_name)==0)
t=1; // accepter par défaut
else
t=( strcmp(cookie_get(a,5),cook_name)==0 ); // tester si même nom
t=( strcmp(cookie_get(buffer, a,5),cook_name)==0 ); // tester si même nom
if (t) { // même nom ou nom qualconque
//
char* chk_dom=cookie_get(a,0); // domaine concerné par le cookie
char* chk_dom=cookie_get(buffer,a,0); // domaine concerné par le cookie
if ((int) strlen(chk_dom) <= (int) strlen(domain)) {
if ( strcmp(chk_dom,domain+strlen(domain)-strlen(chk_dom))==0 ) { // même domaine
//
char* chk_path=cookie_get(a,2); // chemin concerné par le cookie
char* chk_path=cookie_get(buffer,a,2); // chemin concerné par le cookie
if ((int) strlen(chk_path) <= (int) strlen(path)) {
if (strncmp(path,chk_path,strlen(chk_path))==0 ) { // même chemin
return a;
@@ -169,11 +169,13 @@ char* cookie_nextfield(char* a) {
// lire cookies.txt
// lire également (Windows seulement) les *@*.txt (cookies IE copiés)
// !=0 : erreur
int cookie_load(t_cookie* cookie,char* fpath,char* name) {
int cookie_load(t_cookie* cookie, const char* fpath, const char* name) {
char catbuff[CATBUFF_SIZE];
char buffer[8192];
// cookie->data[0]='\0';
// Fusionner d'abord les éventuels cookies IE
#if HTS_WIN
#ifdef _WIN32
{
WIN32_FIND_DATAA find;
HANDLE h;
@@ -185,7 +187,7 @@ int cookie_load(t_cookie* cookie,char* fpath,char* name) {
do {
if (!(find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ))
if (!(find.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM )) {
FILE* fp=fopen(fconcat(fpath,find.cFileName),"rb");
FILE* fp=fopen(fconcat(catbuff, fpath, find.cFileName),"rb");
if (fp) {
char cook_name[256];
char cook_value[1000];
@@ -223,7 +225,7 @@ int cookie_load(t_cookie* cookie,char* fpath,char* name) {
}
fclose(fp);
if (cookie_merged)
remove(fconcat(fpath,find.cFileName));
remove(fconcat(catbuff,fpath,find.cFileName));
} // if fp
}
} while(FindNextFileA(h,&find));
@@ -234,7 +236,7 @@ int cookie_load(t_cookie* cookie,char* fpath,char* name) {
// Ensuite, cookies.txt
{
FILE* fp = fopen(fconcat(fpath,name),"rb");
FILE* fp = fopen(fconcat(catbuff, fpath, name),"rb");
if (fp) {
char BIGSTK line[8192];
while( (!feof(fp)) && (((int) strlen(cookie->data)) < cookie->max_len)) {
@@ -246,10 +248,10 @@ int cookie_load(t_cookie* cookie,char* fpath,char* name) {
char path[256]; // chemin (/)
char cook_name[256]; // nom cookie (MYCOOK)
char BIGSTK cook_value[8192]; // valeur (ID=toto,S=1234)
strcpybuff(domain,cookie_get(line,0)); // host
strcpybuff(path,cookie_get(line,2)); // path
strcpybuff(cook_name,cookie_get(line,5)); // name
strcpybuff(cook_value,cookie_get(line,6)); // value
strcpybuff(domain,cookie_get(buffer,line,0)); // host
strcpybuff(path,cookie_get(buffer,line,2)); // path
strcpybuff(cook_name,cookie_get(buffer,line,5)); // name
strcpybuff(cook_value,cookie_get(buffer,line,6)); // value
#if DEBUG_COOK
printf("%s\n",line);
#endif
@@ -268,9 +270,10 @@ int cookie_load(t_cookie* cookie,char* fpath,char* name) {
// écrire cookies.txt
// !=0 : erreur
int cookie_save(t_cookie* cookie,char* name) {
char catbuff[CATBUFF_SIZE];
if (strnotempty(cookie->data)) {
char BIGSTK line[8192];
FILE* fp = fopen(fconv(name),"wb");
FILE* fp = fopen(fconv(catbuff,name),"wb");
if (fp) {
char* a=cookie->data;
fprintf(fp,"# HTTrack Website Copier Cookie File"LF"# This file format is compatible with Netscape cookies"LF);
@@ -318,11 +321,8 @@ void cookie_delete(char* s,int pos) {
// renvoie champ param de la chaine cookie_base
// ex: cookie_get("ceci est<tab>un<tab>exemple",1) renvoi "un"
char* cookie_get(char* cookie_base,int param) {
char* buffer;
//
char* cookie_get(char *buffer,char* cookie_base,int param) {
char * limit;
NOSTATIC_RESERVE(buffer, char, 8192);
while(*cookie_base=='\n') cookie_base++;
limit = strchr(cookie_base,'\n');
@@ -359,10 +359,11 @@ char* cookie_get(char* cookie_base,int param) {
/* déclarer un répertoire comme possédant une authentification propre */
int bauth_add(t_cookie* cookie,char* adr,char* fil,char* auth) {
if (cookie) {
char buffer[HTS_URLMAXSIZE*2];
if (cookie) {
if (!bauth_check(cookie,adr,fil)) { // n'existe pas déja
bauth_chain* chain=&cookie->auth;
char* prefix=bauth_prefix(adr,fil);
char* prefix=bauth_prefix(buffer,adr,fil);
/* fin de la chaine */
while(chain->next)
chain=chain->next;
@@ -382,9 +383,10 @@ int bauth_add(t_cookie* cookie,char* adr,char* fil,char* auth) {
/* tester adr et fil, et retourner authentification si nécessaire */
/* sinon, retourne NULL */
char* bauth_check(t_cookie* cookie,char* adr,char* fil) {
char buffer[HTS_URLMAXSIZE*2];
if (cookie) {
bauth_chain* chain=&cookie->auth;
char* prefix=bauth_prefix(adr,fil);
char* prefix=bauth_prefix(buffer,adr,fil);
while(chain) {
if (strnotempty(chain->prefix)) {
if (strncmp(prefix,chain->prefix,strlen(chain->prefix))==0) {
@@ -397,10 +399,8 @@ char* bauth_check(t_cookie* cookie,char* adr,char* fil) {
return NULL;
}
char* bauth_prefix(char* adr,char* fil) {
char* prefix;
char* bauth_prefix(char *prefix,char* adr,char* fil) {
char* a;
NOSTATIC_RESERVE(prefix, char, HTS_URLMAXSIZE*2);
strcpybuff(prefix,jump_identification(adr));
strcatbuff(prefix,fil);
a=strchr(prefix,'?');

View File

@@ -40,19 +40,27 @@ Please visit our Website: http://www.httrack.com
#define HTSBAUTH_DEFH
// robots wizard
typedef struct bauth_chain {
#ifndef HTS_DEF_FWSTRUCT_bauth_chain
#define HTS_DEF_FWSTRUCT_bauth_chain
typedef struct bauth_chain bauth_chain;
#endif
struct bauth_chain {
char prefix[1024]; /* www.foo.com/secure/ */
char auth[1024]; /* base-64 encoded user:pass */
struct bauth_chain* next; /* next element */
} bauth_chain;
};
// buffer pour les cookies et authentification
typedef struct t_cookie {
#ifndef HTS_DEF_FWSTRUCT_t_cookie
#define HTS_DEF_FWSTRUCT_t_cookie
typedef struct t_cookie t_cookie;
#endif
struct t_cookie {
int max_len;
char data[32768];
bauth_chain auth;
} t_cookie;
};
/* Library internal definictions */
@@ -61,18 +69,18 @@ typedef struct t_cookie {
// cookies
int cookie_add(t_cookie* cookie,char* cook_name,char* cook_value,char* domain,char* path);
int cookie_del(t_cookie* cookie,char* cook_name,char* domain,char* path);
int cookie_load(t_cookie* cookie,char* path,char* name);
int cookie_load(t_cookie* cookie, const char* path, const char* name);
int cookie_save(t_cookie* cookie,char* name);
void cookie_insert(char* s,char* ins);
void cookie_delete(char* s,int pos);
char* cookie_get(char* cookie_base,int param);
char* cookie_get(char *buffer, char* cookie_base,int param);
char* cookie_find(char* s,char* cook_name,char* domain,char* path);
char* cookie_nextfield(char* a);
// basic auth
int bauth_add(t_cookie* cookie,char* adr,char* fil,char* auth);
char* bauth_check(t_cookie* cookie,char* adr,char* fil);
char* bauth_prefix(char* adr,char* fil);
char* bauth_prefix(char *buffer, char* adr,char* fil);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -40,32 +40,49 @@ Please visit our Website: http://www.httrack.com
#ifndef HTSCACHE_DEFH
#define HTSCACHE_DEFH
#include "htscore.h"
/* Library internal definictions */
#ifdef HTS_INTERNAL_BYTECODE
#include "htsglobal.h"
#include <stdlib.h>
/* Forward definitions */
#ifndef HTS_DEF_FWSTRUCT_httrackp
#define HTS_DEF_FWSTRUCT_httrackp
typedef struct httrackp httrackp;
#endif
#ifndef HTS_DEF_FWSTRUCT_cache_back
#define HTS_DEF_FWSTRUCT_cache_back
typedef struct cache_back cache_back;
#endif
#ifndef HTS_DEF_FWSTRUCT_htsblk
#define HTS_DEF_FWSTRUCT_htsblk
typedef struct htsblk htsblk;
#endif
// cache
void cache_mayadd(httrackp* opt,cache_back* cache,htsblk* r,char* url_adr,char* url_fil,char* url_save);
void cache_add(cache_back* cache,htsblk r,char* url_adr,char* url_fil,char* url_save,int all_in_cache,char* path_prefix);
htsblk cache_read(httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* location);
htsblk cache_read_ro(httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* location);
htsblk cache_readex(httrackp* opt,cache_back* cache,char* adr,char* fil,char* save,char* location,char* return_save,int readonly);
htsblk* cache_header(httrackp* opt,cache_back* cache,char* adr,char* fil,htsblk* r);
void cache_mayadd(httrackp* opt,cache_back* cache,htsblk* r,const char* url_adr,const char* url_fil,const char* url_save);
void cache_add(httrackp* opt,cache_back* cache,const htsblk *r,const char* url_adr,const char* url_fil,const char* url_save,int all_in_cache,const char* path_prefix);
htsblk cache_read(httrackp* opt,cache_back* cache,const char* adr,const char* fil,const char* save,char* location);
htsblk cache_read_ro(httrackp* opt,cache_back* cache,const char* adr,const char* fil,const char* save,char* location);
htsblk cache_readex(httrackp* opt,cache_back* cache,const char* adr,const char* fil,const char* save,char* location,char* return_save,int readonly);
htsblk* cache_header(httrackp* opt,cache_back* cache,const char* adr,const char* fil,htsblk* r);
void cache_init(cache_back* cache,httrackp* opt);
int cache_writedata(FILE* cache_ndx,FILE* cache_dat,char* str1,char* str2,char* outbuff,int len);
int cache_readdata(cache_back* cache,char* str1,char* str2,char** inbuff,int* len);
int cache_writedata(FILE* cache_ndx,FILE* cache_dat,const char* str1,const char* str2,char* outbuff,int len);
int cache_readdata(cache_back* cache,const char* str1,const char* str2,char** inbuff,int* len);
int cache_wstr(FILE* fp,char* s);
void cache_rstr(FILE* fp,char* s);
char* cache_rstr_addr(FILE* fp);
int cache_brstr(char* adr,char* s);
int cache_quickbrstr(char* adr,char* s);
int cache_brint(char* adr,int* i);
void cache_rint(FILE* fp,int* i);
int cache_wint(FILE* fp,int i);
void cache_rLLint(FILE* fp,LLint* i);
int cache_wstr(FILE* fp,const char* s);
int cache_wint(FILE* fp,int i);
int cache_wLLint(FILE* fp,LLint i);
#endif

View File

@@ -47,7 +47,7 @@ Please visit our Website: http://www.httrack.com
#ifndef _WIN32_WCE
#include <fcntl.h>
#endif
#if HTS_WIN
#ifdef _WIN32
#else
#include <arpa/inet.h>
#endif
@@ -102,7 +102,7 @@ HTSEXT_API T_SOC catch_url_init(int* port,char* adr) {
// copie adresse
SOCaddr_copyaddr(server, server_size, hp_loc->h_addr_list[0], hp_loc->h_length);
if ( (soc=socket(SOCaddr_sinfamily(server), SOCK_STREAM, 0)) != INVALID_SOCKET) {
if ( (soc = (T_SOC) socket(SOCaddr_sinfamily(server), SOCK_STREAM, 0)) != INVALID_SOCKET) {
SOCaddr_initport(server, *port);
if ( bind(soc,(struct sockaddr*) &server,server_size) == 0 ) {
SOCaddr server2;
@@ -162,7 +162,7 @@ HTSEXT_API int catch_url(T_SOC soc,char* url,char* method,char* data) {
T_SOC soc2;
struct sockaddr dummyaddr;
int dummylen = sizeof(struct sockaddr);
while ( (soc2=accept(soc,&dummyaddr,&dummylen)) == INVALID_SOCKET);
while ( (soc2 = (T_SOC) accept(soc,&dummyaddr,&dummylen)) == INVALID_SOCKET);
/*
#ifdef _WIN32
closesocket(soc);
@@ -224,7 +224,7 @@ HTSEXT_API int catch_url(T_SOC soc,char* url,char* method,char* data) {
//strcatbuff(data,"\r\n");
if (blkretour.totalsize>0) {
int len=(int)min(blkretour.totalsize,32000);
int pos=strlen(data);
int pos = (int) strlen(data);
// Copier le reste (post éventuel)
while((len>0) && ((r=recv(soc,(char*) data+pos,len,0))>0) ) {
pos+=r;
@@ -234,7 +234,7 @@ HTSEXT_API int catch_url(T_SOC soc,char* url,char* method,char* data) {
}
// Envoyer page
sprintf(line,CATCH_RESPONSE);
send(soc,line,strlen(line),0);
send(soc,line,(int)strlen(line),0);
// OK!
retour=1;
}

Some files were not shown because too many files have changed in this diff Show More