mirror of
https://github.com/xroche/httrack.git
synced 2026-05-17 08:26:14 +03:00
http://proliant/svn/httrack/trunk
........
r1170 | roche | 2014-06-08 21:54:49 +0200 (dim., 08 juin 2014) | 3 lines
Fixed FTBFS when compiling with zlib versions < 1.2.70 (sammyx)
........
r1171 | roche | 2014-06-08 22:00:57 +0200 (dim., 08 juin 2014) | 3 lines
Added minizip orig files.
........
r1172 | roche | 2014-06-08 22:06:06 +0200 (dim., 08 juin 2014) | 3 lines
Reverted diff, groumph.
........
r1173 | roche | 2014-06-08 22:08:21 +0200 (dim., 08 juin 2014) | 3 lines
Added diff
........
r1174 | roche | 2014-06-09 22:07:04 +0200 (lun., 09 juin 2014) | 3 lines
Updated Makefile
........
r1175 | roche | 2014-06-10 18:37:44 +0200 (mar., 10 juin 2014) | 3 lines
Changed hashtable types to have either opaque void*, or unions.
........
r1176 | roche | 2014-06-10 18:43:33 +0200 (mar., 10 juin 2014) | 1 line
Fixed const
........
r1177 | roche | 2014-06-10 19:04:48 +0200 (mar., 10 juin 2014) | 3 lines
Added missing minizip/mztools.c.diff reference
........
r1178 | roche | 2014-06-10 22:27:13 +0200 (mar., 10 juin 2014) | 6 lines
Added the following compiler flags:
* -Wcast-qual
* -Wmissing-parameter-type
* -Wold-style-definition
........
r1179 | roche | 2014-06-10 22:42:28 +0200 (mar., 10 juin 2014) | 3 lines
-Wstrict-aliasing=2 => -Wstrict-aliasing
........
r1180 | roche | 2014-06-11 18:50:00 +0200 (mer., 11 juin 2014) | 5 lines
Added the following compiler flags:
* -Wunused-but-set-parameter
* -Wignored-qualifiers
........
r1181 | roche | 2014-06-11 20:59:42 +0200 (mer., 11 juin 2014) | 3 lines
Fixed zlib warning (build zlib with -DZLIB_CONST)
........
r1182 | roche | 2014-06-11 21:04:32 +0200 (mer., 11 juin 2014) | 1 line
Fixed WIN32 build (stdint.h)
........
r1183 | roche | 2014-06-14 11:21:48 +0200 (sam., 14 juin 2014) | 3 lines
Hashtable cleanup
........
r1184 | roche | 2014-06-14 11:50:17 +0200 (sam., 14 juin 2014) | 3 lines
Preparing to export the cuckoo hashtable library as "coucal" project
........
r1185 | roche | 2014-06-14 11:51:03 +0200 (sam., 14 juin 2014) | 3 lines
Fixed include
........
r1186 | roche | 2014-06-14 11:55:50 +0200 (sam., 14 juin 2014) | 3 lines
Re-license coucal to BSD-style license.
........
r1187 | roche | 2014-06-14 11:56:14 +0200 (sam., 14 juin 2014) | 3 lines
Fixed includes.
........
r1188 | roche | 2014-06-14 12:05:44 +0200 (sam., 14 juin 2014) | 3 lines
Renamed inthash_* API to coucal_* one.
........
r1189 | roche | 2014-06-14 12:08:38 +0200 (sam., 14 juin 2014) | 3 lines
Remarks over MD5 vs. murmur hashing.
........
r1190 | roche | 2014-06-14 14:39:16 +0200 (sam., 14 juin 2014) | 2 lines
Fixed exports.
Fixed WIN32.
........
r1192 | roche | 2014-06-14 14:46:19 +0200 (sam., 14 juin 2014) | 3 lines
Added diff murmurhash3.h
........
r1193 | roche | 2014-06-14 14:55:11 +0200 (sam., 14 juin 2014) | 3 lines
BSD 3-Clause License
........
r1194 | roche | 2014-06-14 14:59:42 +0200 (sam., 14 juin 2014) | 3 lines
Wrapped lines.
........
r1195 | roche | 2014-06-14 15:07:33 +0200 (sam., 14 juin 2014) | 1 line
Added coucal_get_pvoid() and coucal_get_intptr()
........
r1196 | roche | 2014-06-14 21:35:29 +0200 (sam., 14 juin 2014) | 3 lines
Added comments.
........
r1197 | roche | 2014-06-14 22:02:11 +0200 (sam., 14 juin 2014) | 3 lines
Cosmetic
........
r1198 | roche | 2014-06-14 22:18:56 +0200 (sam., 14 juin 2014) | 3 lines
Added coucal_hash_data()
........
r1199 | roche | 2014-06-15 09:39:57 +0200 (dim., 15 juin 2014) | 3 lines
Original cuckoo hashing paper
........
r1200 | roche | 2014-06-15 09:43:32 +0200 (dim., 15 juin 2014) | 3 lines
Intro line.
........
r1201 | roche | 2014-06-15 09:52:33 +0200 (dim., 15 juin 2014) | 3 lines
Credits.
........
r1202 | roche | 2014-06-15 10:29:02 +0200 (dim., 15 juin 2014) | 1 line
Added coucal_fetch_value_hashes()
........
r1203 | roche | 2014-06-15 10:31:41 +0200 (dim., 15 juin 2014) | 1 line
Added coucal_fetch_value()
........
r1204 | roche | 2014-06-15 10:48:18 +0200 (dim., 15 juin 2014) | 1 line
Added coucal_calc_hashes()
........
r1205 | roche | 2014-06-15 12:24:06 +0200 (dim., 15 juin 2014) | 1 line
Optional 64-bit hash for really big hashtables. (disabled by default)
........
r1206 | roche | 2014-06-15 13:12:08 +0200 (dim., 15 juin 2014) | 1 line
Cleanup in coucal_new()
........
r1207 | roche | 2014-06-15 13:21:17 +0200 (dim., 15 juin 2014) | 1 line
Fixed log size limit check.
........
r1208 | roche | 2014-06-15 14:10:52 +0200 (dim., 15 juin 2014) | 1 line
Better coucal_is_acceptable_pow2() logic
........
r1209 | roche | 2014-06-15 22:27:45 +0200 (dim., 15 juin 2014) | 3 lines
Faster coucal_del_value_
........
r1210 | roche | 2014-06-17 21:09:31 +0200 (mar., 17 juin 2014) | 3 lines
Fixed "old-style function definition" warning.
........
r1211 | roche | 2014-06-17 21:56:26 +0200 (mar., 17 juin 2014) | 3 lines
Possible cause of crash at htstools.c:425 inside long_to_83()
........
r1213 | roche | 2014-06-22 12:22:39 +0200 (dim., 22 juin 2014) | 3 lines
No fopen64() on Android.
........
r1218 | roche | 2014-06-22 12:42:38 +0200 (dim., 22 juin 2014) | 3 lines
Fixed "comparison between signed and unsigned integer expressions"
........
r1222 | roche | 2014-06-22 15:03:07 +0200 (dim., 22 juin 2014) | 2 lines
Handle buggy SVG (Smiling Spectre)
........
r1223 | roche | 2014-06-22 15:30:41 +0200 (dim., 22 juin 2014) | 1 line
Do not uncompress .tgz advertised as "streamed" (Smiling Spectre)
........
r1224 | roche | 2014-06-23 06:49:41 +0200 (lun., 23 juin 2014) | 3 lines
Emergency fixing Invalid address alignment issues on Android
........
r1227 | roche | 2014-06-23 09:33:30 +0200 (lun., 23 juin 2014) | 3 lines
#ifdef failed
........
r1230 | roche | 2014-06-23 20:52:33 +0200 (lun., 23 juin 2014) | 3 lines
Check for aligned access requirements explicitly.
........
r1231 | roche | 2014-06-24 20:16:30 +0200 (mar., 24 juin 2014) | 3 lines
Temporarily switch to MD5 with architectures not supporting unaligned integer accesses.
........
r1232 | roche | 2014-06-27 18:03:10 +0200 (ven., 27 juin 2014) | 3 lines
Fixed NULL pointer dereferencing in back_unserialize (htsback.c:976) spotted on Android platforms
........
r1233 | roche | 2014-06-28 13:18:06 +0200 (sam., 28 juin 2014) | 3 lines
Optimize the case when realloc() returns the same base address while reallocating the string pool.
........
r1234 | roche | 2014-06-28 13:20:04 +0200 (sam., 28 juin 2014) | 3 lines
typo.
........
r1236 | roche | 2014-07-06 10:00:36 +0200 (dim., 06 juil. 2014) | 1 line
Added hts_has_stopped() flag, added some asserts
........
r1237 | roche | 2014-07-06 10:05:19 +0200 (dim., 06 juil. 2014) | 3 lines
Fixed MD5_Init()
........
r1238 | roche | 2014-07-06 10:12:42 +0200 (dim., 06 juil. 2014) | 3 lines
Fixed MD5 definitions
........
r1239 | roche | 2014-07-06 10:17:09 +0200 (dim., 06 juil. 2014) | 3 lines
Fixed HashMD5Context
........
r1240 | roche | 2014-07-06 10:24:40 +0200 (dim., 06 juil. 2014) | 3 lines
Fixed MD5_CTX => struct MD5Context
........
r1247 | roche | 2014-07-07 21:07:08 +0200 (lun., 07 juil. 2014) | 1 line
int => size_t cleanup
........
r1248 | roche | 2014-07-07 21:24:18 +0200 (lun., 07 juil. 2014) | 1 line
Another assert
........
r1249 | roche | 2014-07-08 09:06:10 +0200 (mar., 08 juil. 2014) | 3 lines
Fixed htssafe.h
........
r1250 | roche | 2014-07-08 20:20:20 +0200 (mar., 08 juil. 2014) | 3 lines
Fixed buggy FFFD (replacement character) in place of leading non-ascii character
* closes:#48
........
r1251 | roche | 2014-07-08 20:23:06 +0200 (mar., 08 juil. 2014) | 1 line
3.48-14
........
r1253 | roche | 2014-07-08 20:40:01 +0200 (mar., 08 juil. 2014) | 3 lines
3.48.14
........
r1254 | roche | 2014-07-08 22:01:22 +0200 (mar., 08 juil. 2014) | 3 lines
proxytrack: fixed FTBFS on ARM/MIPS
........
r1255 | roche | 2014-07-08 22:01:32 +0200 (mar., 08 juil. 2014) | 3 lines
Updated man
........
r1256 | roche | 2014-07-08 22:08:20 +0200 (mar., 08 juil. 2014) | 3 lines
3.48.15
........
119 lines
4.1 KiB
C
Executable File
119 lines
4.1 KiB
C
Executable File
/*
|
|
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 -lhttrack2
|
|
With MS-Visual C++:
|
|
cl -LD -nologo -W3 -Zi -Zp4 -DWIN32 -Fe"mycallback.dll" callbacks-example.c libhttrack.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;
|
|
|
|
(void) ourDummyArg;
|
|
|
|
/* 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, (void *) (uintptr_t) arg);
|
|
CHAIN_FUNCTION(opt, start, start_of_mirror, (void *) (uintptr_t) arg);
|
|
CHAIN_FUNCTION(opt, end, end_of_mirror, (void *) (uintptr_t) 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;
|
|
}
|