mirror of
https://github.com/xroche/httrack.git
synced 2026-05-17 16:36:07 +03:00
Compare commits
160 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f8a15c76f | ||
|
|
40f237fe9c | ||
|
|
04cfb2db0e | ||
|
|
bdbf66b45c | ||
|
|
6bace27858 | ||
|
|
7d3d496a7f | ||
|
|
7826a49f59 | ||
|
|
ed79961b7a | ||
|
|
d3c14c9d1f | ||
|
|
7026ba7c7b | ||
|
|
abe98f238d | ||
|
|
8dd39bc909 | ||
|
|
17ec3ecd6b | ||
|
|
c7636d4f90 | ||
|
|
3a7e594166 | ||
|
|
b88395a16c | ||
|
|
4f5776a8fa | ||
|
|
8adeadbdb6 | ||
|
|
c64b8d6e88 | ||
|
|
194ebad4c6 | ||
|
|
ae6d05fbb3 | ||
|
|
803f7b5a33 | ||
|
|
f919aab408 | ||
|
|
0238301aca | ||
|
|
3864a45388 | ||
|
|
5e248cc4e3 | ||
|
|
473baf7f95 | ||
|
|
27752e368c | ||
|
|
37187f967f | ||
|
|
1d07610320 | ||
|
|
49304bbe8f | ||
|
|
11e069aa07 | ||
|
|
0c7a0274ca | ||
|
|
f3a4a20750 | ||
|
|
e090cd9ccf | ||
|
|
1bebff2697 | ||
|
|
c7fac4dbca | ||
|
|
0b52cac218 | ||
|
|
43b457203b | ||
|
|
fdcff762f6 | ||
|
|
c3987aca71 | ||
|
|
f67a86657b | ||
|
|
01edfd6d1e | ||
|
|
a300785d5e | ||
|
|
5364514f34 | ||
|
|
f078a39677 | ||
|
|
65454f4ff1 | ||
|
|
15813b5380 | ||
|
|
033ce293b8 | ||
|
|
d1913325e4 | ||
|
|
882578ed9a | ||
|
|
1ec8b5fb9e | ||
|
|
796c62f07c | ||
|
|
cefcc04266 | ||
|
|
6ba50a2001 | ||
|
|
9315f64b6e | ||
|
|
feb2a02cc2 | ||
|
|
24ff04fdb7 | ||
|
|
72e0c0601b | ||
|
|
b72741ddc9 | ||
|
|
1edfda507d | ||
|
|
4a62c84479 | ||
|
|
595d446470 | ||
|
|
0474c596b6 | ||
|
|
9f23ea7980 | ||
|
|
fe1ec5b0f6 | ||
|
|
fd1ab669ad | ||
|
|
34788bb7f6 | ||
|
|
03edb3eac8 | ||
|
|
fe7ea8b140 | ||
|
|
1fd27d74af | ||
|
|
08a17f31d4 | ||
|
|
6c8b76e531 | ||
|
|
66c8cc32aa | ||
|
|
2209c7bdd8 | ||
|
|
cb0460ddcb | ||
|
|
fb9e02ffb9 | ||
|
|
ac779cb6a0 | ||
|
|
0073d3ad05 | ||
|
|
638cc96917 | ||
|
|
c6e0ad4bce | ||
|
|
c457788a14 | ||
|
|
216005d33a | ||
|
|
59008af067 | ||
|
|
3059bd6f53 | ||
|
|
e5b3c85156 | ||
|
|
843faaf83d | ||
|
|
75969b1147 | ||
|
|
6ad604624d | ||
|
|
c05f54ae04 | ||
|
|
ae1db762e7 | ||
|
|
16aec722bf | ||
|
|
4ff55249ed | ||
|
|
fea8122ed3 | ||
|
|
7323230eb3 | ||
|
|
c9f656fdeb | ||
|
|
042525a1db | ||
|
|
3fde59c090 | ||
|
|
edaaa73328 | ||
|
|
cc424a4503 | ||
|
|
1f18c67f8a | ||
|
|
a016accc4b | ||
|
|
1315e03cc5 | ||
|
|
917d6bd3c4 | ||
|
|
a085b2b2fa | ||
|
|
67b8737ed4 | ||
|
|
9d67ab4cf0 | ||
|
|
b331963ba6 | ||
|
|
f48114006d | ||
|
|
9208228e2d | ||
|
|
9a17499b99 | ||
|
|
91714c7a28 | ||
|
|
3a3d27386c | ||
|
|
d59341813d | ||
|
|
65eb4e58e5 | ||
|
|
7e75314395 | ||
|
|
5ff78eebd0 | ||
|
|
76dc4d04fc | ||
|
|
5b0c24aa71 | ||
|
|
ba35564fac | ||
|
|
0db2125bdc | ||
|
|
032be64885 | ||
|
|
b41e6dc3af | ||
|
|
a798cd3a8d | ||
|
|
d2435b1b5e | ||
|
|
213359b3db | ||
|
|
3b1bf0b8af | ||
|
|
6aef8ee820 | ||
|
|
ac6cc76bab | ||
|
|
a3fb178b10 | ||
|
|
b1fa75dfe0 | ||
|
|
4da59a6399 | ||
|
|
44688bdbdf | ||
|
|
6ce91ec1f3 | ||
|
|
95b9374ff3 | ||
|
|
c7edfe0f5f | ||
|
|
381eebc056 | ||
|
|
5544f503bf | ||
|
|
b3fa8537c4 | ||
|
|
aafafee47e | ||
|
|
632befbd53 | ||
|
|
908f3ac832 | ||
|
|
d46e835fc2 | ||
|
|
1f6b64f81a | ||
|
|
24eee92311 | ||
|
|
75b5002c63 | ||
|
|
792311df15 | ||
|
|
3e63dbc69c | ||
|
|
589b5ed78f | ||
|
|
015cff31b9 | ||
|
|
8e0c4ab867 | ||
|
|
919030900d | ||
|
|
859f4625cb | ||
|
|
0985f4c014 | ||
|
|
21debe05da | ||
|
|
d0d9660ac9 | ||
|
|
2fe3a96b09 | ||
|
|
ef647e9136 | ||
|
|
159e3d0017 | ||
|
|
9661b389d9 |
2
README
2
README
@@ -1,5 +1,5 @@
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
Welcome to HTTrack Website Copier!
|
||||
|
||||
|
||||
@@ -108,3 +108,9 @@
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* in_port_t */
|
||||
#undef in_port_t
|
||||
|
||||
/* sa_family_t */
|
||||
#undef sa_family_t
|
||||
|
||||
50
configure
vendored
50
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for httrack 3.48.1.
|
||||
# Generated by GNU Autoconf 2.69 for httrack 3.48.9.
|
||||
#
|
||||
# Report bugs to <roche+packaging@httrack.com>.
|
||||
#
|
||||
@@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='httrack'
|
||||
PACKAGE_TARNAME='httrack'
|
||||
PACKAGE_VERSION='3.48.1'
|
||||
PACKAGE_STRING='httrack 3.48.1'
|
||||
PACKAGE_VERSION='3.48.9'
|
||||
PACKAGE_STRING='httrack 3.48.9'
|
||||
PACKAGE_BUGREPORT='roche+packaging@httrack.com'
|
||||
PACKAGE_URL='http://www.httrack.com/'
|
||||
|
||||
@@ -1337,7 +1337,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures httrack 3.48.1 to adapt to many kinds of systems.
|
||||
\`configure' configures httrack 3.48.9 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1407,7 +1407,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of httrack 3.48.1:";;
|
||||
short | recursive ) echo "Configuration of httrack 3.48.9:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1521,7 +1521,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
httrack configure 3.48.1
|
||||
httrack configure 3.48.9
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@@ -2248,7 +2248,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by httrack $as_me 3.48.1, which was
|
||||
It was created by httrack $as_me 3.48.9, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -3067,7 +3067,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='httrack'
|
||||
VERSION='3.48.1'
|
||||
VERSION='3.48.9'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -15408,6 +15408,36 @@ $as_echo "$as_me: WARNING: *** in_addr_t not found" >&2;}
|
||||
fi
|
||||
|
||||
|
||||
# check for in_port_
|
||||
ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" "
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
"
|
||||
if test "x$ac_cv_type_in_port_t" = xyes; then :
|
||||
|
||||
else
|
||||
|
||||
$as_echo "#define in_port_t uint16_t" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# check for sa_family_t
|
||||
ac_fn_c_check_type "$LINENO" "sa_family_t" "ac_cv_type_sa_family_t" "
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
"
|
||||
if test "x$ac_cv_type_sa_family_t" = xyes; then :
|
||||
|
||||
else
|
||||
|
||||
$as_echo "#define sa_family_t uint16_t" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
### zlib
|
||||
#
|
||||
# Handle user hints
|
||||
@@ -16892,7 +16922,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by httrack $as_me 3.48.1, which was
|
||||
This file was extended by httrack $as_me 3.48.9, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -16959,7 +16989,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
httrack config.status 3.48.1
|
||||
httrack config.status 3.48.9
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
14
configure.ac
14
configure.ac
@@ -1,4 +1,4 @@
|
||||
AC_INIT([httrack], [3.48.1], [roche+packaging@httrack.com], [httrack], [http://www.httrack.com/])
|
||||
AC_INIT([httrack], [3.48.9], [roche+packaging@httrack.com], [httrack], [http://www.httrack.com/])
|
||||
AC_CONFIG_SRCDIR(src/httrack.c)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
@@ -47,6 +47,18 @@ AC_MSG_WARN([*** in_addr_t not found]),
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>])
|
||||
|
||||
# check for in_port_
|
||||
AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
])
|
||||
|
||||
# check for sa_family_t
|
||||
AC_CHECK_TYPE(sa_family_t, [], [AC_DEFINE([sa_family_t], [uint16_t], [sa_family_t])], [
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
])
|
||||
|
||||
### zlib
|
||||
CHECK_ZLIB()
|
||||
|
||||
|
||||
76
debian/changelog
vendored
76
debian/changelog
vendored
@@ -1,3 +1,79 @@
|
||||
httrack (3.48.9-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.9 (3.48-9)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Wed, 21 May 2014 19:22:04 +0200
|
||||
|
||||
httrack (3.48.8-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.8 (3.48-8)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Thu, 15 May 2014 19:21:21 +0200
|
||||
|
||||
httrack (3.48.7-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.7 (3.48-7)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Wed, 14 May 2014 19:51:57 +0200
|
||||
|
||||
httrack (3.48.6-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.6 (3.48-6)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Tue, 13 May 2014 21:23:02 +0200
|
||||
|
||||
httrack (3.48.5-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.5 (3.48-5)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Fri, 02 May 2014 16:37:08 +0200
|
||||
|
||||
httrack (3.48.4-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.4 (3.48-4)
|
||||
closes:#746173
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Sun, 27 Apr 2014 18:48:57 +0200
|
||||
|
||||
httrack (3.48.3-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.3 (3.48-3)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Fri, 11 Apr 2014 20:31:21 +0200
|
||||
|
||||
httrack (3.48.2-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.2 (3.48-2)
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Thu, 10 Apr 2014 18:30:08 +0200
|
||||
|
||||
httrack (3.48.1-5) unstable; urgency=low
|
||||
|
||||
* Really call dh_autoreconf, fix configure dependencies.
|
||||
|
||||
-- Matthias Klose <doko@ubuntu.com> Wed, 16 Apr 2014 14:46:20 +0200
|
||||
|
||||
httrack (3.48.1-4) unstable; urgency=low
|
||||
|
||||
* Cleanup in dependencies
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Tue, 15 Apr 2014 22:13:19 +0200
|
||||
|
||||
httrack (3.48.1-3) unstable; urgency=low
|
||||
|
||||
* Fixed FTBFS due to a missing Build-Depends: dh-autoreconf
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Tue, 15 Apr 2014 21:32:03 +0200
|
||||
|
||||
httrack (3.48.1-2) unstable; urgency=low
|
||||
|
||||
* Fixed removal of .a files even on architectures where .a are libraries
|
||||
closes:#744594
|
||||
Enable verosity of unit tests
|
||||
Call dh_autoreconf_clean before dh_clean
|
||||
|
||||
-- Xavier Roche <xavier@debian.org> Tue, 15 Apr 2014 21:02:14 +0200
|
||||
|
||||
httrack (3.48.1-1) unstable; urgency=low
|
||||
|
||||
* Updated to 3.48.1 (3.48-1)
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -2,8 +2,8 @@ Source: httrack
|
||||
Section: web
|
||||
Priority: optional
|
||||
Maintainer: Xavier Roche <roche@httrack.com>
|
||||
Standards-Version: 3.9.4
|
||||
Build-Depends: debhelper (>= 8.0.0), zlib1g-dev, libssl-dev, autotools-dev, autoconf, automake, libtool
|
||||
Standards-Version: 3.9.5
|
||||
Build-Depends: debhelper (>= 8.0.0), dh-autoreconf, autotools-dev, autoconf, automake, libtool, zlib1g-dev, libssl-dev
|
||||
Homepage: http://www.httrack.com
|
||||
|
||||
Package: httrack
|
||||
|
||||
2
debian/copyright
vendored
2
debian/copyright
vendored
@@ -5,7 +5,7 @@ The current Debian maintainer is Xavier Roche <xavier@debian.org>
|
||||
|
||||
Upstream author: Xavier Roche <roche@httrack.com>
|
||||
|
||||
Copyright: 1998-2013 Xavier Roche and other contributors
|
||||
Copyright: 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
19
debian/rules
vendored
19
debian/rules
vendored
@@ -23,11 +23,16 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
||||
INSTALL_PROGRAM += -s
|
||||
endif
|
||||
|
||||
# as suggested by Simon McVittie
|
||||
# (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744380)
|
||||
override_dh_auto_test:
|
||||
VERBOSE=1 dh_auto_test
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
|
||||
autoreconf -v -i
|
||||
dh_autoreconf
|
||||
# note: dpkg-buildflags to be removed when compat=9
|
||||
dh_auto_configure -- --enable-online-unit-tests=auto $(shell dpkg-buildflags --export=configure)
|
||||
|
||||
@@ -50,6 +55,7 @@ clean:
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
dh_auto_clean
|
||||
dh_autoreconf_clean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -79,10 +85,17 @@ install: build
|
||||
mkdir -p $(CURDIR)/debian/httrack/usr/lib/httrack/
|
||||
mv $(CURDIR)/debian/httrack/usr/bin/htsserver \
|
||||
$(CURDIR)/debian/httrack/usr/lib/httrack/
|
||||
rm -f $(CURDIR)/debian/httrack/usr/lib/*.a
|
||||
# remove *.la (https://wiki.debian.org/ReleaseGoals/LAFileRemoval)
|
||||
rm -f $(CURDIR)/debian/httrack/usr/lib/*.la
|
||||
rm -f $(CURDIR)/debian/httrack/usr/lib/httrack/*.a
|
||||
rm -f $(CURDIR)/debian/httrack/usr/lib/httrack/*.la
|
||||
# remove *.a unless we do not have *.so files
|
||||
# see BUG #744594
|
||||
if ls $(CURDIR)/debian/httrack/usr/lib/*.so >/dev/null 2>/dev/null ; then \
|
||||
rm -f $(CURDIR)/debian/httrack/usr/lib/*.a ; \
|
||||
fi
|
||||
if ls $(CURDIR)/debian/httrack/usr/lib/httrack/*.so >/dev/null 2>/dev/null ; then \
|
||||
rm -f $(CURDIR)/debian/httrack/usr/lib/httrack/*.a ; \
|
||||
fi
|
||||
mv $(CURDIR)/debian/httrack/usr/lib/httrack/lib* \
|
||||
$(CURDIR)/debian/httrack/usr/share/httrack/libtest/
|
||||
mkdir -p $(CURDIR)/debian/httrack/usr/lib/httrack/libtest
|
||||
|
||||
10
history.txt
10
history.txt
@@ -4,7 +4,15 @@ HTTrack Website Copier release history:
|
||||
|
||||
This file lists all changes and fixes that have been made for HTTrack.
|
||||
|
||||
3.48-1
|
||||
3.48-9
|
||||
+ Fixed: broken 32-bit version
|
||||
+ Fixed: assertion "segOutputSize < segSize assertion fails at htscharset.c:993"
|
||||
+ Fixed: new zlib version fixing CVE-2004-0797 and CVE-2005-2096
|
||||
+ Fixed: more reliable crash reporting
|
||||
+ Fixed: fixed infamous "hashtable internal error: cuckoo/stash collision" errors
|
||||
+ Fixed: safety cleanup in many strings operations
|
||||
+ Fixed: buggy option pannels
|
||||
+ New: Enforce check against CVE-2014-0160
|
||||
+ New: improved hashtables to speedup large mirrors
|
||||
+ New: added unit tests
|
||||
+ New: Added %a option, allowing to define the "Accept:" header line.
|
||||
|
||||
@@ -52,8 +52,7 @@ offline browser : copy websites to a local directory</p>
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em"><b>httrack [
|
||||
url ]... [ −filter ]... [ +filter ]... [ −O,
|
||||
−−path</b> ] [ <b>−%O,
|
||||
−−chroot</b> ] [ <b>−w,
|
||||
−−path</b> ] [ <b>−w,
|
||||
−−mirror</b> ] [ <b>−W,
|
||||
−−mirror−wizard</b> ] [ <b>−g,
|
||||
−−get−files</b> ] [ <b>−i,
|
||||
@@ -70,8 +69,6 @@ url ]... [ −filter ]... [ +filter ]... [ −O,
|
||||
−−max−rate[=N]</b> ] [ <b>−%cN,
|
||||
−−connection−per−second[=N]</b> ] [
|
||||
<b>−GN, −−max−pause[=N]</b> ] [
|
||||
<b>−%mN,
|
||||
−−max−mms−time[=N]</b> ] [
|
||||
<b>−cN, −−sockets[=N]</b> ] [
|
||||
<b>−TN, −−timeout[=N]</b> ] [
|
||||
<b>−RN, −−retries[=N]</b> ] [
|
||||
@@ -111,7 +108,9 @@ url ]... [ −filter ]... [ +filter ]... [ −O,
|
||||
−−referer</b> ] [ <b>−%E,
|
||||
−−from</b> ] [ <b>−%F,
|
||||
−−footer</b> ] [ <b>−%l,
|
||||
−−language</b> ] [ <b>−C,
|
||||
−−language</b> ] [ <b>−%a,
|
||||
−−accept</b> ] [ <b>−%X,
|
||||
−−headers</b> ] [ <b>−C,
|
||||
−−cache[=N]</b> ] [ <b>−k,
|
||||
−−store−all−in−cache</b> ] [
|
||||
<b>−%n, −−do−not−recatch</b> ]
|
||||
@@ -144,8 +143,7 @@ url ]... [ −filter ]... [ +filter ]... [ −O,
|
||||
<b>−%!,
|
||||
−−disable−security−limits</b> ] [
|
||||
<b>−V, −−userdef−cmd</b> ] [
|
||||
<b>−%U, −−user</b> ] [ <b>−%W,
|
||||
−−callback</b> ] [ <b>−K,
|
||||
<b>−%W, −−callback</b> ] [ <b>−K,
|
||||
−−keep−links[=N]</b> ] [</p>
|
||||
|
||||
<h2>DESCRIPTION
|
||||
@@ -227,29 +225,17 @@ options:</b></p>
|
||||
cellspacing="0" cellpadding="0">
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
<td width="3%">
|
||||
|
||||
|
||||
<p>−O</p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="8%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>path for mirror/logfiles+cache (−O path
|
||||
mirror[,path cache and logfiles]) (−−path
|
||||
<param>)</p> </td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
|
||||
|
||||
<p>−%O</p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>chroot path to, must be r00t (−%O root path)
|
||||
(−−chroot <param>)</p></td></tr>
|
||||
</table>
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em"><b>Action
|
||||
@@ -475,19 +461,6 @@ hour) (−−max−time[=N])</p></td></tr>
|
||||
|
||||
<p>pause transfer if N bytes reached, and wait until lock
|
||||
file is deleted (−−max−pause[=N])</p></td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="9%">
|
||||
|
||||
|
||||
<p>−%mN</p></td>
|
||||
<td width="2%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>maximum mms stream download time in seconds (60=1
|
||||
minute, 3600=1 hour)
|
||||
(−−max−mms−time[=N])</p> </td></tr>
|
||||
</table>
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em"><b>Flow
|
||||
@@ -1049,6 +1022,32 @@ HTTP headers (−F "user−agent name")
|
||||
|
||||
<p>preffered language (−%l "fr, en, jp, *"
|
||||
(−−language <param>)</p></td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
|
||||
|
||||
<p>−%a</p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>accepted formats (−%l
|
||||
"text/html,image/png,image/jpeg,image/gif;q=0.9,*/*;q=0.1"
|
||||
(−−accept <param>)</p></td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
|
||||
|
||||
<p>−%X</p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>additional HTTP header line (−%X
|
||||
"X−Magic: 42" (−−headers
|
||||
<param>)</p> </td></tr>
|
||||
</table>
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em"><b>Log, index,
|
||||
@@ -1632,18 +1631,6 @@ memory boundary checks)
|
||||
|
||||
<p>generate transfer rate statictics every minutes
|
||||
(−−debug−ratestats)</p> </td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="6%">
|
||||
|
||||
|
||||
<p>−#!</p></td>
|
||||
<td width="5%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>execute a shell command (−#! "echo
|
||||
hello") (−−exec <param>)</p></td></tr>
|
||||
</table>
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em"><b>Dangerous
|
||||
@@ -1707,25 +1694,13 @@ specific options:</b></p>
|
||||
|
||||
|
||||
<p style="margin-top: 1em">execute system command after
|
||||
each files ($0 is the filename: −V "rm ")
|
||||
each files ($0 is the filename: −V "rm \$0")
|
||||
(−−userdef−cmd <param>)</p></td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
|
||||
|
||||
<p>−%U</p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>run the engine with another id when called as root
|
||||
(−%U smith) (−−user <param>)</p></td></tr>
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
|
||||
|
||||
<p>−%W</p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="78%">
|
||||
@@ -2311,7 +2286,7 @@ other information you deem necessary.</p>
|
||||
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em">Copyright (C)
|
||||
1998-2013 Xavier Roche and other contributors</p>
|
||||
1998-2014 Xavier Roche and other contributors</p>
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em">This program is
|
||||
free software: you can redistribute it and/or modify it
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
HTTrack Website Copier License Agreement:
|
||||
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
.\" Process this file with
|
||||
.\" groff -man -Tascii httrack.1
|
||||
.\"
|
||||
.TH httrack 1 "HTTrack version 3.47-26 (compiled Sep 6 2013)" "httrack website copier"
|
||||
.TH httrack 1 "15 May 2014" "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
|
||||
@@ -42,8 +40,6 @@ httrack \- offline browser : copy websites to a local directory
|
||||
] [
|
||||
.B \-GN, \-\-max\-pause[=N]
|
||||
] [
|
||||
.B \-%mN, \-\-max\-mms\-time[=N]
|
||||
] [
|
||||
.B \-cN, \-\-sockets[=N]
|
||||
] [
|
||||
.B \-TN, \-\-timeout[=N]
|
||||
@@ -122,6 +118,10 @@ httrack \- offline browser : copy websites to a local directory
|
||||
] [
|
||||
.B \-%l, \-\-language
|
||||
] [
|
||||
.B \-%a, \-\-accept
|
||||
] [
|
||||
.B \-%X, \-\-headers
|
||||
] [
|
||||
.B \-C, \-\-cache[=N]
|
||||
] [
|
||||
.B \-k, \-\-store\-all\-in\-cache
|
||||
@@ -174,8 +174,6 @@ httrack \- offline browser : copy websites to a local directory
|
||||
] [
|
||||
.B \-V, \-\-userdef\-cmd
|
||||
] [
|
||||
.B \-%U, \-\-user
|
||||
] [
|
||||
.B \-%W, \-\-callback
|
||||
] [
|
||||
.B \-K, \-\-keep\-links[=N]
|
||||
@@ -214,9 +212,6 @@ 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
|
||||
@@ -257,8 +252,6 @@ maximum transfer rate in bytes/seconds (1000=1KB/s max) (\-\-max\-rate[=N])
|
||||
maximum number of connections/seconds (*%c10) (\-\-connection\-per\-second[=N])
|
||||
.IP \-GN
|
||||
pause transfer if N bytes reached, and wait until lock file is deleted (\-\-max\-pause[=N])
|
||||
.IP \-%mN
|
||||
maximum mms stream download time in seconds (60=1 minute, 3600=1 hour) (\-\-max\-mms\-time[=N])
|
||||
|
||||
.SS Flow control:
|
||||
.IP \-cN
|
||||
@@ -353,6 +346,10 @@ from email address sent in HTTP headers (\-\-from <param>)
|
||||
footer string in Html code (\-%F "Mirrored [from host %s [file %s [at %s]]]" (\-\-footer <param>)
|
||||
.IP \-%l
|
||||
preffered language (\-%l "fr, en, jp, *" (\-\-language <param>)
|
||||
.IP \-%a
|
||||
accepted formats (\-%l "text/html,image/png,image/jpeg,image/gif;q=0.9,*/*;q=0.1" (\-\-accept <param>)
|
||||
.IP \-%X
|
||||
additional HTTP header line (\-%X "X\-Magic: 42" (\-\-headers <param>)
|
||||
|
||||
.SS Log, index, cache
|
||||
.IP \-C
|
||||
@@ -455,8 +452,6 @@ generate transfer ops. log every minutes (\-\-debug\-xfrstats)
|
||||
wait time (\-\-advanced\-wait)
|
||||
.IP \-#Z
|
||||
generate transfer rate statictics every minutes (\-\-debug\-ratestats)
|
||||
.IP \-#!
|
||||
execute a shell command (\-#! "echo hello") (\-\-exec <param>)
|
||||
|
||||
.SS Dangerous options: (do NOT use unless you exactly know what you are doing)
|
||||
.IP \-%!
|
||||
@@ -468,9 +463,7 @@ IT WITH EXTREME CARE
|
||||
|
||||
.SS Command\-line specific options:
|
||||
.IP \-V
|
||||
execute system command after each files ($0 is the filename: \-V "rm \$0") (\-\-userdef\-cmd <param>)
|
||||
.IP \-%U
|
||||
run the engine with another id when called as root (\-%U smith) (\-\-user <param>)
|
||||
execute system command after each files ($0 is the filename: \-V "rm \\$0") (\-\-userdef\-cmd <param>)
|
||||
.IP \-%W
|
||||
use an external library function as a wrapper (\-%W myfoo.so[,myparameters]) (\-\-callback <param>)
|
||||
|
||||
@@ -617,7 +610,7 @@ Please reports bugs to
|
||||
.B <bugs@httrack.com>.
|
||||
Include a complete, self-contained example that will allow the bug to be reproduced, and say which version of httrack you are using. Do not forget to detail options used, OS version, and any other information you deem necessary.
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -44,11 +44,11 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.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 htswrap.c \
|
||||
htsmd5.c htszlib.c htswrap.c htsconcat.c \
|
||||
htsmodules.c htscharset.c punycode.c htsencoding.c \
|
||||
md5.c \
|
||||
minizip/ioapi.c minizip/mztools.c minizip/unzip.c minizip/zip.c \
|
||||
hts-indextmpl.h htsalias.h htsback.h htsbase.h \
|
||||
hts-indextmpl.h htsalias.h htsback.h htsbase.h htssafe.h \
|
||||
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 \
|
||||
@@ -61,6 +61,7 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
|
||||
md5.h murmurhash3.h \
|
||||
minizip/crypt.h minizip/ioapi.h minizip/mztools.h minizip/unzip.h minizip/zip.h
|
||||
libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(OPENSSL_LIBS) $(DL_LIBS) $(SOCKET_LIBS) $(ICONV_LIBS)
|
||||
libhttrack_la_CFLAGS = $(AM_CFLAGS) -DLIBHTTRACK_EXPORTS
|
||||
libhttrack_la_LDFLAGS = -version-info $(VERSION_INFO)
|
||||
|
||||
libhtsjava_la_SOURCES = htsjava.c htsjava.h
|
||||
|
||||
341
src/Makefile.in
341
src/Makefile.in
@@ -110,17 +110,27 @@ libhtsjava_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
libhttrack_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
am_libhttrack_la_OBJECTS = htscore.lo htsparse.lo htsback.lo \
|
||||
htscache.lo htscatchurl.lo htsfilters.lo htsftp.lo htshash.lo \
|
||||
htsinthash.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 htscharset.lo punycode.lo htsencoding.lo md5.lo \
|
||||
ioapi.lo mztools.lo unzip.lo zip.lo
|
||||
am_libhttrack_la_OBJECTS = libhttrack_la-htscore.lo \
|
||||
libhttrack_la-htsparse.lo libhttrack_la-htsback.lo \
|
||||
libhttrack_la-htscache.lo libhttrack_la-htscatchurl.lo \
|
||||
libhttrack_la-htsfilters.lo libhttrack_la-htsftp.lo \
|
||||
libhttrack_la-htshash.lo libhttrack_la-htsinthash.lo \
|
||||
libhttrack_la-htshelp.lo libhttrack_la-htslib.lo \
|
||||
libhttrack_la-htscoremain.lo libhttrack_la-htsname.lo \
|
||||
libhttrack_la-htsrobots.lo libhttrack_la-htstools.lo \
|
||||
libhttrack_la-htswizard.lo libhttrack_la-htsalias.lo \
|
||||
libhttrack_la-htsthread.lo libhttrack_la-htsindex.lo \
|
||||
libhttrack_la-htsbauth.lo libhttrack_la-htsmd5.lo \
|
||||
libhttrack_la-htszlib.lo libhttrack_la-htswrap.lo \
|
||||
libhttrack_la-htsconcat.lo libhttrack_la-htsmodules.lo \
|
||||
libhttrack_la-htscharset.lo libhttrack_la-punycode.lo \
|
||||
libhttrack_la-htsencoding.lo libhttrack_la-md5.lo \
|
||||
libhttrack_la-ioapi.lo libhttrack_la-mztools.lo \
|
||||
libhttrack_la-unzip.lo libhttrack_la-zip.lo
|
||||
libhttrack_la_OBJECTS = $(am_libhttrack_la_OBJECTS)
|
||||
libhttrack_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libhttrack_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libhttrack_la_CFLAGS) \
|
||||
$(CFLAGS) $(libhttrack_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_htsserver_OBJECTS = htsserver.$(OBJEXT) htsweb.$(OBJEXT)
|
||||
htsserver_OBJECTS = $(am_htsserver_OBJECTS)
|
||||
@@ -341,11 +351,11 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.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 htswrap.c \
|
||||
htsmd5.c htszlib.c htswrap.c htsconcat.c \
|
||||
htsmodules.c htscharset.c punycode.c htsencoding.c \
|
||||
md5.c \
|
||||
minizip/ioapi.c minizip/mztools.c minizip/unzip.c minizip/zip.c \
|
||||
hts-indextmpl.h htsalias.h htsback.h htsbase.h \
|
||||
hts-indextmpl.h htsalias.h htsback.h htsbase.h htssafe.h \
|
||||
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 \
|
||||
@@ -359,6 +369,7 @@ 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
|
||||
|
||||
libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(OPENSSL_LIBS) $(DL_LIBS) $(SOCKET_LIBS) $(ICONV_LIBS)
|
||||
libhttrack_la_CFLAGS = $(AM_CFLAGS) -DLIBHTTRACK_EXPORTS
|
||||
libhttrack_la_LDFLAGS = -version-info $(VERSION_INFO)
|
||||
libhtsjava_la_SOURCES = htsjava.c htsjava.h
|
||||
libhtsjava_la_LIBADD = $(THREADS_LIBS) $(DL_LIBS) libhttrack.la
|
||||
@@ -542,39 +553,43 @@ mostlyclean-compile:
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsalias.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsback.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsbauth.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htscache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htscatchurl.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htscharset.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htscore.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htscoremain.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsencoding.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsfilters.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsftp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htshash.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htshelp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsindex.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsinthash.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsjava.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htslib.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsmd5.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)/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@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsthread.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htstools.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htsweb.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htswizard.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htswrap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htszlib.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httrack.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioapi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mztools.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsalias.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsback.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsbauth.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htscache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htscatchurl.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htscharset.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsconcat.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htscore.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htscoremain.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsencoding.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsfilters.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsftp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htshash.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htshelp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsindex.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsinthash.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htslib.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsmd5.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsmodules.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsname.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsparse.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsrobots.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htsthread.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htstools.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htswizard.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htswrap.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-htszlib.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-ioapi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-md5.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-mztools.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-punycode.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-unzip.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhttrack_la-zip.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxytrack-htsinthash.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxytrack-htsmd5.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxytrack-ioapi.Po@am__quote@
|
||||
@@ -585,9 +600,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxytrack-store.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxytrack-unzip.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxytrack-zip.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/punycode.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unzip.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@@ -610,33 +622,236 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
ioapi.lo: minizip/ioapi.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ioapi.lo -MD -MP -MF $(DEPDIR)/ioapi.Tpo -c -o ioapi.lo `test -f 'minizip/ioapi.c' || echo '$(srcdir)/'`minizip/ioapi.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ioapi.Tpo $(DEPDIR)/ioapi.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/ioapi.c' object='ioapi.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libhttrack_la-htscore.lo: htscore.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htscore.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htscore.Tpo -c -o libhttrack_la-htscore.lo `test -f 'htscore.c' || echo '$(srcdir)/'`htscore.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htscore.Tpo $(DEPDIR)/libhttrack_la-htscore.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htscore.c' object='libhttrack_la-htscore.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ioapi.lo `test -f 'minizip/ioapi.c' || echo '$(srcdir)/'`minizip/ioapi.c
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htscore.lo `test -f 'htscore.c' || echo '$(srcdir)/'`htscore.c
|
||||
|
||||
mztools.lo: minizip/mztools.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mztools.lo -MD -MP -MF $(DEPDIR)/mztools.Tpo -c -o mztools.lo `test -f 'minizip/mztools.c' || echo '$(srcdir)/'`minizip/mztools.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mztools.Tpo $(DEPDIR)/mztools.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/mztools.c' object='mztools.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libhttrack_la-htsparse.lo: htsparse.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsparse.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsparse.Tpo -c -o libhttrack_la-htsparse.lo `test -f 'htsparse.c' || echo '$(srcdir)/'`htsparse.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsparse.Tpo $(DEPDIR)/libhttrack_la-htsparse.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsparse.c' object='libhttrack_la-htsparse.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mztools.lo `test -f 'minizip/mztools.c' || echo '$(srcdir)/'`minizip/mztools.c
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsparse.lo `test -f 'htsparse.c' || echo '$(srcdir)/'`htsparse.c
|
||||
|
||||
unzip.lo: minizip/unzip.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT unzip.lo -MD -MP -MF $(DEPDIR)/unzip.Tpo -c -o unzip.lo `test -f 'minizip/unzip.c' || echo '$(srcdir)/'`minizip/unzip.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unzip.Tpo $(DEPDIR)/unzip.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/unzip.c' object='unzip.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libhttrack_la-htsback.lo: htsback.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsback.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsback.Tpo -c -o libhttrack_la-htsback.lo `test -f 'htsback.c' || echo '$(srcdir)/'`htsback.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsback.Tpo $(DEPDIR)/libhttrack_la-htsback.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsback.c' object='libhttrack_la-htsback.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o unzip.lo `test -f 'minizip/unzip.c' || echo '$(srcdir)/'`minizip/unzip.c
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsback.lo `test -f 'htsback.c' || echo '$(srcdir)/'`htsback.c
|
||||
|
||||
zip.lo: minizip/zip.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zip.lo -MD -MP -MF $(DEPDIR)/zip.Tpo -c -o zip.lo `test -f 'minizip/zip.c' || echo '$(srcdir)/'`minizip/zip.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/zip.Tpo $(DEPDIR)/zip.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/zip.c' object='zip.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
libhttrack_la-htscache.lo: htscache.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htscache.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htscache.Tpo -c -o libhttrack_la-htscache.lo `test -f 'htscache.c' || echo '$(srcdir)/'`htscache.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htscache.Tpo $(DEPDIR)/libhttrack_la-htscache.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htscache.c' object='libhttrack_la-htscache.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zip.lo `test -f 'minizip/zip.c' || echo '$(srcdir)/'`minizip/zip.c
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htscache.lo `test -f 'htscache.c' || echo '$(srcdir)/'`htscache.c
|
||||
|
||||
libhttrack_la-htscatchurl.lo: htscatchurl.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htscatchurl.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htscatchurl.Tpo -c -o libhttrack_la-htscatchurl.lo `test -f 'htscatchurl.c' || echo '$(srcdir)/'`htscatchurl.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htscatchurl.Tpo $(DEPDIR)/libhttrack_la-htscatchurl.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htscatchurl.c' object='libhttrack_la-htscatchurl.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htscatchurl.lo `test -f 'htscatchurl.c' || echo '$(srcdir)/'`htscatchurl.c
|
||||
|
||||
libhttrack_la-htsfilters.lo: htsfilters.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsfilters.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsfilters.Tpo -c -o libhttrack_la-htsfilters.lo `test -f 'htsfilters.c' || echo '$(srcdir)/'`htsfilters.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsfilters.Tpo $(DEPDIR)/libhttrack_la-htsfilters.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsfilters.c' object='libhttrack_la-htsfilters.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsfilters.lo `test -f 'htsfilters.c' || echo '$(srcdir)/'`htsfilters.c
|
||||
|
||||
libhttrack_la-htsftp.lo: htsftp.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsftp.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsftp.Tpo -c -o libhttrack_la-htsftp.lo `test -f 'htsftp.c' || echo '$(srcdir)/'`htsftp.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsftp.Tpo $(DEPDIR)/libhttrack_la-htsftp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsftp.c' object='libhttrack_la-htsftp.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsftp.lo `test -f 'htsftp.c' || echo '$(srcdir)/'`htsftp.c
|
||||
|
||||
libhttrack_la-htshash.lo: htshash.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htshash.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htshash.Tpo -c -o libhttrack_la-htshash.lo `test -f 'htshash.c' || echo '$(srcdir)/'`htshash.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htshash.Tpo $(DEPDIR)/libhttrack_la-htshash.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htshash.c' object='libhttrack_la-htshash.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htshash.lo `test -f 'htshash.c' || echo '$(srcdir)/'`htshash.c
|
||||
|
||||
libhttrack_la-htsinthash.lo: htsinthash.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsinthash.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsinthash.Tpo -c -o libhttrack_la-htsinthash.lo `test -f 'htsinthash.c' || echo '$(srcdir)/'`htsinthash.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsinthash.Tpo $(DEPDIR)/libhttrack_la-htsinthash.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsinthash.c' object='libhttrack_la-htsinthash.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsinthash.lo `test -f 'htsinthash.c' || echo '$(srcdir)/'`htsinthash.c
|
||||
|
||||
libhttrack_la-htshelp.lo: htshelp.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htshelp.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htshelp.Tpo -c -o libhttrack_la-htshelp.lo `test -f 'htshelp.c' || echo '$(srcdir)/'`htshelp.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htshelp.Tpo $(DEPDIR)/libhttrack_la-htshelp.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htshelp.c' object='libhttrack_la-htshelp.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htshelp.lo `test -f 'htshelp.c' || echo '$(srcdir)/'`htshelp.c
|
||||
|
||||
libhttrack_la-htslib.lo: htslib.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htslib.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htslib.Tpo -c -o libhttrack_la-htslib.lo `test -f 'htslib.c' || echo '$(srcdir)/'`htslib.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htslib.Tpo $(DEPDIR)/libhttrack_la-htslib.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htslib.c' object='libhttrack_la-htslib.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htslib.lo `test -f 'htslib.c' || echo '$(srcdir)/'`htslib.c
|
||||
|
||||
libhttrack_la-htscoremain.lo: htscoremain.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htscoremain.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htscoremain.Tpo -c -o libhttrack_la-htscoremain.lo `test -f 'htscoremain.c' || echo '$(srcdir)/'`htscoremain.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htscoremain.Tpo $(DEPDIR)/libhttrack_la-htscoremain.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htscoremain.c' object='libhttrack_la-htscoremain.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htscoremain.lo `test -f 'htscoremain.c' || echo '$(srcdir)/'`htscoremain.c
|
||||
|
||||
libhttrack_la-htsname.lo: htsname.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsname.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsname.Tpo -c -o libhttrack_la-htsname.lo `test -f 'htsname.c' || echo '$(srcdir)/'`htsname.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsname.Tpo $(DEPDIR)/libhttrack_la-htsname.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsname.c' object='libhttrack_la-htsname.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsname.lo `test -f 'htsname.c' || echo '$(srcdir)/'`htsname.c
|
||||
|
||||
libhttrack_la-htsrobots.lo: htsrobots.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsrobots.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsrobots.Tpo -c -o libhttrack_la-htsrobots.lo `test -f 'htsrobots.c' || echo '$(srcdir)/'`htsrobots.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsrobots.Tpo $(DEPDIR)/libhttrack_la-htsrobots.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsrobots.c' object='libhttrack_la-htsrobots.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsrobots.lo `test -f 'htsrobots.c' || echo '$(srcdir)/'`htsrobots.c
|
||||
|
||||
libhttrack_la-htstools.lo: htstools.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htstools.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htstools.Tpo -c -o libhttrack_la-htstools.lo `test -f 'htstools.c' || echo '$(srcdir)/'`htstools.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htstools.Tpo $(DEPDIR)/libhttrack_la-htstools.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htstools.c' object='libhttrack_la-htstools.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htstools.lo `test -f 'htstools.c' || echo '$(srcdir)/'`htstools.c
|
||||
|
||||
libhttrack_la-htswizard.lo: htswizard.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htswizard.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htswizard.Tpo -c -o libhttrack_la-htswizard.lo `test -f 'htswizard.c' || echo '$(srcdir)/'`htswizard.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htswizard.Tpo $(DEPDIR)/libhttrack_la-htswizard.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htswizard.c' object='libhttrack_la-htswizard.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htswizard.lo `test -f 'htswizard.c' || echo '$(srcdir)/'`htswizard.c
|
||||
|
||||
libhttrack_la-htsalias.lo: htsalias.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsalias.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsalias.Tpo -c -o libhttrack_la-htsalias.lo `test -f 'htsalias.c' || echo '$(srcdir)/'`htsalias.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsalias.Tpo $(DEPDIR)/libhttrack_la-htsalias.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsalias.c' object='libhttrack_la-htsalias.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsalias.lo `test -f 'htsalias.c' || echo '$(srcdir)/'`htsalias.c
|
||||
|
||||
libhttrack_la-htsthread.lo: htsthread.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsthread.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsthread.Tpo -c -o libhttrack_la-htsthread.lo `test -f 'htsthread.c' || echo '$(srcdir)/'`htsthread.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsthread.Tpo $(DEPDIR)/libhttrack_la-htsthread.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsthread.c' object='libhttrack_la-htsthread.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsthread.lo `test -f 'htsthread.c' || echo '$(srcdir)/'`htsthread.c
|
||||
|
||||
libhttrack_la-htsindex.lo: htsindex.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsindex.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsindex.Tpo -c -o libhttrack_la-htsindex.lo `test -f 'htsindex.c' || echo '$(srcdir)/'`htsindex.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsindex.Tpo $(DEPDIR)/libhttrack_la-htsindex.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsindex.c' object='libhttrack_la-htsindex.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsindex.lo `test -f 'htsindex.c' || echo '$(srcdir)/'`htsindex.c
|
||||
|
||||
libhttrack_la-htsbauth.lo: htsbauth.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsbauth.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsbauth.Tpo -c -o libhttrack_la-htsbauth.lo `test -f 'htsbauth.c' || echo '$(srcdir)/'`htsbauth.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsbauth.Tpo $(DEPDIR)/libhttrack_la-htsbauth.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsbauth.c' object='libhttrack_la-htsbauth.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsbauth.lo `test -f 'htsbauth.c' || echo '$(srcdir)/'`htsbauth.c
|
||||
|
||||
libhttrack_la-htsmd5.lo: htsmd5.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsmd5.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsmd5.Tpo -c -o libhttrack_la-htsmd5.lo `test -f 'htsmd5.c' || echo '$(srcdir)/'`htsmd5.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsmd5.Tpo $(DEPDIR)/libhttrack_la-htsmd5.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsmd5.c' object='libhttrack_la-htsmd5.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsmd5.lo `test -f 'htsmd5.c' || echo '$(srcdir)/'`htsmd5.c
|
||||
|
||||
libhttrack_la-htszlib.lo: htszlib.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htszlib.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htszlib.Tpo -c -o libhttrack_la-htszlib.lo `test -f 'htszlib.c' || echo '$(srcdir)/'`htszlib.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htszlib.Tpo $(DEPDIR)/libhttrack_la-htszlib.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htszlib.c' object='libhttrack_la-htszlib.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htszlib.lo `test -f 'htszlib.c' || echo '$(srcdir)/'`htszlib.c
|
||||
|
||||
libhttrack_la-htswrap.lo: htswrap.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htswrap.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htswrap.Tpo -c -o libhttrack_la-htswrap.lo `test -f 'htswrap.c' || echo '$(srcdir)/'`htswrap.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htswrap.Tpo $(DEPDIR)/libhttrack_la-htswrap.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htswrap.c' object='libhttrack_la-htswrap.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htswrap.lo `test -f 'htswrap.c' || echo '$(srcdir)/'`htswrap.c
|
||||
|
||||
libhttrack_la-htsconcat.lo: htsconcat.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsconcat.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsconcat.Tpo -c -o libhttrack_la-htsconcat.lo `test -f 'htsconcat.c' || echo '$(srcdir)/'`htsconcat.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsconcat.Tpo $(DEPDIR)/libhttrack_la-htsconcat.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsconcat.c' object='libhttrack_la-htsconcat.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsconcat.lo `test -f 'htsconcat.c' || echo '$(srcdir)/'`htsconcat.c
|
||||
|
||||
libhttrack_la-htsmodules.lo: htsmodules.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsmodules.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsmodules.Tpo -c -o libhttrack_la-htsmodules.lo `test -f 'htsmodules.c' || echo '$(srcdir)/'`htsmodules.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsmodules.Tpo $(DEPDIR)/libhttrack_la-htsmodules.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsmodules.c' object='libhttrack_la-htsmodules.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsmodules.lo `test -f 'htsmodules.c' || echo '$(srcdir)/'`htsmodules.c
|
||||
|
||||
libhttrack_la-htscharset.lo: htscharset.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htscharset.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htscharset.Tpo -c -o libhttrack_la-htscharset.lo `test -f 'htscharset.c' || echo '$(srcdir)/'`htscharset.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htscharset.Tpo $(DEPDIR)/libhttrack_la-htscharset.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htscharset.c' object='libhttrack_la-htscharset.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htscharset.lo `test -f 'htscharset.c' || echo '$(srcdir)/'`htscharset.c
|
||||
|
||||
libhttrack_la-punycode.lo: punycode.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-punycode.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-punycode.Tpo -c -o libhttrack_la-punycode.lo `test -f 'punycode.c' || echo '$(srcdir)/'`punycode.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-punycode.Tpo $(DEPDIR)/libhttrack_la-punycode.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='punycode.c' object='libhttrack_la-punycode.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-punycode.lo `test -f 'punycode.c' || echo '$(srcdir)/'`punycode.c
|
||||
|
||||
libhttrack_la-htsencoding.lo: htsencoding.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-htsencoding.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-htsencoding.Tpo -c -o libhttrack_la-htsencoding.lo `test -f 'htsencoding.c' || echo '$(srcdir)/'`htsencoding.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-htsencoding.Tpo $(DEPDIR)/libhttrack_la-htsencoding.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='htsencoding.c' object='libhttrack_la-htsencoding.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-htsencoding.lo `test -f 'htsencoding.c' || echo '$(srcdir)/'`htsencoding.c
|
||||
|
||||
libhttrack_la-md5.lo: md5.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-md5.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-md5.Tpo -c -o libhttrack_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-md5.Tpo $(DEPDIR)/libhttrack_la-md5.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='libhttrack_la-md5.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c
|
||||
|
||||
libhttrack_la-ioapi.lo: minizip/ioapi.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-ioapi.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-ioapi.Tpo -c -o libhttrack_la-ioapi.lo `test -f 'minizip/ioapi.c' || echo '$(srcdir)/'`minizip/ioapi.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-ioapi.Tpo $(DEPDIR)/libhttrack_la-ioapi.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/ioapi.c' object='libhttrack_la-ioapi.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-ioapi.lo `test -f 'minizip/ioapi.c' || echo '$(srcdir)/'`minizip/ioapi.c
|
||||
|
||||
libhttrack_la-mztools.lo: minizip/mztools.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-mztools.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-mztools.Tpo -c -o libhttrack_la-mztools.lo `test -f 'minizip/mztools.c' || echo '$(srcdir)/'`minizip/mztools.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-mztools.Tpo $(DEPDIR)/libhttrack_la-mztools.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/mztools.c' object='libhttrack_la-mztools.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-mztools.lo `test -f 'minizip/mztools.c' || echo '$(srcdir)/'`minizip/mztools.c
|
||||
|
||||
libhttrack_la-unzip.lo: minizip/unzip.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-unzip.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-unzip.Tpo -c -o libhttrack_la-unzip.lo `test -f 'minizip/unzip.c' || echo '$(srcdir)/'`minizip/unzip.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-unzip.Tpo $(DEPDIR)/libhttrack_la-unzip.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/unzip.c' object='libhttrack_la-unzip.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-unzip.lo `test -f 'minizip/unzip.c' || echo '$(srcdir)/'`minizip/unzip.c
|
||||
|
||||
libhttrack_la-zip.lo: minizip/zip.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -MT libhttrack_la-zip.lo -MD -MP -MF $(DEPDIR)/libhttrack_la-zip.Tpo -c -o libhttrack_la-zip.lo `test -f 'minizip/zip.c' || echo '$(srcdir)/'`minizip/zip.c
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libhttrack_la-zip.Tpo $(DEPDIR)/libhttrack_la-zip.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='minizip/zip.c' object='libhttrack_la-zip.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhttrack_la_CFLAGS) $(CFLAGS) -c -o libhttrack_la-zip.lo `test -f 'minizip/zip.c' || echo '$(srcdir)/'`minizip/zip.c
|
||||
|
||||
proxytrack-main.o: proxy/main.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(proxytrack_CFLAGS) $(CFLAGS) -MT proxytrack-main.o -MD -MP -MF $(DEPDIR)/proxytrack-main.Tpo -c -o proxytrack-main.o `test -f 'proxy/main.c' || echo '$(srcdir)/'`proxy/main.c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -168,7 +168,7 @@ regen:
|
||||
" <BR>"LF\
|
||||
" <BR>"LF\
|
||||
" <H6 ALIGN=\"RIGHT\">"LF\
|
||||
" <I>Mirror and index made by HTTrack Website Copier [XR&CO'2013]</I>"LF\
|
||||
" <I>Mirror and index made by HTTrack Website Copier [XR&CO'2014]</I>"LF\
|
||||
" </H6>"LF\
|
||||
" %s"LF\
|
||||
" <!-- Thanks for using HTTrack Website Copier! -->"LF\
|
||||
@@ -186,7 +186,7 @@ regen:
|
||||
""LF\
|
||||
"<table width=\"76%%\" border=\"0\" align=\"center\" valign=\"bottom\" cellspacing=\"0\" cellpadding=\"0\">"LF\
|
||||
" <tr>"LF\
|
||||
" <td id=\"footer\"><small>© 2013 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" <td id=\"footer\"><small>© 2014 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" </tr>"LF\
|
||||
"</table>"LF\
|
||||
""LF\
|
||||
@@ -317,7 +317,7 @@ regen:
|
||||
" </TABLE>"LF\
|
||||
" <BR>"LF\
|
||||
" <H6 ALIGN=\"RIGHT\">"LF\
|
||||
" <I>Mirror and index made by HTTrack Website Copier [XR&CO'2013]</I>"LF\
|
||||
" <I>Mirror and index made by HTTrack Website Copier [XR&CO'2014]</I>"LF\
|
||||
" </H6>"LF\
|
||||
" %s"LF\
|
||||
" <!-- Thanks for using HTTrack Website Copier! -->"LF\
|
||||
@@ -335,7 +335,7 @@ regen:
|
||||
""LF\
|
||||
"<table width=\"76%%\" border=\"0\" align=\"center\" valign=\"bottom\" cellspacing=\"0\" cellpadding=\"0\">"LF\
|
||||
" <tr>"LF\
|
||||
" <td id=\"footer\"><small>© 2013 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" <td id=\"footer\"><small>© 2014 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" </tr>"LF\
|
||||
"</table>"LF\
|
||||
""LF\
|
||||
@@ -475,7 +475,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>© 2013 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" <td id=\"footer\"><small>© 2014 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" </tr>"LF\
|
||||
"</table>"LF\
|
||||
""LF\
|
||||
@@ -612,7 +612,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>© 2013 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" <td id=\"footer\"><small>© 2014 Xavier Roche & other contributors - Web Design: Kauler Leto.</small></td>"LF\
|
||||
" </tr>"LF\
|
||||
"</table>"LF\
|
||||
""LF\
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -37,20 +37,9 @@ Please visit our Website: http://www.httrack.com
|
||||
#include "htsbase.h"
|
||||
#include "htsalias.h"
|
||||
#include "htsglobal.h"
|
||||
|
||||
void linput(FILE * fp, char *s, int max);
|
||||
void hts_lowcase(char *s);
|
||||
#include "htslib.h"
|
||||
|
||||
#define _NOT_NULL(a) ( (a!=NULL) ? (a) : "" )
|
||||
// #define is_realspace(c) (strchr(" \x0d\x0a\x09\x0b\x0c",(c))!=NULL)
|
||||
#define is_realspace(c) ( \
|
||||
(c) == ' ' \
|
||||
|| (c) == '\x09' \
|
||||
|| (c) == '\x0a' \
|
||||
|| (c) == '\x0b' \
|
||||
|| (c) == '\x0c' \
|
||||
|| (c) == '\x0d' \
|
||||
)
|
||||
|
||||
// COPY OF cmdl_ins in htsmain.c
|
||||
// Insert a command in the argc/argv
|
||||
@@ -528,9 +517,9 @@ int optinclude_file(const char *name, int *argc, char **argv, char *x_argvblk,
|
||||
tmp_argv[1] = _tmp_argv[1];
|
||||
tmp_argv[2] = _tmp_argv[2];
|
||||
tmp_argv[3] = _tmp_argv[3];
|
||||
strcpybuff(tmp_argv[0], "--");
|
||||
strcatbuff(tmp_argv[0], a);
|
||||
strcpybuff(tmp_argv[1], b);
|
||||
strcpybuff(_tmp_argv[0], "--");
|
||||
strcatbuff(_tmp_argv[0], a);
|
||||
strcpybuff(_tmp_argv[1], b);
|
||||
|
||||
result =
|
||||
optalias_check(2, (const char *const *) tmp_argv, 0, &return_argc,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -67,13 +67,15 @@ static int slot_can_be_cached_on_disk(const lien_back * back);
|
||||
static int slot_can_be_cleaned(const lien_back * back);
|
||||
static int slot_can_be_finalized(httrackp * opt, const lien_back * back);
|
||||
|
||||
struct_back *back_new(int back_max) {
|
||||
struct_back *back_new(httrackp *opt, int back_max) {
|
||||
int i;
|
||||
struct_back *sback = calloct(1, sizeof(struct_back));
|
||||
|
||||
sback->count = back_max;
|
||||
sback->lnk = (lien_back *) calloct((back_max + 1), sizeof(lien_back));
|
||||
sback->ready = inthash_new(0);
|
||||
hts_set_hash_handler(sback->ready, opt);
|
||||
inthash_set_name(sback->ready, "back_new");
|
||||
sback->ready_size_bytes = 0;
|
||||
inthash_value_is_malloc(sback->ready, 1);
|
||||
// init
|
||||
@@ -195,7 +197,7 @@ static int back_index_ready(httrackp * opt, struct_back * sback, char *adr,
|
||||
char *fileback = (char *) ptr;
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
|
||||
if ((fp = FOPEN(fconv(catbuff, fileback), "rb")) != NULL) {
|
||||
if ((fp = FOPEN(fconv(catbuff, sizeof(catbuff), fileback), "rb")) != NULL) {
|
||||
if (back_unserialize(fp, &itemback) != 0) {
|
||||
if (itemback != NULL) {
|
||||
back_clear_entry(itemback);
|
||||
@@ -526,7 +528,7 @@ int back_finalize(httrackp * opt, cache_back * cache, struct_back * sback,
|
||||
if (!back[p].r.is_write) {
|
||||
// do not use tempnam() but a regular filename
|
||||
if (create_back_tmpfile(opt, &back[p]) == 0) {
|
||||
assert(back[p].tmpfile != NULL);
|
||||
assertf(back[p].tmpfile != NULL);
|
||||
/* note: tmpfile is utf-8 */
|
||||
back[p].r.out = FOPEN(back[p].tmpfile, "wb");
|
||||
if (back[p].r.out) {
|
||||
@@ -640,7 +642,7 @@ int back_finalize(httrackp * opt, cache_back * cache, struct_back * sback,
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
// remove (temporary) file!
|
||||
UNLINK(fconv(catbuff, back[p].url_sav));
|
||||
UNLINK(fconv(catbuff, sizeof(catbuff), back[p].url_sav));
|
||||
}
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
@@ -664,7 +666,7 @@ int back_finalize(httrackp * opt, cache_back * cache, struct_back * sback,
|
||||
if (A == NULL) {
|
||||
int localtime_returned_null = 0;
|
||||
|
||||
assert(localtime_returned_null);
|
||||
assertf(localtime_returned_null);
|
||||
}
|
||||
strftime(s, 250, "%H:%M:%S", A);
|
||||
|
||||
@@ -765,27 +767,27 @@ int back_finalize(httrackp * opt, cache_back * cache, struct_back * sback,
|
||||
}
|
||||
}
|
||||
if (cache->txt) {
|
||||
#undef ESC_URL
|
||||
#define ESC_URL(S) escape_check_url_addr(S, OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt))
|
||||
fprintf(cache->txt,
|
||||
"%d\t" "%s ('%s')\t" "%s\t" "%s%s\t" "%s%s%s\t%s\t"
|
||||
"(from %s%s%s)" LF, back[p].r.statuscode, state,
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt), back[p].r.msg),
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt),
|
||||
back[p].r.contenttype),
|
||||
((back[p].r.
|
||||
etag[0]) ? "etag:" : ((back[p].r.
|
||||
ESC_URL(back[p].r.msg),
|
||||
ESC_URL(back[p].r.contenttype),
|
||||
((back[p].r.etag[0]) ? "etag:" : ((back[p].r.
|
||||
lastmodified[0]) ? "date:" : "")),
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt),
|
||||
(back[p].r.etag[0]) ? back[p].r.
|
||||
ESC_URL((back[p].r.etag[0]) ? back[p].r.
|
||||
etag : (back[p].r.lastmodified)),
|
||||
(link_has_authority(back[p].url_adr) ? "" : "http://"),
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt), back[p].url_adr),
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt), back[p].url_fil),
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt), back[p].url_sav),
|
||||
ESC_URL(back[p].url_adr),
|
||||
ESC_URL(back[p].url_fil),
|
||||
ESC_URL(back[p].url_sav),
|
||||
(link_has_authority(back[p].referer_adr)
|
||||
|| !back[p].referer_adr[0]) ? "" : "http://",
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt), back[p].referer_adr),
|
||||
escape_check_url_addr(OPT_GET_BUFF(opt), back[p].referer_fil)
|
||||
ESC_URL(back[p].referer_adr),
|
||||
ESC_URL(back[p].referer_fil)
|
||||
);
|
||||
#undef ESC_URL
|
||||
if (opt->flush)
|
||||
fflush(cache->txt);
|
||||
}
|
||||
@@ -985,11 +987,11 @@ int back_serialize_ref(httrackp * opt, const lien_back * src) {
|
||||
if (fp == NULL) {
|
||||
#ifdef _WIN32
|
||||
if (mkdir
|
||||
(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), CACHE_REFNAME))
|
||||
(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), CACHE_REFNAME))
|
||||
== 0)
|
||||
#else
|
||||
if (mkdir
|
||||
(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), CACHE_REFNAME),
|
||||
(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), CACHE_REFNAME),
|
||||
S_IRWXU | S_IRWXG | S_IRWXO) == 0)
|
||||
#endif
|
||||
{
|
||||
@@ -1058,7 +1060,7 @@ int back_maydelete(httrackp * opt, cache_back * cache, struct_back * sback,
|
||||
strcpybuff(back[p].url_adr, tmp.url_adr);
|
||||
back[p].ka_time_start = tmp.ka_time_start;
|
||||
back[p].status = STATUS_ALIVE; // alive & waiting
|
||||
assert(back[p].ka_time_start != 0);
|
||||
assertf(back[p].ka_time_start != 0);
|
||||
hts_log_print(opt, LOG_DEBUG,
|
||||
"(Keep-Alive): successfully saved #%d (%s)",
|
||||
back[p].r.debugid, back[p].url_adr);
|
||||
@@ -1112,7 +1114,7 @@ void back_maydeletehttp(httrackp * opt, cache_back * cache, struct_back * sback,
|
||||
strcpybuff(back[q].url_adr, tmp.url_adr); // address
|
||||
back[q].ka_time_start = tmp.ka_time_start;
|
||||
back[q].status = STATUS_ALIVE; // alive & waiting
|
||||
assert(back[q].ka_time_start != 0);
|
||||
assertf(back[q].ka_time_start != 0);
|
||||
hts_log_print(opt, LOG_DEBUG,
|
||||
"(Keep-Alive): successfully preserved #%d (%s)",
|
||||
back[q].r.debugid, back[q].url_adr);
|
||||
@@ -1504,7 +1506,8 @@ int back_add(struct_back * sback, httrackp * opt, cache_back * cache, char *adr,
|
||||
if (cache->cached_tests != NULL) {
|
||||
intptr_t ptr = 0;
|
||||
|
||||
if (inthash_read(cache->cached_tests, concat(OPT_GET_BUFF(opt), adr, fil), &ptr)) { // gotcha
|
||||
if (inthash_read(cache->cached_tests,
|
||||
concat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), adr, fil), &ptr)) { // gotcha
|
||||
if (ptr != 0) {
|
||||
char *text = (char *) ptr;
|
||||
char *lf = strchr(text, '\n');
|
||||
@@ -1571,7 +1574,7 @@ int back_add(struct_back * sback, httrackp * opt, cache_back * cache, char *adr,
|
||||
if (pos < 0) { // pas de mise en cache data, vérifier existence
|
||||
#endif
|
||||
/* note: no check with IS_DELAYED_EXT() enabled - postcheck by client please! */
|
||||
if (save[0] != '\0' && !IS_DELAYED_EXT(save) && fsize_utf8(fconv(catbuff, save)) <= 0) { // fichier final n'existe pas ou est vide!
|
||||
if (save[0] != '\0' && !IS_DELAYED_EXT(save) && fsize_utf8(fconv(catbuff, sizeof(catbuff), save)) <= 0) { // fichier final n'existe pas ou est vide!
|
||||
int found = 0;
|
||||
|
||||
/* It is possible that the file has been moved due to changes in build structure */
|
||||
@@ -1589,10 +1592,10 @@ int back_add(struct_back * sback, httrackp * opt, cache_back * cache, char *adr,
|
||||
if (r.is_write && previous_save[0] != '\0') {
|
||||
/* Exists, but with another (old) filename: rename (almost) silently */
|
||||
if (strcmp(previous_save, save) != 0
|
||||
&& fexist_utf8(fconv(catbuff, previous_save))) {
|
||||
rename(fconv(catbuff, previous_save),
|
||||
fconv(catbuff2, save));
|
||||
if (fexist_utf8(fconv(catbuff, save))) {
|
||||
&& fexist_utf8(fconv(catbuff, sizeof(catbuff), previous_save))) {
|
||||
rename(fconv(catbuff, sizeof(catbuff), previous_save),
|
||||
fconv(catbuff2, sizeof(catbuff2), save));
|
||||
if (fexist_utf8(fconv(catbuff, sizeof(catbuff), save))) {
|
||||
found = 1;
|
||||
hts_log_print(opt, LOG_DEBUG,
|
||||
"File '%s' has been renamed since last mirror to '%s' ; applying changes",
|
||||
@@ -1618,8 +1621,8 @@ int back_add(struct_back * sback, httrackp * opt, cache_back * cache, char *adr,
|
||||
// sinon, le fichier est ok à priori, mais on renverra un if-modified-since pour
|
||||
// en être sûr
|
||||
if (opt->norecatch) { // tester norecatch
|
||||
if (!fexist_utf8(fconv(catbuff, save))) { // fichier existe pas mais déclaré: on l'a effacé
|
||||
FILE *fp = FOPEN(fconv(catbuff, save), "wb");
|
||||
if (!fexist_utf8(fconv(catbuff, sizeof(catbuff), save))) { // fichier existe pas mais déclaré: on l'a effacé
|
||||
FILE *fp = FOPEN(fconv(catbuff, sizeof(catbuff), save), "wb");
|
||||
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
@@ -2260,7 +2263,7 @@ void back_clean(httrackp * opt, cache_back * cache, struct_back * sback) {
|
||||
} else if (back[i].r.keep_alive_max < 1) {
|
||||
reason = "keep-alive-max reached";
|
||||
} else if (time_local() >= back[i].ka_time_start + back[i].r.keep_alive_t) {
|
||||
assert(back[i].ka_time_start != 0);
|
||||
assertf(back[i].ka_time_start != 0);
|
||||
snprintf(buffer, sizeof(buffer), "keep-alive timeout = %ds)",
|
||||
(int) back[i].r.keep_alive_t);
|
||||
reason = buffer;
|
||||
@@ -2455,7 +2458,7 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
|
||||
#if HTS_WIDE_DEBUG
|
||||
DEBUG_W("select\n");
|
||||
#endif
|
||||
select(nfds, &fds, &fds_c, &fds_e, &tv);
|
||||
select((int) nfds, &fds, &fds_c, &fds_e, &tv);
|
||||
#if HTS_WIDE_DEBUG
|
||||
DEBUG_W("select done\n");
|
||||
#endif
|
||||
@@ -2533,7 +2536,7 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
|
||||
back[i].r.ssl_con = SSL_new(openssl_ctx);
|
||||
if (back[i].r.ssl_con) {
|
||||
SSL_clear(back[i].r.ssl_con);
|
||||
if (SSL_set_fd(back[i].r.ssl_con, back[i].r.soc) == 1) {
|
||||
if (SSL_set_fd(back[i].r.ssl_con, (int) back[i].r.soc) == 1) {
|
||||
SSL_set_connect_state(back[i].r.ssl_con);
|
||||
back[i].status = STATUS_SSL_WAIT_HANDSHAKE; /* handshake wait */
|
||||
} else
|
||||
@@ -2778,10 +2781,10 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
|
||||
if (back[i].r.compressed &&
|
||||
/* .gz are *NOT* depacked!! */
|
||||
(strfield
|
||||
(get_ext(catbuff, back[i].url_sav), "gz") == 0)
|
||||
(get_ext(catbuff, sizeof(catbuff), back[i].url_sav), "gz") == 0)
|
||||
) {
|
||||
if (create_back_tmpfile(opt, &back[i]) == 0) {
|
||||
assert(back[i].tmpfile != NULL);
|
||||
assertf(back[i].tmpfile != NULL);
|
||||
/* note: tmpfile is utf-8 */
|
||||
if ((back[i].r.out =
|
||||
FOPEN(back[i].tmpfile, "wb")) == NULL) {
|
||||
@@ -3656,7 +3659,7 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
|
||||
file_notify(opt, back[i].url_adr, back[i].url_fil,
|
||||
back[i].url_sav, 0, 1,
|
||||
back[i].r.notmodified);
|
||||
back[i].r.out = FOPEN(fconv(catbuff, back[i].url_sav), "ab"); // append
|
||||
back[i].r.out = FOPEN(fconv(catbuff, sizeof(catbuff), back[i].url_sav), "ab"); // append
|
||||
if (back[i].r.out && opt->cache != 0) {
|
||||
back[i].r.is_write = 1; // écrire
|
||||
back[i].r.size = sz; // déja écrit
|
||||
@@ -3682,7 +3685,7 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
|
||||
}
|
||||
} else { // mémoire
|
||||
FILE *fp =
|
||||
FOPEN(fconv(catbuff, back[i].url_sav), "rb");
|
||||
FOPEN(fconv(catbuff, sizeof(catbuff), back[i].url_sav), "rb");
|
||||
if (fp) {
|
||||
LLint alloc_mem = sz + 1;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -68,7 +68,7 @@ typedef struct htsblk htsblk;
|
||||
#ifdef HTS_INTERNAL_BYTECODE
|
||||
|
||||
// create/destroy
|
||||
struct_back *back_new(int back_max);
|
||||
struct_back *back_new(httrackp *opt, int back_max);
|
||||
void back_free(struct_back ** sback);
|
||||
|
||||
// backing
|
||||
|
||||
227
src/htsbase.h
227
src/htsbase.h
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -40,6 +40,7 @@ extern "C" {
|
||||
|
||||
#include "htsglobal.h"
|
||||
#include "htsstrings.h"
|
||||
#include "htssafe.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -106,230 +107,6 @@ extern "C" {
|
||||
#define DynamicGet(handle, sym) dlsym(handle, sym)
|
||||
#endif
|
||||
|
||||
// emergency log
|
||||
typedef void (*t_abortLog) (char *msg, char *file, int line);
|
||||
extern HTSEXT_API t_abortLog abortLog__;
|
||||
#define abortLog(a) abortLog__(a, __FILE__, __LINE__)
|
||||
#define _ ,
|
||||
#define abortLogFmt(a) do { \
|
||||
FILE* fp = fopen("CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("/tmp/CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("C:\\CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("\\Temp\\CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("\\CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("CRASH.TXT", "wb"); \
|
||||
if (fp) { \
|
||||
fprintf(fp, "HTTrack " HTTRACK_VERSIONID " closed at '" __FILE__ "', line %d\r\n", __LINE__); \
|
||||
fprintf(fp, "Reason:\r\n"); \
|
||||
fprintf(fp, a); \
|
||||
fprintf(fp, "\r\n"); \
|
||||
fflush(fp); \
|
||||
fclose(fp); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define assertf(exp) do { \
|
||||
if (! ( exp ) ) { \
|
||||
abortLog("assert failed: " #exp); \
|
||||
if (htsCallbackErr != NULL) { \
|
||||
htsCallbackErr("assert failed: " #exp, __FILE__ , __LINE__ ); \
|
||||
} \
|
||||
abort(); \
|
||||
} \
|
||||
} while(0)
|
||||
/* non-fatal assert */
|
||||
#define assertnf(exp) do { \
|
||||
if (! ( exp ) ) { \
|
||||
abortLog("assert failed: " #exp); \
|
||||
if (htsCallbackErr != NULL) { \
|
||||
htsCallbackErr("assert failed: " #exp, __FILE__ , __LINE__ ); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* regular malloc's() */
|
||||
#ifndef HTS_TRACE_MALLOC
|
||||
#define malloct(A) malloc(A)
|
||||
#define calloct(A,B) calloc((A), (B))
|
||||
#define freet(A) do { assertnf((A) != NULL); if ((A) != NULL) { free(A); (A) = NULL; } } while(0)
|
||||
#define strdupt(A) strdup(A)
|
||||
#define realloct(A,B) ( ((A) != NULL) ? realloc((A), (B)) : malloc(B) )
|
||||
#define memcpybuff(A, B, N) memcpy((A), (B), (N))
|
||||
#else
|
||||
/* debug version */
|
||||
#define malloct(A) hts_malloc(A)
|
||||
#define calloct(A,B) hts_calloc(A,B)
|
||||
#define strdupt(A) hts_strdup(A)
|
||||
#define freet(A) do { hts_free(A); (A) = NULL; } while(0)
|
||||
#define realloct(A,B) hts_realloc(A,B)
|
||||
void hts_freeall();
|
||||
void *hts_malloc(size_t);
|
||||
void *hts_calloc(size_t, size_t);
|
||||
char *hts_strdup(char *);
|
||||
void *hts_xmalloc(size_t, size_t);
|
||||
void hts_free(void *);
|
||||
void *hts_realloc(void *, size_t);
|
||||
mlink *hts_find(char *adr);
|
||||
/* protected memcpy */
|
||||
#define memcpybuff(A, B, N) do { \
|
||||
mlink* lnk = hts_find((void*)(A)); \
|
||||
if (lnk != NULL) { \
|
||||
assertf(lnk != NULL); \
|
||||
assertf( * ( (t_htsboundary*) ( ((char*) lnk->adr) - sizeof(htsboundary) ) ) == htsboundary ); \
|
||||
assertf( * ( (t_htsboundary*) ( ((char*) lnk->adr) + lnk->len ) ) == htsboundary ); \
|
||||
assertf( ( ((char*)(A)) + (N)) < (char*) (lnk->adr + lnk->len) ); \
|
||||
} \
|
||||
memcpy(A, B, N); \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
typedef void (*htsErrorCallback) (char *msg, char *file, int line);
|
||||
extern HTSEXT_API htsErrorCallback htsCallbackErr;
|
||||
extern HTSEXT_API int htsMemoryFastXfr;
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
#define stringdup()
|
||||
|
||||
#ifdef STRDEBUG
|
||||
|
||||
/* protected strcat, strncat and strcpy - definitely useful */
|
||||
#define strcatbuff(A, B) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (htsMemoryFastXfr) { \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strcat(A, B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned int sz = (unsigned int) strlen(A); \
|
||||
unsigned int szf = (unsigned int) strlen(B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf(sz + szf + 1 < sizeof(A)); \
|
||||
if (szf > 0) { \
|
||||
if (sz + szf + 1 < sizeof(A)) { \
|
||||
memcpy((A) + sz, (B), szf + 1); \
|
||||
} \
|
||||
} \
|
||||
} else if (szf > 0) { \
|
||||
memcpybuff((A) + sz, (B), szf + 1); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
#define strncatbuff(A, B, N) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (htsMemoryFastXfr) { \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strncat(A, B, N); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned int sz = (unsigned int) strlen(A); \
|
||||
unsigned int szf = (unsigned int) strlen(B); \
|
||||
if (szf > (unsigned int) (N)) szf = (unsigned int) (N); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf(sz + szf + 1 < sizeof(A)); \
|
||||
if (szf > 0) { \
|
||||
if (sz + szf + 1 < sizeof(A)) { \
|
||||
memcpy((A) + sz, (B), szf); \
|
||||
* ( (A) + sz + szf) = '\0'; \
|
||||
} \
|
||||
} \
|
||||
} else if (szf > 0) { \
|
||||
memcpybuff((A) + sz, (B), szf); \
|
||||
* ( (A) + sz + szf) = '\0'; \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
#define strcpybuff(A, B) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (const char*) (B) != NULL ); \
|
||||
if (htsMemoryFastXfr) { \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strcpy(A, B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned int szf = (unsigned int) strlen(B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf(szf + 1 < sizeof(A)); \
|
||||
if (szf > 0) { \
|
||||
if (szf + 1 < sizeof(A)) { \
|
||||
memcpy((A), (B), szf + 1); \
|
||||
} else { \
|
||||
* (A) = '\0'; \
|
||||
} \
|
||||
} else { \
|
||||
* (A) = '\0'; \
|
||||
} \
|
||||
} else { \
|
||||
memcpybuff((A), (B), szf + 1); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef STRDEBUGFAST
|
||||
|
||||
/* protected strcat, strncat and strcpy - definitely useful */
|
||||
#define strcatbuff(A, B) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strcat(A, B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} while(0)
|
||||
#define strncatbuff(A, B, N) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strncat(A, B, N); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} while(0)
|
||||
#define strcpybuff(A, B) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strcpy(A, B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#else
|
||||
|
||||
#define strcatbuff strcat
|
||||
#define strncatbuff strncat
|
||||
#define strcpybuff strcpy
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -54,12 +54,9 @@ Please visit our Website: http://www.httrack.com
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct hostent FAR t_hostent;
|
||||
|
||||
#else
|
||||
#define HTS_USESCOPEID
|
||||
#define INVALID_SOCKET -1
|
||||
typedef struct hostent t_hostent;
|
||||
#endif
|
||||
|
||||
#if HTS_USEOPENSSL
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -129,10 +129,10 @@ int cookie_del(t_cookie * cookie, char *cook_name, char *domain, char *path) {
|
||||
// chk_dom: the domain stored in the cookie (potentially wildcard).
|
||||
// domain: query domain
|
||||
static int cookie_cmp_wildcard_domain(char *chk_dom, char *domain) {
|
||||
int n = strlen(chk_dom);
|
||||
int m = strlen(domain);
|
||||
int l = n < m ? n : m;
|
||||
int i;
|
||||
const size_t n = strlen(chk_dom);
|
||||
const size_t m = strlen(domain);
|
||||
const size_t l = n < m ? n : m;
|
||||
size_t i;
|
||||
for (i = l - 1; i >= 0; i--) {
|
||||
if (chk_dom[n - i - 1] != domain[m - i - 1]) {
|
||||
return 1;
|
||||
@@ -222,7 +222,7 @@ int cookie_load(t_cookie * cookie, const char *fpath, const char *name) {
|
||||
do {
|
||||
if (!(find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
if (!(find.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)) {
|
||||
FILE *fp = fopen(fconcat(catbuff, fpath, find.cFileName), "rb");
|
||||
FILE *fp = fopen(fconcat(catbuff, sizeof(catbuff), fpath, find.cFileName), "rb");
|
||||
|
||||
if (fp) {
|
||||
char cook_name[256];
|
||||
@@ -264,7 +264,7 @@ int cookie_load(t_cookie * cookie, const char *fpath, const char *name) {
|
||||
}
|
||||
fclose(fp);
|
||||
if (cookie_merged)
|
||||
remove(fconcat(catbuff, fpath, find.cFileName));
|
||||
remove(fconcat(catbuff, sizeof(catbuff), fpath, find.cFileName));
|
||||
} // if fp
|
||||
}
|
||||
} while(FindNextFileA(h, &find));
|
||||
@@ -275,7 +275,7 @@ int cookie_load(t_cookie * cookie, const char *fpath, const char *name) {
|
||||
|
||||
// Ensuite, cookies.txt
|
||||
{
|
||||
FILE *fp = fopen(fconcat(catbuff, fpath, name), "rb");
|
||||
FILE *fp = fopen(fconcat(catbuff, sizeof(catbuff), fpath, name), "rb");
|
||||
|
||||
if (fp) {
|
||||
char BIGSTK line[8192];
|
||||
@@ -316,7 +316,7 @@ int cookie_save(t_cookie * cookie, char *name) {
|
||||
|
||||
if (strnotempty(cookie->data)) {
|
||||
char BIGSTK line[8192];
|
||||
FILE *fp = fopen(fconv(catbuff, name), "wb");
|
||||
FILE *fp = fopen(fconv(catbuff, sizeof(catbuff), name), "wb");
|
||||
|
||||
if (fp) {
|
||||
char *a = cookie->data;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
198
src/htscache.c
198
src/htscache.c
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -147,7 +147,7 @@ void cache_mayadd(httrackp * opt, cache_back * cache, htsblk * r,
|
||||
// cached "fast" header doesn't yet exists
|
||||
if (inthash_read
|
||||
(cache->cached_tests,
|
||||
concat(OPT_GET_BUFF(opt), url_adr, url_fil), NULL) == 0) {
|
||||
concat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), url_adr, url_fil), NULL) == 0) {
|
||||
char BIGSTK tempo[HTS_URLMAXSIZE * 2];
|
||||
|
||||
sprintf(tempo, "%d", (int) r->statuscode);
|
||||
@@ -159,7 +159,7 @@ void cache_mayadd(httrackp * opt, cache_back * cache, htsblk * r,
|
||||
"Cached fast-header response: %s%s is %d",
|
||||
url_adr, url_fil, (int) r->statuscode);
|
||||
inthash_add(cache->cached_tests,
|
||||
concat(OPT_GET_BUFF(opt), url_adr, url_fil),
|
||||
concat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), url_adr, url_fil),
|
||||
(intptr_t) strdupt(tempo));
|
||||
}
|
||||
}
|
||||
@@ -366,10 +366,10 @@ void cache_add(httrackp * opt, cache_back * cache, const htsblk * r,
|
||||
FILE *fp;
|
||||
|
||||
// On recopie le fichier->.
|
||||
off_t file_size = fsize_utf8(fconv(catbuff, url_save));
|
||||
off_t file_size = fsize_utf8(fconv(catbuff, sizeof(catbuff), url_save));
|
||||
|
||||
if (file_size >= 0) {
|
||||
fp = FOPEN(fconv(catbuff, url_save), "rb");
|
||||
fp = FOPEN(fconv(catbuff, sizeof(catbuff), url_save), "rb");
|
||||
if (fp != NULL) {
|
||||
char BIGSTK buff[32768];
|
||||
size_t nl;
|
||||
@@ -751,7 +751,7 @@ static htsblk cache_readex_new(httrackp * opt, cache_back * cache,
|
||||
|
||||
/* Ensure the file is present, because returning a reference to a missing file is useless! */
|
||||
if (!dataincache) { /* Data are supposed to be on disk */
|
||||
if (!fexist_utf8(fconv(catbuff, previous_save))) { // un fichier existe déja
|
||||
if (!fexist_utf8(fconv(catbuff, sizeof(catbuff), previous_save))) { // un fichier existe déja
|
||||
if (!opt->norecatch) {
|
||||
hts_log_print(opt, LOG_DEBUG, "Cache: could not find %s",
|
||||
previous_save);
|
||||
@@ -775,10 +775,10 @@ static htsblk cache_readex_new(httrackp * opt, cache_back * cache,
|
||||
r.msg[0] = '\0';
|
||||
|
||||
// File exists on disk with declared cache name (this is expected!)
|
||||
if (fexist_utf8(fconv(catbuff, previous_save))) { // un fichier existe déja
|
||||
if (fexist_utf8(fconv(catbuff, sizeof(catbuff), previous_save))) { // un fichier existe déja
|
||||
// Expected size ?
|
||||
const size_t fsize =
|
||||
fsize_utf8(fconv(catbuff, previous_save));
|
||||
fsize_utf8(fconv(catbuff, sizeof(catbuff), previous_save));
|
||||
if (fsize == r.size) {
|
||||
// Target name is the previous name, and the file looks good: nothing to do!
|
||||
if (strcmp(previous_save, target_save) == 0) {
|
||||
@@ -790,8 +790,8 @@ static htsblk cache_readex_new(httrackp * opt, cache_back * cache,
|
||||
char catbuff2[CATBUFF_SIZE];
|
||||
|
||||
if (RENAME
|
||||
(fconv(catbuff, previous_save),
|
||||
fconv(catbuff2, target_save)) == 0) {
|
||||
(fconv(catbuff, sizeof(catbuff), previous_save),
|
||||
fconv(catbuff2, sizeof(catbuff2), target_save)) == 0) {
|
||||
// So far so good
|
||||
ok = 1; // plus rien à faire
|
||||
|
||||
@@ -812,9 +812,9 @@ static htsblk cache_readex_new(httrackp * opt, cache_back * cache,
|
||||
}
|
||||
// File exists with the target name and not previous one ?
|
||||
// Suppose a broken mirror, with a file being renamed: OK
|
||||
else if (fexist_utf8(fconv(catbuff, target_save))) {
|
||||
else if (fexist_utf8(fconv(catbuff, sizeof(catbuff), target_save))) {
|
||||
// Expected size ?
|
||||
const size_t fsize = fsize_utf8(fconv(catbuff, target_save));
|
||||
const size_t fsize = fsize_utf8(fconv(catbuff, sizeof(catbuff), target_save));
|
||||
|
||||
if (fsize == r.size) {
|
||||
// So far so good
|
||||
@@ -927,7 +927,7 @@ static htsblk cache_readex_new(httrackp * opt, cache_back * cache,
|
||||
"Previous cache file not found (empty filename)");
|
||||
}
|
||||
} else { /* Read in memory from disk */
|
||||
FILE *const fp = FOPEN(fconv(catbuff, previous_save), "rb");
|
||||
FILE *const fp = FOPEN(fconv(catbuff, sizeof(catbuff), previous_save), "rb");
|
||||
|
||||
if (fp != NULL) {
|
||||
r.adr = (char *) malloct((int) r.size + 4);
|
||||
@@ -1159,7 +1159,7 @@ static htsblk cache_readex_old(httrackp * opt, cache_back * cache,
|
||||
int ok = 0;
|
||||
|
||||
r.is_write = 1; // écrire
|
||||
if (fexist_utf8(fconv(catbuff, save))) { // un fichier existe déja
|
||||
if (fexist_utf8(fconv(catbuff, sizeof(catbuff), save))) { // un fichier existe déja
|
||||
//if (fsize_utf8(fconv(save))==r.size) { // même taille -- NON tant pis (taille mal declaree)
|
||||
ok = 1; // plus rien à faire
|
||||
filenote(&opt->state.strc, save, NULL); // noter comme connu
|
||||
@@ -1229,7 +1229,7 @@ static htsblk cache_readex_old(httrackp * opt, cache_back * cache,
|
||||
strcpybuff(r.msg, "Previous cache file not found (2)");
|
||||
} else { /* Read in memory from cache */
|
||||
if (strnotempty(return_save) && fexist_utf8(return_save)) {
|
||||
FILE *fp = FOPEN(fconv(catbuff, return_save), "rb");
|
||||
FILE *fp = FOPEN(fconv(catbuff, sizeof(catbuff), return_save), "rb");
|
||||
|
||||
if (fp != NULL) {
|
||||
r.adr = (char *) malloct((size_t) r.size + 4);
|
||||
@@ -1397,7 +1397,7 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
// ---
|
||||
// utilisation du cache: renommer ancien éventuel et charger index
|
||||
hts_log_print(opt, LOG_DEBUG, "Cache: enabled=%d, base=%s, ro=%d",
|
||||
(int) opt->cache, fconcat(OPT_GET_BUFF(opt),
|
||||
(int) opt->cache, fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/"), (int) cache->ro);
|
||||
if (opt->cache) {
|
||||
@@ -1406,40 +1406,40 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
#endif
|
||||
if (!cache->ro) {
|
||||
#ifdef _WIN32
|
||||
mkdir(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache"));
|
||||
mkdir(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache"));
|
||||
#else
|
||||
mkdir(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache"),
|
||||
mkdir(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache"),
|
||||
HTS_PROTECT_FOLDER);
|
||||
#endif
|
||||
if ((fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.zip")))) { // il existe déja un cache précédent.. renommer
|
||||
if ((fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/new.zip")))) { // il existe déja un cache précédent.. renommer
|
||||
/* Previous cache from the previous cache version */
|
||||
#if 0
|
||||
/* No.. reuse with old httrack releases! */
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
#endif
|
||||
/* Previous cache version */
|
||||
if ((fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.dat"))) && (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.ndx")))) { // il existe déja un cache précédent.. renommer
|
||||
if ((fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/new.dat"))) && (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/new.ndx")))) { // il existe déja un cache précédent.. renommer
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
}
|
||||
@@ -1447,11 +1447,11 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
/* Remove OLD cache */
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"))) {
|
||||
if (remove
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")) != 0) {
|
||||
hts_log_print(opt, LOG_WARNING | LOG_ERRNO,
|
||||
"Cache: error while moving previous cache");
|
||||
@@ -1461,8 +1461,8 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
/* Rename */
|
||||
if (hts_rename
|
||||
(opt,
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"), fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")) != 0) {
|
||||
hts_log_print(opt, LOG_WARNING | LOG_ERRNO,
|
||||
@@ -1470,33 +1470,33 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
} else {
|
||||
hts_log_print(opt, LOG_DEBUG, "Cache: successfully renamed");
|
||||
}
|
||||
} else if ((fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.dat"))) && (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.ndx")))) { // il existe déja un cache précédent.. renommer
|
||||
} else if ((fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/new.dat"))) && (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/new.ndx")))) { // il existe déja un cache précédent.. renommer
|
||||
#if DEBUGCA
|
||||
printf("work with former cache\n");
|
||||
#endif
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
} else { // un des deux (ou les deux) fichiers cache absents: effacer l'autre éventuel
|
||||
@@ -1505,17 +1505,17 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
#endif
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
}
|
||||
} else {
|
||||
@@ -1524,30 +1524,30 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
hts_log_print(opt, LOG_DEBUG, "Cache: size %d",
|
||||
(int)
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")));
|
||||
|
||||
// charger index cache précédent
|
||||
if ((!cache->ro
|
||||
&&
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")) > 0)
|
||||
|| (cache->ro
|
||||
&&
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip")) > 0)
|
||||
) {
|
||||
if (!cache->ro) {
|
||||
cache->zipInput =
|
||||
unzOpen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"));
|
||||
} else {
|
||||
cache->zipInput =
|
||||
unzOpen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"));
|
||||
}
|
||||
|
||||
@@ -1559,25 +1559,25 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
|
||||
if (!cache->ro) {
|
||||
name =
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip");
|
||||
} else {
|
||||
name =
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip");
|
||||
}
|
||||
hts_log_print(opt, LOG_WARNING,
|
||||
"Cache: damaged cache, trying to repair");
|
||||
if (unzRepair
|
||||
(name,
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/repair.zip"), fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/repair.zip"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/repair.tmp"),
|
||||
&repaired, &repairedBytes) == Z_OK) {
|
||||
unlink(name);
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/repair.zip"), name);
|
||||
cache->zipInput = unzOpen(name);
|
||||
hts_log_print(opt, LOG_WARNING,
|
||||
@@ -1679,20 +1679,20 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
if ((!cache->ro
|
||||
&&
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")) >= 0
|
||||
&&
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")) > 0)
|
||||
|| (cache->ro
|
||||
&&
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat")) >= 0
|
||||
&&
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")) > 0)
|
||||
) {
|
||||
FILE *oldndx = NULL;
|
||||
@@ -1703,20 +1703,20 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
if (!cache->ro) {
|
||||
cache->olddat =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), "rb");
|
||||
oldndx =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), "rb");
|
||||
} else {
|
||||
cache->olddat =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"), "rb");
|
||||
oldndx =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"), "rb");
|
||||
}
|
||||
// les deux doivent être ouvrables
|
||||
@@ -1738,20 +1738,20 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
if (!cache->ro) {
|
||||
buffl =
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
cache->use =
|
||||
readfile(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
} else {
|
||||
buffl =
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
cache->use =
|
||||
readfile(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
}
|
||||
if (cache->use != NULL) {
|
||||
@@ -1822,7 +1822,7 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
}
|
||||
} else {
|
||||
hts_log_print(opt, LOG_DEBUG, "Cache: no cache found in %s",
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/"));
|
||||
}
|
||||
|
||||
@@ -1832,39 +1832,39 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
if (!cache->ro) {
|
||||
// ouvrir caches actuels
|
||||
structcheck(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/"));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/"));
|
||||
|
||||
if (1) {
|
||||
/* Create ZIP file cache */
|
||||
cache->zipOutput =
|
||||
(void *)
|
||||
zipOpen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"), 0);
|
||||
|
||||
if (cache->zipOutput != NULL) {
|
||||
// supprimer old.lst
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"));
|
||||
// renommer
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst")))
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"));
|
||||
// ouvrir
|
||||
cache->lst =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), "wb");
|
||||
strcpybuff(opt->state.strc.path, StringBuff(opt->path_html));
|
||||
opt->state.strc.lst = cache->lst;
|
||||
@@ -1878,25 +1878,25 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
// supprimer old.txt
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"));
|
||||
// renommer
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt")))
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"));
|
||||
// ouvrir
|
||||
cache->txt =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"), "wb");
|
||||
if (cache->txt) {
|
||||
fprintf(cache->txt,
|
||||
@@ -1909,11 +1909,11 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
} else {
|
||||
cache->dat =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"), "wb");
|
||||
cache->ndx =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"), "wb");
|
||||
// les deux doivent être ouvrables
|
||||
if ((cache->dat == NULL) && (cache->ndx != NULL)) {
|
||||
@@ -1940,25 +1940,25 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
// supprimer old.lst
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"));
|
||||
// renommer
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst")))
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"));
|
||||
// ouvrir
|
||||
cache->lst =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), "wb");
|
||||
strcpybuff(opt->state.strc.path, StringBuff(opt->path_html));
|
||||
opt->state.strc.lst = cache->lst;
|
||||
@@ -1972,25 +1972,25 @@ void cache_init(cache_back * cache, httrackp * opt) {
|
||||
// supprimer old.txt
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"));
|
||||
// renommer
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt")))
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"));
|
||||
// ouvrir
|
||||
cache->txt =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"), "wb");
|
||||
if (cache->txt) {
|
||||
fprintf(cache->txt,
|
||||
@@ -2030,7 +2030,7 @@ char *readfile2(char *fil, LLint * size) {
|
||||
if (len >= 0) { // exists
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(fconv(catbuff, fil), "rb");
|
||||
fp = fopen(fconv(catbuff, sizeof(catbuff), fil), "rb");
|
||||
if (fp != NULL) { // n'existe pas (!)
|
||||
adr = (char *) malloct(len + 1);
|
||||
if (size != NULL)
|
||||
@@ -2055,7 +2055,7 @@ char *readfile_utf8(char *fil) {
|
||||
const off_t len = fsize_utf8(fil);
|
||||
|
||||
if (len >= 0) { // exists
|
||||
FILE *const fp = FOPEN(fconv(catbuff, fil), "rb");
|
||||
FILE *const fp = FOPEN(fconv(catbuff, sizeof(catbuff), fil), "rb");
|
||||
|
||||
if (fp != NULL) { // n'existe pas (!)
|
||||
adr = (char *) malloct(len + 1);
|
||||
@@ -2080,7 +2080,7 @@ char *readfile_or(char *fil, char *defaultdata) {
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
|
||||
if (!fexist(fil))
|
||||
realfile = fconcat(catbuff, hts_rootdir(NULL), fil);
|
||||
realfile = fconcat(catbuff, sizeof(catbuff), hts_rootdir(NULL), fil);
|
||||
ret = readfile(realfile);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -77,40 +77,25 @@ HTSEXT_API T_SOC catch_url_init_std(int *port_prox, char *adr_prox) {
|
||||
// 1- Init the URL catcher
|
||||
|
||||
// catch_url_init(&port,&return_host);
|
||||
HTSEXT_API T_SOC catch_url_init(int *port, char *adr) {
|
||||
HTSEXT_API T_SOC catch_url_init(int *port, /* 128 bytes */ char *adr) {
|
||||
T_SOC soc = INVALID_SOCKET;
|
||||
char h_loc[256 + 2];
|
||||
char h_loc[256];
|
||||
|
||||
if (gethostname(h_loc, 256) == 0) { // host name
|
||||
if (gethostname(h_loc, sizeof(h_loc)) == 0) { // host name
|
||||
SOCaddr server;
|
||||
int server_size = sizeof(server);
|
||||
t_hostent *hp_loc;
|
||||
t_fullhostent buffer;
|
||||
|
||||
// effacer structure
|
||||
memset(&server, 0, sizeof(server));
|
||||
|
||||
if ((hp_loc = vxgethostbyname(h_loc, &buffer))) { // notre host
|
||||
|
||||
// copie adresse
|
||||
SOCaddr_copyaddr(server, server_size, hp_loc->h_addr_list[0],
|
||||
hp_loc->h_length);
|
||||
|
||||
if (hts_dns_resolve_nocache(h_loc, &server) != NULL) { // notre host
|
||||
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) {
|
||||
if (bind(soc, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
|
||||
SOCaddr server2;
|
||||
SOClen len;
|
||||
SOClen len = SOCaddr_capacity(server2);
|
||||
|
||||
len = sizeof(server2);
|
||||
// effacer structure
|
||||
memset(&server2, 0, sizeof(server2));
|
||||
if (getsockname(soc, (struct sockaddr *) &server2, &len) == 0) {
|
||||
if (getsockname(soc, &SOCaddr_sockaddr(server2), &len) == 0) {
|
||||
*port = ntohs(SOCaddr_sinport(server)); // récupérer port
|
||||
if (listen(soc, 10) >= 0) { // au pif le 10
|
||||
SOCaddr_inetntoa(adr, 128, server2, len);
|
||||
if (listen(soc, 1) >= 0) {
|
||||
SOCaddr_inetntoa(adr, 128, server2);
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
closesocket(soc);
|
||||
@@ -168,15 +153,13 @@ HTSEXT_API int catch_url(T_SOC soc, char *url, char *method, char *data) {
|
||||
/* INFOS */
|
||||
{
|
||||
SOCaddr server2;
|
||||
SOClen len = sizeof(server2);
|
||||
SOClen len = SOCaddr_capacity(server2);
|
||||
|
||||
// effacer structure
|
||||
memset(&server2, 0, sizeof(server2));
|
||||
if (getpeername(soc, (struct sockaddr *) &server2, &len) == 0) {
|
||||
if (getpeername(soc, &SOCaddr_sockaddr(server2), &len) == 0) {
|
||||
char dot[256 + 2];
|
||||
|
||||
SOCaddr_inetntoa(dot, 256, server2, sizeof(server2));
|
||||
sprintf(url, "%s:%d", dot, htons(SOCaddr_sinport(server2)));
|
||||
SOCaddr_inetntoa(dot, sizeof(dot), server2);
|
||||
sprintf(url, "%s:%d", dot, ntohs(SOCaddr_sinport(server2)));
|
||||
}
|
||||
}
|
||||
/* INFOS */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -43,12 +43,6 @@ Please visit our Website: http://www.httrack.com
|
||||
// Fonctions
|
||||
void socinput(T_SOC soc, char *s, int max);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API T_SOC catch_url_init_std(int *port_prox, char *adr_prox);
|
||||
HTSEXT_API T_SOC catch_url_init(int *port, char *adr);
|
||||
HTSEXT_API int catch_url(T_SOC soc, char *url, char *method, char *data);
|
||||
#endif
|
||||
|
||||
#define CATCH_RESPONSE \
|
||||
"HTTP/1.0 200 OK\r\n"\
|
||||
"Content-type: text/html\r\n"\
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -33,8 +33,7 @@ Please visit our Website: http://www.httrack.com
|
||||
#include "htscharset.h"
|
||||
#include "htsbase.h"
|
||||
#include "punycode.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "htssafe.h"
|
||||
|
||||
int hts_isStringAscii(const char *s, size_t size) {
|
||||
size_t i;
|
||||
@@ -415,7 +414,7 @@ static char* hts_codepageToUTF8(const char *codepage, const char *s) {
|
||||
if (dest != NULL) {
|
||||
const size_t len = hts_writeUTF8(uc, &dest[k], MAX_UTF);
|
||||
k += len;
|
||||
assert(k < capa);
|
||||
assertf(k < capa);
|
||||
}
|
||||
}
|
||||
dest[k] = '\0';
|
||||
@@ -726,9 +725,9 @@ static unsigned int nlz8(unsigned char x) {
|
||||
*/
|
||||
#define ADD_SEQ(UC, BITS, EMITTER) do { \
|
||||
/* number of data bits in first octet */ \
|
||||
const int bits = BITS % 6; \
|
||||
const unsigned int bits = BITS % 6; \
|
||||
/* shift for first octet */ \
|
||||
const int shift0 = BITS - bits; \
|
||||
const unsigned int shift0 = BITS - bits; \
|
||||
/* first octet */ \
|
||||
const unsigned char lead = \
|
||||
/* leading bits */ \
|
||||
@@ -967,31 +966,36 @@ char *hts_convertStringUTF8ToIDNA(const char *s, size_t size) {
|
||||
if (HTS_IS_LEADING_UTF8(c)) {
|
||||
/* commit sequence ? */
|
||||
if (utfSeq != (size_t) -1) {
|
||||
/* unicode character */
|
||||
punycode_uint uc = 0;
|
||||
|
||||
/* Reader: can read bytes up to j */
|
||||
#define RD ( utfSeq < j ? segData[utfSeq++] : -1 )
|
||||
|
||||
/* Writer: upon error, return FFFD (replacement character) */
|
||||
#define WR(C) uc = C != -1 ? (punycode_uint) C : (punycode_uint) 0xfffd
|
||||
#define WR(C) do { \
|
||||
if ((C) != -1) { \
|
||||
/* copy character */ \
|
||||
assertf(segOutputSize < segSize); \
|
||||
segInt[segOutputSize++] = (C); \
|
||||
} \
|
||||
/* In case of error, abort. */ \
|
||||
else { \
|
||||
FREE_BUFFER(); \
|
||||
return NULL; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* Read Unicode character. */
|
||||
/* Read/Write Unicode character. */
|
||||
READ_UNICODE(RD, WR);
|
||||
#undef RD
|
||||
#undef WR
|
||||
|
||||
/* copy character */
|
||||
assert(segOutputSize < segSize);
|
||||
segInt[segOutputSize++] = uc;
|
||||
|
||||
/* not anymore in sequence */
|
||||
utfSeq = (size_t) -1;
|
||||
}
|
||||
|
||||
/* ascii ? */
|
||||
if (c < 0x80) {
|
||||
assert(segOutputSize < segSize);
|
||||
assertf(segOutputSize < segSize);
|
||||
segInt[segOutputSize] = c;
|
||||
if (c != 0) {
|
||||
segOutputSize++;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
128
src/htsconcat.c
Normal file
128
src/htsconcat.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Important notes:
|
||||
|
||||
- We hereby ask people using this source NOT to use it in purpose of grabbing
|
||||
emails addresses, or collecting any other private information on persons.
|
||||
This would disgrace our work, and spoil the many hours we spent on it.
|
||||
|
||||
Please visit our Website: http://www.httrack.com
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* File: Subroutines */
|
||||
/* Author: Xavier Roche */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "httrack.h"
|
||||
#include "httrack-library.h"
|
||||
|
||||
// concat, concatène deux chaines et renvoi le résultat
|
||||
// permet d'alléger grandement le code
|
||||
#undef concat
|
||||
HTSEXT_API char *concat(char *catbuff, size_t size, const char *a, const char *b) {
|
||||
size_t max = 0;
|
||||
|
||||
RUNTIME_TIME_CHECK_SIZE(size);
|
||||
|
||||
catbuff[0] = '\0';
|
||||
if (a != NULL && a[0] != '\0') {
|
||||
max += strlen(a);
|
||||
if (max + 1 >= size) {
|
||||
return catbuff;
|
||||
}
|
||||
strcat(catbuff, a);
|
||||
}
|
||||
if (b != NULL && b[0] != '\0') {
|
||||
max += strlen(b);
|
||||
if (max + 1 >= size) {
|
||||
return catbuff;
|
||||
}
|
||||
strcat(catbuff, b);
|
||||
}
|
||||
return catbuff;
|
||||
}
|
||||
|
||||
// conversion fichier / -> antislash
|
||||
static char *__fconv(char *a) {
|
||||
#if HTS_DOSNAME
|
||||
int i;
|
||||
|
||||
for(i = 0; a[i] != 0; i++)
|
||||
if (a[i] == '/') // Unix-to-DOS style
|
||||
a[i] = '\\';
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
#undef fconcat
|
||||
#undef concat
|
||||
HTSEXT_API char *fconcat(char *catbuff, size_t size, const char *a, const char *b) {
|
||||
RUNTIME_TIME_CHECK_SIZE(size);
|
||||
return __fconv(concat(catbuff, size, a, b));
|
||||
}
|
||||
|
||||
#undef fconv
|
||||
HTSEXT_API char *fconv(char *catbuff, size_t size, const char *a) {
|
||||
RUNTIME_TIME_CHECK_SIZE(size);
|
||||
return __fconv(concat(catbuff, size, a, ""));
|
||||
}
|
||||
|
||||
/* / et \\ en / */
|
||||
static char *__fslash(char *a) {
|
||||
int i;
|
||||
|
||||
for(i = 0; a[i] != 0; i++)
|
||||
if (a[i] == '\\') // convertir
|
||||
a[i] = '/';
|
||||
return a;
|
||||
}
|
||||
|
||||
#undef fslash
|
||||
char *fslash(char *catbuff, size_t size, const char *a) {
|
||||
RUNTIME_TIME_CHECK_SIZE(size);
|
||||
return __fslash(concat(catbuff, size, a, NULL));
|
||||
}
|
||||
|
||||
// extension : html,gif..
|
||||
HTSEXT_API char *get_ext(char *catbuff, size_t size, const char *fil) {
|
||||
size_t i, last;
|
||||
|
||||
RUNTIME_TIME_CHECK_SIZE(size);
|
||||
|
||||
for(i = 0, last = 0 ; fil[i] != '\0' && fil[i] != '?' ; i++) {
|
||||
if (fil[i] == '.') {
|
||||
last = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (last != 0 && i > last) {
|
||||
const size_t len = i - last;
|
||||
if (len < size) {
|
||||
catbuff[0] = '\0';
|
||||
strncat(catbuff, &fil[last], size);
|
||||
return catbuff;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
112
src/htscore.c
112
src/htscore.c
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -162,7 +162,7 @@ RUN_CALLBACK0(opt, end); \
|
||||
if (opt->log != NULL) fflush(opt->log); \
|
||||
if (makestat_fp) { fclose(makestat_fp); makestat_fp=NULL; } \
|
||||
if (maketrack_fp){ fclose(maketrack_fp); maketrack_fp=NULL; } \
|
||||
if (opt->accept_cookie) cookie_save(opt->cookie,fconcat(OPT_GET_BUFF(opt),StringBuff(opt->path_log),"cookies.txt")); \
|
||||
if (opt->accept_cookie) cookie_save(opt->cookie,fconcat(OPT_GET_BUFF(opt),OPT_GET_BUFF_SIZE(opt),StringBuff(opt->path_log),"cookies.txt")); \
|
||||
if (makeindex_fp) { fclose(makeindex_fp); makeindex_fp=NULL; } \
|
||||
if (cache_hashtable) { inthash_delete(&cache_hashtable); } \
|
||||
if (cache_tests) { inthash_delete(&cache_tests); } \
|
||||
@@ -236,8 +236,7 @@ if (makeindex_fp) { \
|
||||
char BIGSTK tempo[1024]; \
|
||||
if (makeindex_links == 1) { \
|
||||
char BIGSTK link_escaped[HTS_URLMAXSIZE*2]; \
|
||||
strcpybuff(link_escaped, makeindex_firstlink); \
|
||||
escape_uri_utf(link_escaped); \
|
||||
escape_uri_utf(makeindex_firstlink, link_escaped, sizeof(link_escaped)); \
|
||||
sprintf(tempo,"<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=%s\">"CRLF, link_escaped); \
|
||||
} else \
|
||||
tempo[0]='\0'; \
|
||||
@@ -248,7 +247,7 @@ if (makeindex_fp) { \
|
||||
fflush(makeindex_fp); \
|
||||
fclose(makeindex_fp); /* à ne pas oublier sinon on passe une nuit blanche */ \
|
||||
makeindex_fp=NULL; \
|
||||
usercommand(opt,0,NULL,fconcat(OPT_GET_BUFF(opt),StringBuff(opt->path_html_utf8),"index.html"),"",""); \
|
||||
usercommand(opt,0,NULL,fconcat(OPT_GET_BUFF(opt),OPT_GET_BUFF_SIZE(opt),StringBuff(opt->path_html_utf8),"index.html"),"",""); \
|
||||
} \
|
||||
} \
|
||||
makeindex_done=1; /* ok c'est fait */ \
|
||||
@@ -369,15 +368,15 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
// et templates html
|
||||
template_header =
|
||||
readfile_or(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_bin),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_bin),
|
||||
"templates/index-header.html"), HTS_INDEX_HEADER);
|
||||
template_body =
|
||||
readfile_or(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_bin),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_bin),
|
||||
"templates/index-body.html"), HTS_INDEX_BODY);
|
||||
template_footer =
|
||||
readfile_or(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_bin),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_bin),
|
||||
"templates/index-footer.html"), HTS_INDEX_FOOTER);
|
||||
|
||||
// initialiser mimedefs
|
||||
@@ -402,6 +401,10 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
XH_extuninit;
|
||||
return 0;
|
||||
}
|
||||
hts_set_hash_handler(cache_hashtable, opt);
|
||||
hts_set_hash_handler(cache_tests, opt);
|
||||
inthash_set_name(cache_hashtable, "cache_hashtable");
|
||||
inthash_set_name(cache_tests, "cache_tests");
|
||||
inthash_value_is_malloc(cache_tests, 1); /* malloc */
|
||||
cache.hashtable = (void *) cache_hashtable; /* copy backcache hash */
|
||||
cache.cached_tests = (void *) cache_tests; /* copy of cache_tests */
|
||||
@@ -446,7 +449,7 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
lien_tot = 0;
|
||||
|
||||
// initialiser hachage
|
||||
hash_init(&hash, opt->urlhack);
|
||||
hash_init(opt, &hash, opt->urlhack);
|
||||
// note: we need a cast because of the const
|
||||
hash.liens = (const lien_url **) liens;
|
||||
|
||||
@@ -628,8 +631,8 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
|
||||
// lien primaire
|
||||
liens_record("primary", "/primary",
|
||||
fslash(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt),
|
||||
fslash(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html_utf8), "index.html")),
|
||||
"", "", opt->urlhack);
|
||||
if (liens[lien_tot] == NULL) { // erreur, pas de place réservée
|
||||
@@ -651,15 +654,11 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
|
||||
// Initialiser cache
|
||||
{
|
||||
int backupXFR = htsMemoryFastXfr;
|
||||
|
||||
opt->state._hts_in_html_parsing = 4;
|
||||
if (!RUN_CALLBACK7(opt, loop, NULL, 0, 0, 0, lien_tot, 0, NULL)) {
|
||||
opt->state.exit_xh = 1; // exit requested
|
||||
}
|
||||
htsMemoryFastXfr = 1; /* fast load */
|
||||
cache_init(&cache, opt);
|
||||
htsMemoryFastXfr = backupXFR;
|
||||
opt->state._hts_in_html_parsing = 0;
|
||||
}
|
||||
|
||||
@@ -688,7 +687,7 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
// On prévoit large: les fichiers HTML ne prennent que peu de place en mémoire, et les
|
||||
// fichiers non html sont sauvés en direct sur disque.
|
||||
// --> 1024 entrées + 32 entrées par socket en supplément
|
||||
sback = back_new(opt->maxsoc * 32 + 1024);
|
||||
sback = back_new(opt, opt->maxsoc * 32 + 1024);
|
||||
if (sback == NULL) {
|
||||
hts_log_print(opt, LOG_PANIC,
|
||||
"Not enough memory, can not allocate %d bytes",
|
||||
@@ -700,7 +699,7 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
if (opt->makestat) {
|
||||
makestat_fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-stats.txt"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-stats.txt"),
|
||||
"wb");
|
||||
if (makestat_fp != NULL) {
|
||||
fprintf(makestat_fp, "HTTrack statistics report, every minutes" LF LF);
|
||||
@@ -711,7 +710,7 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
if (opt->maketrack) {
|
||||
maketrack_fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-track.txt"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-track.txt"),
|
||||
"wb");
|
||||
if (maketrack_fp != NULL) {
|
||||
fprintf(maketrack_fp, "HTTrack tracking report, every minutes" LF LF);
|
||||
@@ -1452,7 +1451,7 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
|
||||
/* Remove file if being processed */
|
||||
if (is_loaded_from_file) {
|
||||
(void) unlink(fconv(OPT_GET_BUFF(opt), savename));
|
||||
(void) unlink(fconv(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), savename));
|
||||
is_loaded_from_file = 0;
|
||||
}
|
||||
|
||||
@@ -1783,7 +1782,7 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
#ifndef _WIN32
|
||||
chmod(tempo, HTS_ACCESS_FILE);
|
||||
#endif
|
||||
usercommand(opt, 0, NULL, fconv(OPT_GET_BUFF(opt), tempo), "",
|
||||
usercommand(opt, 0, NULL, fconv(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), tempo), "",
|
||||
"");
|
||||
}
|
||||
|
||||
@@ -1979,42 +1978,42 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
XH_uninit;
|
||||
if ((fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/old.dat")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache/old.dat")))
|
||||
&&
|
||||
(fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")))) {
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"));
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"));
|
||||
}
|
||||
@@ -2038,16 +2037,16 @@ int httpmirror(char *url1, httrackp * opt) {
|
||||
//
|
||||
old_lst =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"), "rb");
|
||||
if (old_lst) {
|
||||
off_t sz =
|
||||
fsize(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"));
|
||||
new_lst =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"), "rb");
|
||||
if ((new_lst) && (sz > 0)) {
|
||||
char *adr = (char *) malloct(sz);
|
||||
@@ -2356,7 +2355,7 @@ void host_ban(httrackp * opt, lien_url ** liens, int ptr, int lien_tot,
|
||||
if (strfield2(jump_identification(liens[i]->adr), host)) { // host
|
||||
hts_log_print(opt, LOG_DEBUG, "Cancel: %s%s", liens[i]->adr,
|
||||
liens[i]->fil);
|
||||
strcpybuff(liens[i]->adr, "!"); // cancel (invalide hash)
|
||||
hash_invalidate_entry(opt->hash, i); // invalidate hashtable entry
|
||||
// on efface pas le hash, because si on rencontre le lien, reverif sav..
|
||||
}
|
||||
} else {
|
||||
@@ -2849,10 +2848,10 @@ int filenote(filenote_strc * strc, const char *s, filecreate_params * params) {
|
||||
char BIGSTK savelst[HTS_URLMAXSIZE * 2];
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
|
||||
strcpybuff(savelst, fslash(catbuff, s));
|
||||
strcpybuff(savelst, fslash(catbuff, sizeof(catbuff), s));
|
||||
// couper chemin?
|
||||
if (strnotempty(strc->path)) {
|
||||
if (strncmp(fslash(catbuff, strc->path), savelst, strlen(strc->path)) == 0) { // couper
|
||||
if (strncmp(fslash(catbuff, sizeof(catbuff), strc->path), savelst, strlen(strc->path)) == 0) { // couper
|
||||
strcpybuff(savelst, s + strlen(strc->path));
|
||||
}
|
||||
}
|
||||
@@ -2938,8 +2937,9 @@ static void postprocess_file(httrackp * opt, const char *save, const char *adr,
|
||||
if (rsc_fil == NULL)
|
||||
rsc_fil = fil;
|
||||
if (strncmp
|
||||
(fslash(OPT_GET_BUFF(opt), save),
|
||||
fslash(OPT_GET_BUFF(opt), StringBuff(opt->path_html_utf8)), (n =
|
||||
(fslash(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), save),
|
||||
fslash(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html_utf8)), (n =
|
||||
(int)
|
||||
strlen
|
||||
(StringBuff
|
||||
@@ -2953,13 +2953,15 @@ static void postprocess_file(httrackp * opt, const char *save, const char *adr,
|
||||
//first = 1;
|
||||
opt->state.mimefp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_html), "index.mht"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html), "index.mht"),
|
||||
"wb");
|
||||
(void) unlink(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_html),
|
||||
(void) unlink(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html),
|
||||
"index.eml"));
|
||||
#ifndef _WIN32
|
||||
if (symlink("index.mht",
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_html),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_html),
|
||||
"index.eml")) != 0) {
|
||||
if (errno != EPERM) {
|
||||
hts_log_print(opt, LOG_WARNING | LOG_ERRNO,
|
||||
@@ -3005,17 +3007,7 @@ static void postprocess_file(httrackp * opt, const char *save, const char *adr,
|
||||
mimebuff[0] = '\0';
|
||||
|
||||
/* CID */
|
||||
strcpybuff(cid, adr);
|
||||
strcatbuff(cid, fil);
|
||||
escape_in_url(cid);
|
||||
{
|
||||
char *a = cid;
|
||||
|
||||
while((a = strchr(a, '%'))) {
|
||||
*a = 'X';
|
||||
a++;
|
||||
}
|
||||
}
|
||||
make_content_id(adr, fil, cid, sizeof(cid));
|
||||
|
||||
guess_httptype(opt, mimebuff, save);
|
||||
fprintf(opt->state.mimefp, "--%s\r\n",
|
||||
@@ -3074,7 +3066,7 @@ int fspc(httrackp * opt, FILE * fp, const char *type) {
|
||||
if (A == NULL) {
|
||||
int localtime_returned_null = 0;
|
||||
|
||||
assert(localtime_returned_null);
|
||||
assertf(localtime_returned_null);
|
||||
}
|
||||
strftime(s, 250, "%H:%M:%S", A);
|
||||
if (strnotempty(type))
|
||||
@@ -3323,7 +3315,7 @@ int check_sockerror(T_SOC s) {
|
||||
FD_SET((T_SOC) s, &fds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
select(s + 1, NULL, NULL, &fds, &tv);
|
||||
select((int) s + 1, NULL, NULL, &fds, &tv);
|
||||
return FD_ISSET(s, &fds);
|
||||
}
|
||||
|
||||
@@ -3336,7 +3328,7 @@ int check_sockdata(T_SOC s) {
|
||||
FD_SET((T_SOC) s, &fds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
select(s + 1, &fds, NULL, NULL, &tv);
|
||||
select((int) s + 1, &fds, NULL, NULL, &tv);
|
||||
return FD_ISSET(s, &fds);
|
||||
}
|
||||
|
||||
@@ -3858,5 +3850,5 @@ void voidf(void) {
|
||||
(void) a;
|
||||
}
|
||||
|
||||
// HTTrack Website Copier Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
// HTTrack Website Copier Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
//
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -298,26 +298,6 @@ HTS_STATIC int cache_readable(cache_back * cache) {
|
||||
/* Library internal definictions */
|
||||
#ifdef HTS_INTERNAL_BYTECODE
|
||||
|
||||
//
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int hts_is_parsing(httrackp * opt, int flag);
|
||||
HTSEXT_API int hts_is_testing(httrackp * opt);
|
||||
HTSEXT_API int hts_addurl(httrackp * opt, char **url);
|
||||
HTSEXT_API int hts_resetaddurl(httrackp * opt);
|
||||
HTSEXT_API int copy_htsopt(const httrackp * from, httrackp * to);
|
||||
HTSEXT_API char *hts_errmsg(httrackp * opt);
|
||||
HTSEXT_API int hts_setpause(httrackp * opt, int);
|
||||
|
||||
//
|
||||
HTSEXT_API int hts_is_exiting(httrackp * opt);
|
||||
HTSEXT_API int hts_request_stop(httrackp * opt, int force);
|
||||
|
||||
//
|
||||
HTSEXT_API int hts_cancel_file_push(httrackp * opt, const char *url);
|
||||
HTSEXT_API void hts_cancel_test(httrackp * opt);
|
||||
HTSEXT_API void hts_cancel_parsing(httrackp * opt);
|
||||
#endif
|
||||
|
||||
char *hts_cancel_file_pop(httrackp * opt);
|
||||
|
||||
#endif
|
||||
@@ -345,11 +325,6 @@ void usercommand(httrackp * opt, int exe, const char *cmd, const char *file,
|
||||
void usercommand_exe(const char *cmd, const char *file);
|
||||
int filters_init(char ***ptrfilters, int maxfilter, int filterinc);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int structcheck(const char *path);
|
||||
HTSEXT_API int structcheck_utf8(const char *path);
|
||||
HTSEXT_API int dir_exists(const char *path);
|
||||
#endif
|
||||
int fspc(httrackp * opt, FILE * fp, const char *type);
|
||||
char *next_token(char *p, int flag);
|
||||
|
||||
@@ -377,13 +352,6 @@ int backlinks_done(struct_back * sback, lien_url ** liens, int lien_tot,
|
||||
int back_fillmax(struct_back * sback, httrackp * opt, cache_back * cache,
|
||||
lien_url ** liens, int ptr, int numero_passe, int lien_tot);
|
||||
|
||||
// cancel file
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int hts_cancel_file_push(httrackp * opt, const char *url);
|
||||
HTSEXT_API void hts_cancel_test(httrackp * opt);
|
||||
HTSEXT_API void hts_cancel_parsing(httrackp * opt);
|
||||
#endif
|
||||
|
||||
int ask_continue(httrackp * opt);
|
||||
int nombre_digit(int n);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -180,7 +180,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
#ifndef HTS_HTTRACKDIR
|
||||
{
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
char *path = fslash(catbuff, argv[0]);
|
||||
char *path = fslash(catbuff, sizeof(catbuff), argv[0]);
|
||||
char *a;
|
||||
|
||||
if ((a = strrchr(path, '/'))) {
|
||||
@@ -451,15 +451,18 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
else {
|
||||
if ((!fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/doit.log"))) || (argv_url > 0)) {
|
||||
if (!optinclude_file
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), HTS_HTTRACKRC),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), HTS_HTTRACKRC),
|
||||
&argc, argv, x_argvblk, &x_ptr))
|
||||
if (!optinclude_file(HTS_HTTRACKRC, &argc, argv, x_argvblk, &x_ptr)) {
|
||||
if (!optinclude_file
|
||||
(fconcat(OPT_GET_BUFF(opt), hts_gethome(), "/" HTS_HTTRACKRC),
|
||||
(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
hts_gethome(), "/" HTS_HTTRACKRC),
|
||||
&argc, argv, x_argvblk, &x_ptr)) {
|
||||
#ifdef HTS_HTTRACKCNF
|
||||
optinclude_file(HTS_HTTRACKCNF, &argc, argv, x_argvblk, &x_ptr);
|
||||
@@ -478,11 +481,13 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
/* load doit.log and insert in current command line */
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/doit.log"))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/doit.log"))
|
||||
&& (argv_url <= 0)) {
|
||||
FILE *fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/doit.log"), "rb");
|
||||
if (fp) {
|
||||
int insert_after = 1; /* insérer après nom au début */
|
||||
@@ -529,48 +534,58 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
#endif
|
||||
if (!fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.zip"))) {
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/new.zip"))) {
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/old.zip"))) {
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/old.zip"))) {
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"));
|
||||
}
|
||||
} else
|
||||
if ((!fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.dat")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/new.dat")))
|
||||
||
|
||||
(!fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")))) {
|
||||
if ((fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/old.dat")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/old.dat")))
|
||||
&&
|
||||
(fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")))) {
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
//remove(fconcat(StringBuff(opt->path_log),"hts-cache/new.lst"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
//rename(fconcat(StringBuff(opt->path_log),"hts-cache/old.lst"),fconcat(StringBuff(opt->path_log),"hts-cache/new.lst"));
|
||||
@@ -581,17 +596,20 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
if (!opt->quiet) {
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-in_progress.lock"))) {
|
||||
/* Old cache */
|
||||
if ((fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")))
|
||||
&&
|
||||
(fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")))) {
|
||||
if (opt->log != NULL) {
|
||||
fprintf(opt->log, "Warning!\n");
|
||||
@@ -623,109 +641,109 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
strcpybuff(argv[i] + 1, "");
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-log.txt")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-log.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-log.txt"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-err.txt")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-err.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-err.txt"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_html), "index.html")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_html), "index.html")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_html),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_html),
|
||||
"index.html"));
|
||||
/* */
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.lst"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.lst"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.txt"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.txt"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/doit.log")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/doit.log"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-in_progress.lock")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-in_progress.lock"));
|
||||
rmdir(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache"));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache"));
|
||||
//
|
||||
} else if (strfield2(argv[i] + 2, "catchurl")) { // capture d'URL via proxy temporaire!
|
||||
argv_url = 1; // forcer a passer les parametres
|
||||
@@ -879,22 +897,27 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
// Présence d'un cache, que faire?..
|
||||
if ((fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.zip")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/new.zip")))
|
||||
||
|
||||
(fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/new.dat"))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/new.dat"))
|
||||
&&
|
||||
fexist(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")))
|
||||
) { // il existe déja un cache précédent.. renommer
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache/doit.log"))) { // un cache est présent
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-cache/doit.log"))) { // un cache est présent
|
||||
if (x_argvblk != NULL) {
|
||||
int m;
|
||||
|
||||
// établir mode - mode cache: 1 (cache valide) 2 (cache à vérifier)
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-in_progress.lock"))) { // cache prioritaire
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-in_progress.lock"))) { // cache prioritaire
|
||||
m = 1;
|
||||
} else {
|
||||
m = 2;
|
||||
@@ -952,23 +975,24 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
}
|
||||
} else { // plus de 2 paramètres
|
||||
// un fichier log existe?
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-in_progress.lock"))) { // fichier lock?
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-in_progress.lock"))) { // fichier lock?
|
||||
//char s[32];
|
||||
|
||||
opt->cache = 1; // cache prioritaire
|
||||
if (opt->quiet == 0) {
|
||||
if ((fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip")))
|
||||
||
|
||||
(fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"))
|
||||
&&
|
||||
fexist(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")))
|
||||
) {
|
||||
HT_REQUEST_START;
|
||||
@@ -987,22 +1011,22 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
} else
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_html), "index.html"))) {
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_html), "index.html"))) {
|
||||
//char s[32];
|
||||
opt->cache = 2; // cache vient après test de validité
|
||||
if (opt->quiet == 0) {
|
||||
if ((fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip")))
|
||||
||
|
||||
(fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"))
|
||||
&&
|
||||
fexist(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx")))
|
||||
) {
|
||||
HT_REQUEST_START;
|
||||
@@ -1960,7 +1984,6 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
char *filter = NULL;
|
||||
cache_back cache;
|
||||
inthash cache_hashtable = inthash_new(0);
|
||||
int backupXFR = htsMemoryFastXfr;
|
||||
int sendb = 0;
|
||||
|
||||
if (isdigit((unsigned char) *(com + 1))) {
|
||||
@@ -1974,7 +1997,6 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
hasFilter = 1;
|
||||
filter = argv[na];
|
||||
}
|
||||
htsMemoryFastXfr = 1; /* fast load */
|
||||
|
||||
memset(&cache, 0, sizeof(cache_back));
|
||||
cache.type = 1; // cache?
|
||||
@@ -1991,7 +2013,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
int pos;
|
||||
char *cacheNdx =
|
||||
readfile(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
cache_init(&cache, opt); /* load cache */
|
||||
if (cacheNdx != NULL) {
|
||||
@@ -2126,7 +2148,6 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
(hasFilter) ? " for '" : "",
|
||||
(hasFilter) ? filter : "", (hasFilter) ? "'" : "");
|
||||
}
|
||||
htsMemoryFastXfr = backupXFR;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -2139,13 +2160,8 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
return 0;
|
||||
break;
|
||||
case 'X':
|
||||
#ifndef STRDEBUG
|
||||
fprintf(stderr,
|
||||
"warning: no string debugging support built, option has no effect\n");
|
||||
#endif
|
||||
htsMemoryFastXfr = 1;
|
||||
fprintf(stderr, "warning: option has no effect\n");
|
||||
if (*(com + 1) == '0') {
|
||||
htsMemoryFastXfr = 0;
|
||||
com++;
|
||||
}
|
||||
break;
|
||||
@@ -2157,22 +2173,22 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"))) {
|
||||
name =
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip");
|
||||
} else
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"))) {
|
||||
name =
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip");
|
||||
} else {
|
||||
fprintf(stderr, "* error: no cache found in %s\n",
|
||||
fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"));
|
||||
return 1;
|
||||
@@ -2180,14 +2196,14 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
fprintf(stderr, "Cache: trying to repair %s\n", name);
|
||||
if (unzRepair
|
||||
(name,
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/repair.zip"),
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/repair.tmp"), &repaired,
|
||||
&repairedBytes) == Z_OK) {
|
||||
unlink(name);
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/repair.zip"), name);
|
||||
fprintf(stderr,
|
||||
"Cache: %d bytes successfully recovered in %d entries\n",
|
||||
@@ -2487,7 +2503,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
} else {
|
||||
capa <<= 1;
|
||||
}
|
||||
strings = realloc(strings, capa*sizeof(char*));
|
||||
strings = (const char **) realloc((void*) strings, capa*sizeof(char*));
|
||||
}
|
||||
strings[count++] = &buff[last];
|
||||
last = i + 1;
|
||||
@@ -2510,7 +2526,11 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
FMT();
|
||||
if (bench[loop].type == DO_ADD
|
||||
|| bench[loop].type == DO_DRY_ADD) {
|
||||
size_t k;
|
||||
result = inthash_write(hashtable, name, (uintptr_t) expected);
|
||||
for(k = 0 ; k < /* stash_size*2 */ 32 ; k++) {
|
||||
(void) inthash_write(hashtable, name, (uintptr_t) expected);
|
||||
}
|
||||
/* revert logic */
|
||||
if (bench[loop].type == DO_DRY_ADD) {
|
||||
result = result ? 0 : 1;
|
||||
@@ -2518,7 +2538,11 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
}
|
||||
else if (bench[loop].type == DO_DEL
|
||||
|| bench[loop].type == DO_DRY_DEL) {
|
||||
size_t k;
|
||||
result = inthash_remove(hashtable, name);
|
||||
for(k = 0 ; k < /* stash_size*2 */ 32 ; k++) {
|
||||
(void) inthash_remove(hashtable, name);
|
||||
}
|
||||
/* revert logic */
|
||||
if (bench[loop].type == DO_DRY_DEL) {
|
||||
result = result ? 0 : 1;
|
||||
@@ -2553,7 +2577,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
inthash_delete(&hashtable);
|
||||
fprintf(stderr, "all hashtable tests were successful!\n");
|
||||
} else {
|
||||
fprintf(stderr, "Malformed number");
|
||||
fprintf(stderr, "Malformed number\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#undef FMT
|
||||
@@ -2684,7 +2708,6 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
|
||||
} else { // URL/filters
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
char BIGSTK tempo[CATBUFF_SIZE];
|
||||
const int urlSize = (int) strlen(argv[na]);
|
||||
const int capa = (int) (strlen(url) + urlSize + 32);
|
||||
|
||||
@@ -2693,9 +2716,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
ensureUrlCapacity(url, url_sz, capa);
|
||||
if (strnotempty(url))
|
||||
strcatbuff(url, " "); // espace de séparation
|
||||
strcpybuff(tempo, unescape_http_unharm(catbuff, argv[na], 1));
|
||||
escape_spc_url(tempo);
|
||||
strcatbuff(url, tempo);
|
||||
append_escape_spc_url(unescape_http_unharm(catbuff, sizeof(catbuff), argv[na], 1), url, url_sz);
|
||||
}
|
||||
} // if argv=- etc.
|
||||
|
||||
@@ -2737,37 +2758,37 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
// en cas de présence des deux versions, garder la version la plus avancée,
|
||||
// cad la version contenant le plus de fichiers
|
||||
if (opt->cache) {
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-in_progress.lock"))) { // problemes..
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-in_progress.lock"))) { // problemes..
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"))) {
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"))) {
|
||||
if (fsize
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip")) < 32768) {
|
||||
if (fsize
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")) > 65536) {
|
||||
if (fsize
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")) > fsize(fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip")) > fsize(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->
|
||||
path_log),
|
||||
"hts-cache/new.zip")))
|
||||
{
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.zip"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.zip"));
|
||||
}
|
||||
@@ -2777,53 +2798,53 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
} else
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"))
|
||||
&&
|
||||
fexist(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"))) {
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"))
|
||||
&&
|
||||
fexist(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"))) {
|
||||
// switcher si new<32Ko et old>65Ko (tailles arbitraires) ?
|
||||
// ce cas est peut être une erreur ou un crash d'un miroir ancien, prendre
|
||||
// alors l'ancien cache
|
||||
if (fsize
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat")) < 32768) {
|
||||
if (fsize
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")) > 65536) {
|
||||
if (fsize
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")) > fsize(fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat")) > fsize(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->
|
||||
path_log),
|
||||
"hts-cache/new.dat")))
|
||||
{
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.dat"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.dat"));
|
||||
rename(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), fconcat(OPT_GET_BUFF(opt),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/old.ndx"), fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-cache/new.ndx"));
|
||||
//} else { // ne rien faire
|
||||
@@ -2840,7 +2861,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
if (_DEBUG_HEAD) {
|
||||
ioinfo =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-ioinfo.txt"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-ioinfo.txt"),
|
||||
"wb");
|
||||
}
|
||||
|
||||
@@ -2857,26 +2878,26 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
structcheck(StringBuff(opt->path_log));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-log.txt")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-log.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-log.txt"));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-log.txt"));
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-err.txt")))
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-err.txt")))
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-err.txt"));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-err.txt"));
|
||||
|
||||
/* Check FS directory structure created */
|
||||
structcheck(StringBuff(opt->path_log));
|
||||
|
||||
opt->log =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-log.txt"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-log.txt"),
|
||||
"w");
|
||||
if (httrack_logmode == 2)
|
||||
opt->errlog =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-err.txt"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-err.txt"),
|
||||
"w");
|
||||
else
|
||||
opt->errlog = opt->log;
|
||||
@@ -2884,7 +2905,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
char s[HTS_CDLMAXSIZE + 256];
|
||||
|
||||
sprintf(s, "Unable to create log file %s",
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-log.txt"));
|
||||
HTS_PANIC_PRINTF(s);
|
||||
htsmain_free();
|
||||
@@ -2893,7 +2914,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
char s[HTS_CDLMAXSIZE + 256];
|
||||
|
||||
sprintf(s, "Unable to create log file %s",
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-err.txt"));
|
||||
HTS_PANIC_PRINTF(s);
|
||||
htsmain_free();
|
||||
@@ -2918,7 +2939,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
{
|
||||
FILE *fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/readme.txt"), "wb");
|
||||
if (fp) {
|
||||
fprintf(fp, "What's in this folder?" LF);
|
||||
@@ -2943,7 +2964,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
}
|
||||
|
||||
strcpy(n_lock,
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-in_progress.lock"));
|
||||
//sprintf(n_lock,fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),"hts-in_progress.lock"),n);
|
||||
/*do {
|
||||
@@ -2960,8 +2981,8 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
} */
|
||||
|
||||
// vérifier existence de la structure
|
||||
structcheck(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_html), "/"));
|
||||
structcheck(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "/"));
|
||||
structcheck(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_html), "/"));
|
||||
structcheck(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "/"));
|
||||
|
||||
// reprise/update
|
||||
if (opt->cache) {
|
||||
@@ -2970,15 +2991,15 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
|
||||
#ifdef _WIN32
|
||||
mkdir(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache"));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache"));
|
||||
#else
|
||||
mkdir(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-cache"),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-cache"),
|
||||
HTS_PROTECT_FOLDER);
|
||||
#endif
|
||||
fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-cache/doit.log"), "wb");
|
||||
if (fp) {
|
||||
for(i = 0 + 1; i < argc; i++) {
|
||||
@@ -3189,7 +3210,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
|
||||
for(dir =
|
||||
opendir(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
CACHE_REFNAME));
|
||||
dir != NULL && (entry = readdir(dir)) != NULL;) {
|
||||
if (entry->d_name[0] != '\0' && entry->d_name[0] != '.') {
|
||||
@@ -3197,7 +3218,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
|
||||
sprintf(f, "%s/%s", CACHE_REFNAME, entry->d_name);
|
||||
(void)
|
||||
unlink(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), f));
|
||||
unlink(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), f));
|
||||
}
|
||||
}
|
||||
if (dir != NULL) {
|
||||
@@ -3205,7 +3226,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
|
||||
}
|
||||
(void)
|
||||
rmdir(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), CACHE_REFNAME));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), CACHE_REFNAME));
|
||||
}
|
||||
|
||||
/* Info for wrappers */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -43,11 +43,6 @@ Please visit our Website: http://www.httrack.com
|
||||
|
||||
/* Library internal definictions */
|
||||
#ifdef HTS_INTERNAL_BYTECODE
|
||||
// Main, récupère les paramètres et appelle le robot
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int hts_main(int argc, char **argv);
|
||||
HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt);
|
||||
#endif
|
||||
|
||||
int cmdl_opt(char *s);
|
||||
int check_path(String * s, char *defaultname);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -232,7 +232,6 @@ struct t_hts_callback_ref {
|
||||
};
|
||||
|
||||
extern const t_hts_htmlcheck_callbacks default_callbacks;
|
||||
extern const t_hts_callback_ref default_callbacks_ref[];
|
||||
|
||||
#define HT_PRINT(A) strcatbuff(opt->state.HTbuff,A);
|
||||
#define HT_REQUEST_START opt->state.HTbuff[0]='\0';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -30,10 +30,9 @@ Please visit our Website: http://www.httrack.com
|
||||
/* Author: Xavier Roche */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "htscharset.h"
|
||||
#include "htsencoding.h"
|
||||
#include "htssafe.h"
|
||||
|
||||
/* static int decode_entity(const unsigned int hash, const size_t len);
|
||||
*/
|
||||
@@ -67,7 +66,7 @@ int hts_unescapeEntitiesWithCharset(const char *src, char *dest, const size_t ma
|
||||
int hex;
|
||||
unsigned int hash;
|
||||
|
||||
assert(max != 0);
|
||||
assertf(max != 0);
|
||||
for(i = 0, j = 0, ampStart = (size_t) -1, ampStartDest = 0,
|
||||
uc = -1, hex = 0, hash = 0 ; src[i] != '\0' ; i++) {
|
||||
/* start of entity */
|
||||
@@ -209,8 +208,8 @@ int hts_unescapeUrlSpecial(const char *src, char *dest, const size_t max,
|
||||
int seenQuery = 0;
|
||||
char utfBuffer[32];
|
||||
|
||||
assert(src != dest);
|
||||
assert(max != 0);
|
||||
assertf(src != dest);
|
||||
assertf(max != 0);
|
||||
|
||||
for(i = 0, j = 0, k = 0, utfBufferJ = 0, utfBufferSize = 0,
|
||||
lastI = (size_t) -1, lastJ = (size_t) -1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -86,8 +86,7 @@ extern int hts_unescapeUrl(const char *src, char *dest, const size_t max);
|
||||
* Note: source and destination MUST NOT be the same.
|
||||
* Returns 0 upon success, -1 upon overflow or error.
|
||||
**/
|
||||
extern int hts_unescapeUrlSpecial(const char *src,
|
||||
char *dest, const size_t max,
|
||||
int flags);
|
||||
extern int hts_unescapeUrlSpecial(const char *src, char *dest, const size_t max,
|
||||
const int flags);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
86
src/htsftp.c
86
src/htsftp.c
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -147,16 +147,12 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
int timeout_onfly = 8; // attente réponse supplémentaire
|
||||
int transfer_list = 0; // directory
|
||||
int rest_understood = 0; // rest command understood
|
||||
t_fullhostent fullhostent_buffer; // buffer pour resolver
|
||||
|
||||
//
|
||||
T_SOC soc_ctl = INVALID_SOCKET;
|
||||
T_SOC soc_servdat = INVALID_SOCKET;
|
||||
T_SOC soc_dat = INVALID_SOCKET;
|
||||
|
||||
//
|
||||
SOCaddr server_data;
|
||||
int server_data_size = sizeof(server_data);
|
||||
|
||||
//
|
||||
line_retr[0] = adr_ip[0] = '\0';
|
||||
@@ -217,7 +213,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
ftp_filename = a;
|
||||
if (strnotempty(a)) {
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
char *ua = unescape_http(catbuff, a);
|
||||
char *ua = unescape_http(catbuff, sizeof(catbuff), a);
|
||||
int len_a = (int) strlen(ua);
|
||||
|
||||
if (len_a > 0 && ua[len_a - 1] == '/') { /* obviously a directory listing */
|
||||
@@ -249,8 +245,6 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
// connexion
|
||||
{
|
||||
SOCaddr server;
|
||||
int server_size = sizeof(server);
|
||||
t_hostent *hp;
|
||||
char *a;
|
||||
char _adr[256];
|
||||
const char *error = "unknown error";
|
||||
@@ -270,8 +264,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
|
||||
// récupérer adresse résolue
|
||||
strcpybuff(back->info, "host name");
|
||||
hp = hts_gethostbyname2(opt, _adr, &fullhostent_buffer, &error);
|
||||
if (hp == NULL) {
|
||||
if (hts_dns_resolve2(opt, _adr, &server, &error) == NULL) {
|
||||
snprintf(back->r.msg, sizeof(back->r.msg),
|
||||
"Unable to get server's address: %s", error);
|
||||
// back->status=STATUS_FTP_READY; // fini
|
||||
@@ -280,12 +273,8 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
}
|
||||
_CHECK_HALT_FTP;
|
||||
|
||||
// copie adresse
|
||||
SOCaddr_copyaddr(server, server_size, hp->h_addr_list[0], hp->h_length);
|
||||
// copie adresse pour cnx data
|
||||
SOCaddr_copyaddr(server_data, server_data_size, hp->h_addr_list[0],
|
||||
hp->h_length);
|
||||
// memcpy(&server.sin_addr, hp->h_addr, hp->h_length);
|
||||
SOCaddr_copy_SOCaddr(server_data, server);
|
||||
|
||||
// créer ("attachement") une socket (point d'accès) internet,en flot
|
||||
soc_ctl = (T_SOC) socket(SOCaddr_sinfamily(server), SOCK_STREAM, 0);
|
||||
@@ -302,12 +291,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
// connexion (bloquante, on est en thread)
|
||||
strcpybuff(back->info, "connect");
|
||||
|
||||
#ifdef _WIN32
|
||||
if (connect(soc_ctl, (const struct sockaddr FAR *) &server, server_size) !=
|
||||
0) {
|
||||
#else
|
||||
if (connect(soc_ctl, (struct sockaddr *) &server, server_size) == -1) {
|
||||
#endif
|
||||
if (connect(soc_ctl, &SOCaddr_sockaddr(server), SOCaddr_size(server)) != 0) {
|
||||
strcpybuff(back->r.msg, "Unable to connect to the server");
|
||||
// back->status=STATUS_FTP_READY; // fini
|
||||
back->r.statuscode = STATUSCODE_INVALID;
|
||||
@@ -419,7 +403,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
// Pré-REST
|
||||
//
|
||||
#if FTP_PASV
|
||||
if (SOCaddr_getproto(server, server_size) == '1') {
|
||||
if (SOCaddr_getproto(server) == '1') {
|
||||
strcpybuff(back->info, "pasv");
|
||||
snprintf(line, sizeof(line), "PASV");
|
||||
send_line(soc_ctl, line);
|
||||
@@ -528,7 +512,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
if (back->r.statuscode != -1) {
|
||||
if (!transfer_list) {
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
char *ua = unescape_http(catbuff, ftp_filename);
|
||||
char *ua = unescape_http(catbuff, sizeof(catbuff), ftp_filename);
|
||||
|
||||
if ((strchr(ua, ' '))
|
||||
|| (strchr(ua, '\"'))
|
||||
@@ -581,7 +565,6 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
if (port_pasv) {
|
||||
SOCaddr server;
|
||||
int server_size = sizeof(server);
|
||||
t_hostent *hp;
|
||||
const char *error = "unknown error";
|
||||
|
||||
// effacer structure
|
||||
@@ -592,16 +575,9 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
|
||||
// résoudre
|
||||
if (adr_ip[0]) {
|
||||
hp = hts_gethostbyname2(opt, adr_ip, &fullhostent_buffer, &error);
|
||||
if (hp) {
|
||||
SOCaddr_copyaddr(server, server_size, hp->h_addr_list[0],
|
||||
hp->h_length);
|
||||
} else {
|
||||
server_size = 0;
|
||||
}
|
||||
hts_dns_resolve2(opt, adr_ip, &server, &error);
|
||||
} else {
|
||||
memcpy(&server, &server_data, sizeof(server_data));
|
||||
server_size = server_data_size;
|
||||
SOCaddr_copy_SOCaddr(server, server_data);
|
||||
}
|
||||
|
||||
// infos
|
||||
@@ -615,15 +591,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
|
||||
if (soc_dat != INVALID_SOCKET) {
|
||||
// structure: connexion au domaine internet, port 80 (ou autre)
|
||||
SOCaddr_initport(server, port_pasv);
|
||||
// server.sin_port = htons((unsigned short int) port_pasv);
|
||||
#ifdef _WIN32
|
||||
if (connect
|
||||
(soc_dat, (const struct sockaddr FAR *) &server,
|
||||
server_size) == 0) {
|
||||
#else
|
||||
if (connect(soc_dat, (struct sockaddr *) &server, server_size) !=
|
||||
-1) {
|
||||
#endif
|
||||
if (connect(soc_dat, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
|
||||
strcpybuff(back->info, "retr");
|
||||
strcpybuff(line, line_retr);
|
||||
send_line(soc_ctl, line);
|
||||
@@ -856,33 +824,19 @@ T_SOC get_datasocket(char *to_send, size_t to_send_size) {
|
||||
to_send[0] = '\0';
|
||||
if (gethostname(h_loc, 256) == 0) { // host name
|
||||
SOCaddr server;
|
||||
int server_size = sizeof(server);
|
||||
t_hostent *hp_loc;
|
||||
t_fullhostent buffer;
|
||||
|
||||
// effacer structure
|
||||
memset(&server, 0, sizeof(server));
|
||||
|
||||
if ((hp_loc = vxgethostbyname(h_loc, &buffer))) { // notre host
|
||||
|
||||
// copie adresse
|
||||
SOCaddr_copyaddr(server, server_size, hp_loc->h_addr_list[0],
|
||||
hp_loc->h_length);
|
||||
|
||||
if (hts_dns_resolve_nocache(h_loc, &server) != NULL) { // notre host
|
||||
if ((soc =
|
||||
(T_SOC) socket(SOCaddr_sinfamily(server), SOCK_STREAM,
|
||||
0)) != INVALID_SOCKET) {
|
||||
|
||||
if (bind(soc, (struct sockaddr *) &server, server_size) == 0) {
|
||||
if (bind(soc, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
|
||||
SOCaddr server2;
|
||||
SOClen len;
|
||||
SOClen len = SOCaddr_capacity(server2);
|
||||
|
||||
len = sizeof(server2);
|
||||
// effacer structure
|
||||
memset(&server2, 0, sizeof(server2));
|
||||
if (getsockname(soc, (struct sockaddr *) &server2, &len) == 0) {
|
||||
if (getsockname(soc, &SOCaddr_sockaddr(server2), &len) == 0) {
|
||||
// *port=ntohs(server.sin_port); // récupérer port
|
||||
if (listen(soc, 10) >= 0) { // au pif le 10
|
||||
if (listen(soc, 1) >= 0) {
|
||||
#if HTS_INET6==0
|
||||
unsigned short int a, n1, n2;
|
||||
|
||||
@@ -895,7 +849,7 @@ T_SOC get_datasocket(char *to_send, size_t to_send_size) {
|
||||
char dot[256 + 2];
|
||||
char *a;
|
||||
|
||||
SOCaddr_inetntoa(dot, 256, server2, sizeof(server2));
|
||||
SOCaddr_inetntoa(dot, 256, server2);
|
||||
//
|
||||
dots[0] = '\0';
|
||||
strncatbuff(dots, dot, 128);
|
||||
@@ -913,9 +867,9 @@ T_SOC get_datasocket(char *to_send, size_t to_send_size) {
|
||||
{
|
||||
char dot[256 + 2];
|
||||
|
||||
SOCaddr_inetntoa(dot, 256, server2, len);
|
||||
SOCaddr_inetntoa(dot, 256, server2);
|
||||
snprintf(to_send, to_send_size, "EPRT |%c|%s|%d|",
|
||||
SOCaddr_getproto(server2, len), dot,
|
||||
SOCaddr_getproto(server2), dot,
|
||||
SOCaddr_sinport(server2));
|
||||
}
|
||||
#endif
|
||||
@@ -1093,7 +1047,7 @@ int check_socket(T_SOC soc) {
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
// poll!
|
||||
select(soc + 1, &fds, NULL, &fds_e, &tv);
|
||||
select((int) soc + 1, &fds, NULL, &fds_e, &tv);
|
||||
if (FD_ISSET(soc, &fds_e)) { // error detected
|
||||
return -1;
|
||||
} else if (FD_ISSET(soc, &fds)) {
|
||||
@@ -1116,7 +1070,7 @@ int check_socket_connect(T_SOC soc) {
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
// poll!
|
||||
select(soc + 1, NULL, &fds, &fds_e, &tv);
|
||||
select((int) soc + 1, NULL, &fds, &fds_e, &tv);
|
||||
if (FD_ISSET(soc, &fds_e)) { // error detected
|
||||
return -1;
|
||||
} else if (FD_ISSET(soc, &fds)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -36,8 +36,8 @@ Please visit our Website: http://www.httrack.com
|
||||
#define HTTRACK_GLOBAL_DEFH
|
||||
|
||||
// Version (also check external version information)
|
||||
#define HTTRACK_VERSION "3.48-3"
|
||||
#define HTTRACK_VERSIONID "3.48.3"
|
||||
#define HTTRACK_VERSION "3.48-9"
|
||||
#define HTTRACK_VERSIONID "3.48.9"
|
||||
#define HTTRACK_AFF_VERSION "3.x"
|
||||
#define HTTRACK_LIB_VERSION "2.0"
|
||||
|
||||
@@ -57,6 +57,19 @@ Please visit our Website: http://www.httrack.com
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* GCC extension */
|
||||
#ifndef HTS_UNUSED
|
||||
#ifdef __GNUC__
|
||||
#define HTS_UNUSED __attribute__ ((unused))
|
||||
#define HTS_STATIC static __attribute__ ((unused))
|
||||
#define HTS_PRINTF_FUN(fmt, arg) __attribute__ ((format (printf, fmt, arg)))
|
||||
#else
|
||||
#define HTS_UNUSED
|
||||
#define HTS_STATIC static
|
||||
#define HTS_PRINTF_FUN(fmt, arg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// config.h
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -205,8 +218,8 @@ Please visit our Website: http://www.httrack.com
|
||||
#define HTS_CDLMAXSIZE 1024
|
||||
#endif
|
||||
|
||||
/* Copyright (C) 1998-2013 Xavier Roche and other contributors */
|
||||
#define HTTRACK_AFF_AUTHORS "[XR&CO'2013]"
|
||||
/* Copyright (C) 1998-2014 Xavier Roche and other contributors */
|
||||
#define HTTRACK_AFF_AUTHORS "[XR&CO'2014]"
|
||||
#define HTS_DEFAULT_FOOTER "<!-- Mirrored from %s%s by HTTrack Website Copier/"HTTRACK_AFF_VERSION" "HTTRACK_AFF_AUTHORS", %s -->"
|
||||
#define HTTRACK_WEB "http://www.httrack.com"
|
||||
#define HTS_UPDATE_WEBSITE "http://www.httrack.com/update.php3?Product=HTTrack&Version="HTTRACK_VERSIONID"&VersionStr="HTTRACK_VERSION"&Platform=%d&Language=%s"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -34,11 +34,11 @@ Please visit our Website: http://www.httrack.com
|
||||
/* Internal engine bytecode */
|
||||
#define HTS_INTERNAL_BYTECODE
|
||||
|
||||
#include "htsopt.h"
|
||||
#include "htshash.h"
|
||||
|
||||
/* specific definitions */
|
||||
#include "htsbase.h"
|
||||
#include "htsopt.h"
|
||||
#include "htsglobal.h"
|
||||
#include "htsmd5.h"
|
||||
#include "htscore.h"
|
||||
@@ -85,6 +85,14 @@ static int key_sav_equals(void *arg, const char *a, const char *b) {
|
||||
return strcasecmp(a, b) == 0;
|
||||
}
|
||||
|
||||
static const char* key_sav_debug_print(void *arg, const char *a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
static const char* value_sav_debug_print(void *arg, void *a) {
|
||||
return (char*) a;
|
||||
}
|
||||
|
||||
/* Pseudo-key (lien_url structure) hash function */
|
||||
static inthash_keys key_adrfil_hashes_generic(void *arg, const char *value_,
|
||||
const int former) {
|
||||
@@ -151,6 +159,31 @@ static int key_adrfil_equals_generic(void *arg, const char *a_, const char *b_,
|
||||
}
|
||||
}
|
||||
|
||||
static const char* key_adrfil_debug_print_(void *arg, const char *a_, const int former) {
|
||||
hash_struct *const hash = (hash_struct*) arg;
|
||||
const lien_url*const a = (lien_url*) a_;
|
||||
const char *const a_adr = !former ? a->adr : a->former_adr;
|
||||
const char *const a_fil = !former ? a->fil : a->former_fil;
|
||||
snprintf(hash->normfil, sizeof(hash->normfil), "%s%s", a_adr, a_fil);
|
||||
return hash->normfil;
|
||||
}
|
||||
|
||||
static const char* key_adrfil_debug_print(void *arg, const char *a_) {
|
||||
return key_adrfil_debug_print_(arg, a_, 0);
|
||||
}
|
||||
|
||||
static const char* key_former_adrfil_debug_print(void *arg, const char *a_) {
|
||||
return key_adrfil_debug_print_(arg, a_, 1);
|
||||
}
|
||||
|
||||
static const char* value_adrfil_debug_print(void *arg, void *value) {
|
||||
hash_struct *const hash = (hash_struct*) arg;
|
||||
inthash_value v;
|
||||
v.ptr = value;
|
||||
snprintf(hash->normfil2, sizeof(hash->normfil2), "%d", (int) v.intg);
|
||||
return hash->normfil2;
|
||||
}
|
||||
|
||||
/* "adr"/"fil" lien_url structure members hashing function */
|
||||
static inthash_keys key_adrfil_hashes(void *arg, const char *value_) {
|
||||
return key_adrfil_hashes_generic(arg, value_, 0);
|
||||
@@ -171,12 +204,20 @@ static int key_former_adrfil_equals(void *arg, const char *a, const char *b) {
|
||||
return key_adrfil_equals_generic(arg, a, b, 1);
|
||||
}
|
||||
|
||||
void hash_init(hash_struct * hash, int normalized) {
|
||||
void hash_init(httrackp *opt, hash_struct * hash, int normalized) {
|
||||
hash->sav = inthash_new(0);
|
||||
hash->adrfil = inthash_new(0);
|
||||
hash->former_adrfil = inthash_new(0);
|
||||
hash->normalized = normalized;
|
||||
|
||||
hts_set_hash_handler(hash->sav, opt);
|
||||
hts_set_hash_handler(hash->adrfil, opt);
|
||||
hts_set_hash_handler(hash->former_adrfil, opt);
|
||||
|
||||
inthash_set_name(hash->sav, "hash->sav");
|
||||
inthash_set_name(hash->adrfil, "hash->adrfil");
|
||||
inthash_set_name(hash->former_adrfil, "hash->former_adrfil");
|
||||
|
||||
/* Case-insensitive comparison ; keys are direct char* filenames */
|
||||
inthash_value_set_key_handler(hash->sav,
|
||||
key_duphandler,
|
||||
@@ -199,6 +240,20 @@ void hash_init(hash_struct * hash, int normalized) {
|
||||
key_former_adrfil_hashes,
|
||||
key_former_adrfil_equals,
|
||||
hash);
|
||||
|
||||
/* pretty-printing */
|
||||
inthash_set_print_handler(hash->sav,
|
||||
key_sav_debug_print,
|
||||
value_sav_debug_print,
|
||||
NULL);
|
||||
inthash_set_print_handler(hash->adrfil,
|
||||
key_adrfil_debug_print,
|
||||
value_adrfil_debug_print,
|
||||
hash);
|
||||
inthash_set_print_handler(hash->former_adrfil,
|
||||
key_former_adrfil_debug_print,
|
||||
value_adrfil_debug_print,
|
||||
hash);
|
||||
}
|
||||
|
||||
void hash_free(hash_struct *hash) {
|
||||
@@ -264,3 +319,14 @@ void hash_write(hash_struct * hash, int lpos) {
|
||||
inthash_write(hash->former_adrfil, (char*) hash->liens[lpos], lpos);
|
||||
}
|
||||
}
|
||||
|
||||
void hash_invalidate_entry(hash_struct * hash, int lpos) {
|
||||
if (inthash_remove(hash->adrfil, (char*) hash->liens[lpos])) {
|
||||
/* devalidate entry now it is removed from hashtable */
|
||||
strcpybuff(hash->liens[lpos]->adr, "!");
|
||||
/* add back */
|
||||
inthash_write(hash->adrfil, (char*) hash->liens[lpos], lpos);
|
||||
} else {
|
||||
assertf(! "error invalidating hash entry");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -51,11 +51,12 @@ typedef enum hash_struct_type {
|
||||
} hash_struct_type;
|
||||
|
||||
// tables de hachage
|
||||
void hash_init(hash_struct *hash, int normalized);
|
||||
void hash_init(httrackp *opt, hash_struct *hash, int normalized);
|
||||
void hash_free(hash_struct *hash);
|
||||
int hash_read(const hash_struct * hash, const char *nom1, const char *nom2,
|
||||
hash_struct_type type);
|
||||
void hash_write(hash_struct * hash, int lpos);
|
||||
void hash_invalidate_entry(hash_struct * hash, int lpos);
|
||||
int *hash_calc_chaine(hash_struct * hash, hash_struct_type type, int pos);
|
||||
unsigned long int hash_cle(const char *nom1, const char *nom2);
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -116,16 +116,51 @@ void infomsg(char *msg) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct help_wizard_buffers {
|
||||
char urls[HTS_URLMAXSIZE * 2];
|
||||
char mainpath[256];
|
||||
char projname[256];
|
||||
char stropt[2048]; // options
|
||||
char stropt2[2048]; // options longues
|
||||
char strwild[2048]; // wildcards
|
||||
char cmd[4096];
|
||||
char str[256];
|
||||
char *argv[256];
|
||||
} help_wizard_buffers;
|
||||
|
||||
void help_wizard(httrackp * opt) {
|
||||
char *urls = (char *) malloct(HTS_URLMAXSIZE * 2);
|
||||
char *mainpath = (char *) malloct(256);
|
||||
char *projname = (char *) malloct(256);
|
||||
char *stropt = (char *) malloct(2048); // options
|
||||
char *stropt2 = (char *) malloct(2048); // options longues
|
||||
char *strwild = (char *) malloct(2048); // wildcards
|
||||
char *cmd = (char *) malloct(4096);
|
||||
char *str = (char *) malloct(256);
|
||||
char **argv = (char **) malloct(256 * sizeof(char *));
|
||||
help_wizard_buffers *buffers = malloct(sizeof(help_wizard_buffers));
|
||||
|
||||
#undef urls
|
||||
#undef mainpath
|
||||
#undef projname
|
||||
#undef stropt
|
||||
#undef stropt2
|
||||
#undef strwild
|
||||
#undef cmd
|
||||
#undef str
|
||||
#undef argv
|
||||
|
||||
#define urls (buffers->urls)
|
||||
#define mainpath (buffers->mainpath)
|
||||
#define projname (buffers->projname)
|
||||
#define stropt (buffers->stropt)
|
||||
#define stropt2 (buffers->stropt2)
|
||||
#define strwild (buffers->strwild)
|
||||
#define cmd (buffers->cmd)
|
||||
#define str (buffers->str)
|
||||
#define argv (buffers->argv)
|
||||
|
||||
//char *urls = (char *) malloct(HTS_URLMAXSIZE * 2);
|
||||
//char *mainpath = (char *) malloct(256);
|
||||
//char *projname = (char *) malloct(256);
|
||||
//char *stropt = (char *) malloct(2048); // options
|
||||
//char *stropt2 = (char *) malloct(2048); // options longues
|
||||
//char *strwild = (char *) malloct(2048); // wildcards
|
||||
//char *cmd = (char *) malloct(4096);
|
||||
//char *str = (char *) malloct(256);
|
||||
//char **argv = (char **) malloct(256 * sizeof(char *));
|
||||
|
||||
//
|
||||
char *a;
|
||||
@@ -147,7 +182,7 @@ void help_wizard(httrackp * opt) {
|
||||
printf("\n");
|
||||
printf("Welcome to HTTrack Website Copier (Offline Browser) " HTTRACK_VERSION
|
||||
"%s\n", hts_get_version_info(opt));
|
||||
printf("Copyright (C) 1998-2013 Xavier Roche and other contributors\n");
|
||||
printf("Copyright (C) 1998-2014 Xavier Roche and other contributors\n");
|
||||
#ifdef _WIN32
|
||||
printf("Note: You are running the commandline version,\n");
|
||||
printf("run 'WinHTTrack.exe' to get the GUI version.\n");
|
||||
@@ -318,14 +353,16 @@ void help_wizard(httrackp * opt) {
|
||||
}
|
||||
|
||||
/* Free buffers */
|
||||
freet(urls);
|
||||
freet(mainpath);
|
||||
freet(projname);
|
||||
freet(stropt);
|
||||
freet(stropt2);
|
||||
freet(strwild);
|
||||
freet(cmd);
|
||||
freet(str);
|
||||
free(buffers);
|
||||
#undef urls
|
||||
#undef mainpath
|
||||
#undef projname
|
||||
#undef stropt
|
||||
#undef stropt2
|
||||
#undef strwild
|
||||
#undef cmd
|
||||
#undef str
|
||||
#undef argv
|
||||
}
|
||||
int help_query(char *list, int def) {
|
||||
char s[256];
|
||||
@@ -401,7 +438,7 @@ void help_catchurl(const char *dest_path) {
|
||||
{
|
||||
char BIGSTK finalurl[HTS_URLMAXSIZE * 2];
|
||||
|
||||
escape_check_url(dest);
|
||||
inplace_escape_check_url(dest, sizeof(dest));
|
||||
sprintf(finalurl, "%s" POSTTOK "file:%s", url, dest);
|
||||
printf("\nThe URL is: \"%s\"\n", finalurl);
|
||||
printf("You can capture it through: httrack \"%s\"\n", finalurl);
|
||||
@@ -444,7 +481,7 @@ void help(char *app, int more) {
|
||||
infomsg("1");
|
||||
if (more != 2) {
|
||||
sprintf(info,
|
||||
"HTTrack version " HTTRACK_VERSION "%s (compiled " __DATE__ ")",
|
||||
"HTTrack version " HTTRACK_VERSION "%s",
|
||||
hts_is_available());
|
||||
infomsg(info);
|
||||
#ifdef HTTRACK_AFF_WARNING
|
||||
@@ -755,10 +792,10 @@ void help(char *app, int more) {
|
||||
infomsg("example: httrack --continue");
|
||||
infomsg("continues a mirror in the current folder");
|
||||
infomsg("");
|
||||
sprintf(info, "HTTrack version " HTTRACK_VERSION "%s (compiled " __DATE__ ")",
|
||||
sprintf(info, "HTTrack version " HTTRACK_VERSION "%s",
|
||||
hts_is_available());
|
||||
infomsg(info);
|
||||
infomsg("Copyright (C) 1998-2013 Xavier Roche and other contributors");
|
||||
infomsg("Copyright (C) 1998-2014 Xavier Roche and other contributors");
|
||||
#ifdef HTS_PLATFORM_NAME
|
||||
infomsg("[compiled: " HTS_PLATFORM_NAME "]");
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -161,8 +161,8 @@ int index_keyword(const char *html_data, LLint size, const char *mime,
|
||||
|
||||
// Init ?
|
||||
if (hts_index_init) {
|
||||
UNLINK(concat(catbuff, indexpath, "index.txt"));
|
||||
UNLINK(concat(catbuff, indexpath, "sindex.html"));
|
||||
UNLINK(concat(catbuff, sizeof(catbuff), indexpath, "index.txt"));
|
||||
UNLINK(concat(catbuff, sizeof(catbuff), indexpath, "sindex.html"));
|
||||
hts_index_init = 0;
|
||||
}
|
||||
// Check MIME type
|
||||
@@ -291,7 +291,7 @@ int index_keyword(const char *html_data, LLint size, const char *mime,
|
||||
|
||||
e++; /* 0 means "once" */
|
||||
|
||||
if (strncmp((const char *) fslash(catbuff, (char *) indexpath), filename, strlen(indexpath)) == 0) // couper
|
||||
if (strncmp((const char *) fslash(catbuff, sizeof(catbuff), (char *) indexpath), filename, strlen(indexpath)) == 0) // couper
|
||||
strcpybuff(savelst, filename + strlen(indexpath));
|
||||
else
|
||||
strcpybuff(savelst, filename);
|
||||
@@ -358,9 +358,9 @@ void index_finish(const char *indexpath, int mode) {
|
||||
|
||||
// Write new file
|
||||
if (mode == 1) // TEXT
|
||||
fp = fopen(concat(catbuff, indexpath, "index.txt"), "wb");
|
||||
fp = fopen(concat(catbuff, sizeof(catbuff), indexpath, "index.txt"), "wb");
|
||||
else // HTML
|
||||
fp = fopen(concat(catbuff, indexpath, "sindex.html"), "wb");
|
||||
fp = fopen(concat(catbuff, sizeof(catbuff), indexpath, "sindex.html"), "wb");
|
||||
if (fp) {
|
||||
char current_word[KEYW_LEN + 32];
|
||||
char word[KEYW_LEN + 32];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
411
src/htsinthash.c
411
src/htsinthash.c
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -26,8 +26,7 @@ Please visit our Website: http://www.httrack.com
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* File: httrack.c subroutines: */
|
||||
/* hash tables */
|
||||
/* File: hash tables */
|
||||
/* Author: Xavier Roche */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
@@ -83,7 +82,7 @@ Please visit our Website: http://www.httrack.com
|
||||
#define STASH_SIZE 16
|
||||
|
||||
/** Minimum value for lg_size. **/
|
||||
#define MIN_LG_SIZE 8
|
||||
#define MIN_LG_SIZE 4
|
||||
|
||||
/** Minimum value for pool.capacity. **/
|
||||
#define MIN_POOL_CAPACITY 256
|
||||
@@ -176,40 +175,78 @@ struct struct_inthash {
|
||||
/** opaque argument **/
|
||||
void *arg;
|
||||
} key;
|
||||
|
||||
/** How to handle fatal assertions (might be NULL). **/
|
||||
struct {
|
||||
/** logging **/
|
||||
t_inthash_loghandler log;
|
||||
/** abort() **/
|
||||
t_inthash_asserthandler fatal;
|
||||
/** opaque argument **/
|
||||
void *arg;
|
||||
/** hashtable name for logging **/
|
||||
const char *name;
|
||||
} error;
|
||||
|
||||
/** How to handle pretty-print (debug) (might be NULL). **/
|
||||
struct {
|
||||
/** key print() **/
|
||||
t_inthash_printkeyhandler key;
|
||||
/** value print() **/
|
||||
t_inthash_printvaluehandler value;
|
||||
/** opaque argument **/
|
||||
void *arg;
|
||||
} print;
|
||||
} custom;
|
||||
};
|
||||
|
||||
/* Using httrack code */
|
||||
#ifdef LIBHTTRACK_EXPORTS
|
||||
#include "htsbase.h"
|
||||
#define inthash_assert assertf
|
||||
/* Assertion check. */
|
||||
#define inthash_assert(HASHTABLE, EXP) \
|
||||
(void)( (EXP) || (inthash_assert_failed(HASHTABLE, #EXP, __FILE__, __LINE__), 0) )
|
||||
|
||||
/* Compiler-specific. */
|
||||
#ifdef __GNUC__
|
||||
#define INTHASH_PRINTF_FUN(fmt, arg) __attribute__ ((format (printf, fmt, arg)))
|
||||
#define INTHASH_INLINE __inline__
|
||||
#elif (defined(_MSC_VER))
|
||||
#define INTHASH_PRINTF_FUN(FMT, ARGS)
|
||||
#define INTHASH_INLINE __inline
|
||||
#else
|
||||
static void inthash_fail(const char* exp, const char* file, int line) {
|
||||
fprintf(stderr, "assertion '%s' failed at %s:%d\n", exp, file, line);
|
||||
abort();
|
||||
}
|
||||
#define inthash_assert(EXP) (void)( (EXP) || (inthash_fail(#EXP, __FILE__, __LINE__), 0) )
|
||||
#define HTS_PRINTF_FUN(FMT, ARGS)
|
||||
#define HTS_INLINE
|
||||
#define INTHASH_PRINTF_FUN(FMT, ARGS)
|
||||
#define INTHASH_INLINE
|
||||
#endif
|
||||
|
||||
/* Logging level. */
|
||||
static void inthash_log(const inthash hashtable, inthash_loglevel level,
|
||||
const char *format, va_list args);
|
||||
#define DECLARE_LOG_FUNCTION(NAME, LEVEL) \
|
||||
static void NAME(const inthash hashtable, const char *format, ...) \
|
||||
INTHASH_PRINTF_FUN(2, 3); \
|
||||
static void NAME(const inthash hashtable, const char *format, ...) { \
|
||||
va_list args; \
|
||||
va_start(args, format); \
|
||||
inthash_log(hashtable, LEVEL, format, args); \
|
||||
va_end(args); \
|
||||
}
|
||||
#if 0
|
||||
/* Verbose. */
|
||||
#define inthash_crit inthash_log
|
||||
#define inthash_info inthash_log
|
||||
#define inthash_debug inthash_log
|
||||
#define inthash_trace inthash_log
|
||||
DECLARE_LOG_FUNCTION(inthash_crit, inthash_log_critical)
|
||||
DECLARE_LOG_FUNCTION(inthash_warning, inthash_log_warning)
|
||||
DECLARE_LOG_FUNCTION(inthash_info, inthash_log_info)
|
||||
DECLARE_LOG_FUNCTION(inthash_debug, inthash_log_debug)
|
||||
DECLARE_LOG_FUNCTION(inthash_trace, inthash_log_trace)
|
||||
#elif 0
|
||||
/* Info. */
|
||||
#define inthash_crit inthash_log
|
||||
#define inthash_info inthash_log
|
||||
DECLARE_LOG_FUNCTION(inthash_crit, inthash_log_critical)
|
||||
DECLARE_LOG_FUNCTION(inthash_warning, inthash_log_warning)
|
||||
DECLARE_LOG_FUNCTION(inthash_info, inthash_log_info)
|
||||
#define inthash_debug inthash_log
|
||||
#define inthash_trace inthash_nolog
|
||||
#else
|
||||
/* No logging except stats and critical. */
|
||||
#define inthash_crit inthash_log
|
||||
#define inthash_info inthash_log
|
||||
DECLARE_LOG_FUNCTION(inthash_crit, inthash_log_critical)
|
||||
DECLARE_LOG_FUNCTION(inthash_warning, inthash_log_warning)
|
||||
DECLARE_LOG_FUNCTION(inthash_info, inthash_log_info)
|
||||
#define inthash_debug inthash_nolog
|
||||
#define inthash_trace inthash_nolog
|
||||
#endif
|
||||
@@ -220,21 +257,99 @@ static void inthash_fail(const char* exp, const char* file, int line) {
|
||||
/* the empty string for the string pool */
|
||||
static char the_empty_string[1] = { 0 };
|
||||
|
||||
/* global assertion handler */
|
||||
static t_inthash_asserthandler global_assert_handler = NULL;
|
||||
|
||||
/* global assertion handler */
|
||||
static t_inthash_loghandler global_log_handler = NULL;
|
||||
|
||||
/* default assertion handler, if neither hashtable one nor global one
|
||||
were defined */
|
||||
static void inthash_fail(const char* exp, const char* file, int line) {
|
||||
fprintf(stderr, "assertion '%s' failed at %s:%d\n", exp, file, line);
|
||||
abort();
|
||||
}
|
||||
|
||||
/* assert failed handler. */
|
||||
static void inthash_assert_failed(const inthash hashtable, const char* exp, const char* file, int line) {
|
||||
const char *name = inthash_get_name(hashtable);
|
||||
inthash_crit(hashtable, "hashtable %s: %s failed at %s:%d",
|
||||
name != NULL ? name : "<unknown>", exp, file, line);
|
||||
if (hashtable != NULL && hashtable->custom.error.fatal != NULL) {
|
||||
hashtable->custom.error.fatal(hashtable->custom.error.arg, exp, file, line);
|
||||
} else if (global_assert_handler != NULL) {
|
||||
global_assert_handler(hashtable, exp, file, line);
|
||||
} else {
|
||||
inthash_fail(exp, file, line);
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
/* Logging */
|
||||
static void inthash_log(const inthash hashtable, const char *format, ...)
|
||||
HTS_PRINTF_FUN(2, 3) {
|
||||
va_list args;
|
||||
inthash_assert(format != NULL);
|
||||
fprintf(stderr, "[%p] ", (void*) hashtable);
|
||||
va_start(args, format);
|
||||
(void) vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
putc('\n', stderr);
|
||||
static void inthash_log(const inthash hashtable, inthash_loglevel level,
|
||||
const char *format, va_list args) {
|
||||
inthash_assert(hashtable, format != NULL);
|
||||
if (hashtable != NULL && hashtable->custom.error.log != NULL) {
|
||||
hashtable->custom.error.log(hashtable->custom.error.arg, level, format, args);
|
||||
} else if (global_log_handler != NULL) {
|
||||
global_log_handler(hashtable, level, format, args);
|
||||
} else {
|
||||
fprintf(stderr, "[%p] ", (void*) hashtable);
|
||||
(void) vfprintf(stderr, format, args);
|
||||
putc('\n', stderr);
|
||||
}
|
||||
}
|
||||
|
||||
/* No logging (should be dropped by the compiler) */
|
||||
static void inthash_nolog(const inthash hashtable, const char *format, ...)
|
||||
HTS_PRINTF_FUN(2, 3) {
|
||||
INTHASH_PRINTF_FUN(2, 3);
|
||||
static void inthash_nolog(const inthash hashtable, const char *format, ...) {
|
||||
}
|
||||
|
||||
const char* inthash_get_name(inthash hashtable) {
|
||||
return hashtable->custom.error.name;
|
||||
}
|
||||
|
||||
static void inthash_log_stats(inthash hashtable) {
|
||||
const char *name = inthash_get_name(hashtable);
|
||||
inthash_info(hashtable, "hashtable %s%s%ssummary: "
|
||||
"size=%"UINT_64_FORMAT" (lg2=%"UINT_64_FORMAT") "
|
||||
"used=%"UINT_64_FORMAT" "
|
||||
"stash-size=%"UINT_64_FORMAT" "
|
||||
"pool-size=%"UINT_64_FORMAT" "
|
||||
"pool-capacity=%"UINT_64_FORMAT" "
|
||||
"pool-used=%"UINT_64_FORMAT" "
|
||||
"writes=%"UINT_64_FORMAT" "
|
||||
"(new=%"UINT_64_FORMAT") "
|
||||
"moved=%"UINT_64_FORMAT " "
|
||||
"stashed=%"UINT_64_FORMAT" "
|
||||
"max-stash-size=%"UINT_64_FORMAT" "
|
||||
"avg-moved=%g "
|
||||
"rehash=%"UINT_64_FORMAT" "
|
||||
"pool-compact=%"UINT_64_FORMAT" "
|
||||
"pool-realloc=%"UINT_64_FORMAT" "
|
||||
"memory=%"UINT_64_FORMAT,
|
||||
name != NULL ? "\"" : "",
|
||||
name != NULL ? name : "",
|
||||
name != NULL ? "\" " : "",
|
||||
(uint64_t) POW2(hashtable->lg_size),
|
||||
(uint64_t) hashtable->lg_size,
|
||||
(uint64_t) hashtable->used,
|
||||
(uint64_t) hashtable->stash.size,
|
||||
(uint64_t) hashtable->pool.size,
|
||||
(uint64_t) hashtable->pool.capacity,
|
||||
(uint64_t) hashtable->pool.used,
|
||||
(uint64_t) hashtable->stats.write_count,
|
||||
(uint64_t) hashtable->stats.add_count,
|
||||
(uint64_t) hashtable->stats.cuckoo_moved,
|
||||
(uint64_t) hashtable->stats.stash_added,
|
||||
(uint64_t) hashtable->stats.max_stash_size,
|
||||
(double) hashtable->stats.cuckoo_moved / (double) hashtable->stats.add_count,
|
||||
(uint64_t) hashtable->stats.rehash_count,
|
||||
(uint64_t) hashtable->stats.pool_compact_count,
|
||||
(uint64_t) hashtable->stats.pool_realloc_count,
|
||||
(uint64_t) inthash_memory_size(hashtable)
|
||||
);
|
||||
}
|
||||
|
||||
inthash_keys inthash_hash_value(const char *value) {
|
||||
@@ -318,39 +433,39 @@ inthash_keys inthash_hash_value(const char *value) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static HTS_INLINE inthash_keys inthash_calc_hashes(inthash hashtable,
|
||||
const char *value) {
|
||||
static INTHASH_INLINE inthash_keys inthash_calc_hashes(inthash hashtable,
|
||||
const char *value) {
|
||||
return hashtable->custom.key.hash == NULL
|
||||
? inthash_hash_value(value)
|
||||
: hashtable->custom.key.hash(hashtable->custom.key.arg, value);
|
||||
}
|
||||
|
||||
/* position 'pos' is free ? */
|
||||
static HTS_INLINE int inthash_is_free(const inthash hashtable, size_t pos) {
|
||||
static INTHASH_INLINE int inthash_is_free(const inthash hashtable, size_t pos) {
|
||||
return hashtable->items[pos].name == NULL;
|
||||
}
|
||||
|
||||
/* compare two keys ; by default using strcmp() */
|
||||
static HTS_INLINE int inthash_equals(inthash hashtable,
|
||||
const char *a, const char *b) {
|
||||
static INTHASH_INLINE int inthash_equals(inthash hashtable,
|
||||
const char *a, const char *b) {
|
||||
return hashtable->custom.key.equals == NULL
|
||||
? strcmp(a, b) == 0
|
||||
: hashtable->custom.key.equals(hashtable->custom.key.arg, a, b);
|
||||
}
|
||||
|
||||
static HTS_INLINE int inthash_matches_(inthash hashtable,
|
||||
const inthash_item *const item,
|
||||
const char *name,
|
||||
const inthash_keys *hashes) {
|
||||
static INTHASH_INLINE int inthash_matches_(inthash hashtable,
|
||||
const inthash_item *const item,
|
||||
const char *name,
|
||||
const inthash_keys *hashes) {
|
||||
return item->name != NULL
|
||||
&& item->hashes.hash1 == hashes->hash1
|
||||
&& item->hashes.hash2 == hashes->hash2
|
||||
&& inthash_equals(hashtable, item->name, name);
|
||||
}
|
||||
|
||||
static HTS_INLINE int inthash_matches(inthash hashtable, size_t pos,
|
||||
const char *name,
|
||||
const inthash_keys *hashes) {
|
||||
static INTHASH_INLINE int inthash_matches(inthash hashtable, size_t pos,
|
||||
const char *name,
|
||||
const inthash_keys *hashes) {
|
||||
const inthash_item *const item = &hashtable->items[pos];
|
||||
return inthash_matches_(hashtable, item, name, hashes);
|
||||
}
|
||||
@@ -364,7 +479,7 @@ static void inthash_compact_pool(inthash hashtable, size_t capacity) {
|
||||
size_t count = 0;
|
||||
|
||||
/* we manage the string pool */
|
||||
assert(hashtable->custom.key.dup == NULL);
|
||||
inthash_assert(hashtable, hashtable->custom.key.dup == NULL);
|
||||
|
||||
/* statistics */
|
||||
hashtable->stats.pool_compact_count++;
|
||||
@@ -383,7 +498,7 @@ static void inthash_compact_pool(inthash hashtable, size_t capacity) {
|
||||
"** hashtable string pool compaction error: could not allocate "
|
||||
"%"UINT_64_FORMAT" bytes",
|
||||
(uint64_t) hashtable->pool.capacity);
|
||||
inthash_assert(! "hashtable string pool compaction error");
|
||||
inthash_assert(hashtable, ! "hashtable string pool compaction error");
|
||||
}
|
||||
|
||||
/* relocate a string on a different pool */
|
||||
@@ -396,17 +511,18 @@ static void inthash_compact_pool(inthash hashtable, size_t capacity) {
|
||||
char *const max_dest = \
|
||||
&hashtable->pool.buffer[capacity]; \
|
||||
/* copy string */ \
|
||||
inthash_assert(dest < max_dest); \
|
||||
inthash_assert(hashtable, dest < max_dest); \
|
||||
dest[0] = src[0]; \
|
||||
{ \
|
||||
size_t i; \
|
||||
for(i = 1 ; src[i - 1] != '\0' ; i++) { \
|
||||
inthash_assert(&dest[i] < max_dest); \
|
||||
inthash_assert(hashtable, &dest[i] < max_dest); \
|
||||
dest[i] = src[i]; \
|
||||
} \
|
||||
/* update pool size */ \
|
||||
hashtable->pool.size += i; \
|
||||
assert(hashtable->pool.size <= capacity); \
|
||||
inthash_assert(hashtable, \
|
||||
hashtable->pool.size <= capacity); \
|
||||
} \
|
||||
/* update source */ \
|
||||
S = dest; \
|
||||
@@ -445,7 +561,7 @@ static void inthash_realloc_pool(inthash hashtable, size_t capacity) {
|
||||
size_t count = 0;
|
||||
|
||||
/* we manage the string pool */
|
||||
assert(hashtable->custom.key.dup == NULL);
|
||||
inthash_assert(hashtable, hashtable->custom.key.dup == NULL);
|
||||
|
||||
/* compact instead ? */
|
||||
if (hashtable->pool.used < ( hashtable->pool.size*3 ) / 4) {
|
||||
@@ -467,17 +583,17 @@ static void inthash_realloc_pool(inthash hashtable, size_t capacity) {
|
||||
"** hashtable string pool allocation error: could not allocate "
|
||||
"%"UINT_64_FORMAT" bytes",
|
||||
(uint64_t) hashtable->pool.capacity);
|
||||
inthash_assert(! "hashtable string pool allocation error");
|
||||
inthash_assert(hashtable, ! "hashtable string pool allocation error");
|
||||
}
|
||||
|
||||
/* recompute string address */
|
||||
#define RECOMPUTE_STRING(S) do { \
|
||||
if (S != NULL && S != the_empty_string) { \
|
||||
const size_t offset = (S) - oldbase; \
|
||||
assert(offset < hashtable->pool.capacity); \
|
||||
S = &hashtable->pool.buffer[offset]; \
|
||||
count++; \
|
||||
} \
|
||||
#define RECOMPUTE_STRING(S) do { \
|
||||
if (S != NULL && S != the_empty_string) { \
|
||||
const size_t offset = (S) - oldbase; \
|
||||
inthash_assert(hashtable, offset < hashtable->pool.capacity); \
|
||||
S = &hashtable->pool.buffer[offset]; \
|
||||
count++; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* recompute */
|
||||
@@ -502,22 +618,22 @@ static char* inthash_dup_name_internal(inthash hashtable, const char *name) {
|
||||
/* the pool does not allow empty strings for safety purpose ; handhe that
|
||||
(keys are being emptied when free'd to detect duplicate free) */
|
||||
if (len == 1) {
|
||||
assert(the_empty_string[0] == '\0');
|
||||
inthash_assert(hashtable, the_empty_string[0] == '\0');
|
||||
return the_empty_string;
|
||||
}
|
||||
|
||||
/* expand pool capacity */
|
||||
assert(hashtable->pool.size <= hashtable->pool.capacity);
|
||||
inthash_assert(hashtable, hashtable->pool.size <= hashtable->pool.capacity);
|
||||
if (hashtable->pool.capacity - hashtable->pool.size < len) {
|
||||
size_t capacity;
|
||||
for(capacity = MIN_POOL_CAPACITY ; capacity < hashtable->pool.size + len
|
||||
; capacity <<= 1) ;
|
||||
assert(hashtable->pool.size < capacity);
|
||||
inthash_assert(hashtable, hashtable->pool.size < capacity);
|
||||
inthash_realloc_pool(hashtable, capacity);
|
||||
}
|
||||
|
||||
/* copy */
|
||||
assert(len + hashtable->pool.size <= hashtable->pool.capacity);
|
||||
inthash_assert(hashtable, len + hashtable->pool.size <= hashtable->pool.capacity);
|
||||
s = &hashtable->pool.buffer[hashtable->pool.size];
|
||||
memcpy(s, name, len);
|
||||
hashtable->pool.size += len;
|
||||
@@ -527,7 +643,7 @@ static char* inthash_dup_name_internal(inthash hashtable, const char *name) {
|
||||
}
|
||||
|
||||
/* duplicate a key. default is to use the internal pool. */
|
||||
static HTS_INLINE char* inthash_dup_name(inthash hashtable, const char *name) {
|
||||
static INTHASH_INLINE char* inthash_dup_name(inthash hashtable, const char *name) {
|
||||
return hashtable->custom.key.dup == NULL
|
||||
? inthash_dup_name_internal(hashtable, name)
|
||||
: hashtable->custom.key.dup(hashtable->custom.key.arg, name);
|
||||
@@ -540,11 +656,11 @@ static void inthash_free_key_internal(inthash hashtable, char *name) {
|
||||
|
||||
/* see inthash_dup_name_internal() handling */
|
||||
if (len == 1 && name == the_empty_string) {
|
||||
assert(the_empty_string[0] == '\0');
|
||||
inthash_assert(hashtable, the_empty_string[0] == '\0');
|
||||
return ;
|
||||
}
|
||||
|
||||
assert(*name != '\0' || !"duplicate or bad string pool release");
|
||||
inthash_assert(hashtable, *name != '\0' || !"duplicate or bad string pool release");
|
||||
hashtable->pool.used -= len;
|
||||
*name = '\0'; /* the string is now invalidated */
|
||||
|
||||
@@ -555,7 +671,7 @@ static void inthash_free_key_internal(inthash hashtable, char *name) {
|
||||
if (hashtable->pool.used < capacity / 4) {
|
||||
capacity /= 2;
|
||||
}
|
||||
assert(hashtable->pool.used < capacity);
|
||||
inthash_assert(hashtable, hashtable->pool.used < capacity);
|
||||
inthash_compact_pool(hashtable, capacity);
|
||||
}
|
||||
}
|
||||
@@ -570,14 +686,14 @@ static void inthash_free_key(inthash hashtable, char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
static HTS_INLINE size_t inthash_hash_to_pos_(size_t lg_size,
|
||||
inthash_key hash) {
|
||||
static INTHASH_INLINE size_t inthash_hash_to_pos_(size_t lg_size,
|
||||
inthash_key hash) {
|
||||
const inthash_key mask = POW2(lg_size) - 1;
|
||||
return hash & mask;
|
||||
}
|
||||
|
||||
static HTS_INLINE size_t inthash_hash_to_pos(const inthash hashtable,
|
||||
inthash_key hash) {
|
||||
static INTHASH_INLINE size_t inthash_hash_to_pos(const inthash hashtable,
|
||||
inthash_key hash) {
|
||||
return inthash_hash_to_pos_(hashtable->lg_size, hash);
|
||||
}
|
||||
|
||||
@@ -758,7 +874,7 @@ static int inthash_add_item_(inthash hashtable, inthash_item item) {
|
||||
cuckoo_hash = item.hashes.hash1;
|
||||
}
|
||||
else {
|
||||
inthash_assert(! "hashtable internal error: unexpected position");
|
||||
inthash_assert(hashtable, ! "hashtable internal error: unexpected position");
|
||||
}
|
||||
|
||||
/* we are looping (back to same hash) */
|
||||
@@ -783,9 +899,62 @@ static int inthash_add_item_(inthash hashtable, inthash_item item) {
|
||||
(int) hashtable->stash.size);
|
||||
return 1; /* added */
|
||||
} else {
|
||||
/* debugging */
|
||||
if (hashtable->custom.print.key != NULL
|
||||
&& hashtable->custom.print.value != NULL) {
|
||||
size_t i;
|
||||
for(i = 0 ; i < hashtable->stash.size ; i++) {
|
||||
inthash_item *const item = &hashtable->stash.items[i];
|
||||
const size_t pos1 = inthash_hash_to_pos(hashtable, item->hashes.hash1);
|
||||
const size_t pos2 = inthash_hash_to_pos(hashtable, item->hashes.hash2);
|
||||
inthash_crit(hashtable,
|
||||
"stash[%u]: key='%s' value='%s' pos1=%d pos2=%d hash1=%04x hash2=%04x",
|
||||
(int) i,
|
||||
hashtable->custom.print.key(hashtable->custom.print.arg, item->name),
|
||||
hashtable->custom.print.value(hashtable->custom.print.arg, item->value.ptr),
|
||||
(int) pos1, (int) pos2,
|
||||
item->hashes.hash1, item->hashes.hash2);
|
||||
if (!inthash_is_free(hashtable, pos1)) {
|
||||
inthash_item *const item = &hashtable->items[pos1];
|
||||
const size_t pos1 = inthash_hash_to_pos(hashtable, item->hashes.hash1);
|
||||
const size_t pos2 = inthash_hash_to_pos(hashtable, item->hashes.hash2);
|
||||
inthash_crit(hashtable,
|
||||
"\t.. collisionning with key='%s' value='%s' pos1=%d pos2=%d hash1=%04x hash2=%04x",
|
||||
hashtable->custom.print.key(hashtable->custom.print.arg, item->name),
|
||||
hashtable->custom.print.value(hashtable->custom.print.arg, item->value.ptr),
|
||||
(int) pos1, (int) pos2,
|
||||
item->hashes.hash1, item->hashes.hash2);
|
||||
} else {
|
||||
inthash_crit(hashtable, "\t.. collisionning with a free slot (%d)!", (int) pos1);
|
||||
}
|
||||
if (!inthash_is_free(hashtable, pos2)) {
|
||||
inthash_item *const item = &hashtable->items[pos2];
|
||||
const size_t pos1 = inthash_hash_to_pos(hashtable, item->hashes.hash1);
|
||||
const size_t pos2 = inthash_hash_to_pos(hashtable, item->hashes.hash2);
|
||||
inthash_crit(hashtable,
|
||||
"\t.. collisionning with key='%s' value='%s' pos1=%d pos2=%d hash1=%04x hash2=%04x",
|
||||
hashtable->custom.print.key(hashtable->custom.print.arg, item->name),
|
||||
hashtable->custom.print.value(hashtable->custom.print.arg, item->value.ptr),
|
||||
(int) pos1, (int) pos2,
|
||||
item->hashes.hash1, item->hashes.hash2);
|
||||
} else {
|
||||
inthash_crit(hashtable, "\t.. collisionning with a free slot (%d)!", (int) pos2);
|
||||
}
|
||||
}
|
||||
//struct_inthash_enum e = inthash_enum_new(hashtable);
|
||||
//while((item = inthash_enum_next(&e)) != NULL) {
|
||||
// inthash_crit(hashtable, "element key='%s' value='%s' hash1=%04x hash2=%04x",
|
||||
// hashtable->custom.print.key(hashtable->custom.print.arg, item->name),
|
||||
// hashtable->custom.print.value(hashtable->custom.print.arg, item->value.ptr),
|
||||
// item->hashes.hash1, item->hashes.hash2);
|
||||
//}
|
||||
}
|
||||
|
||||
/* we are doomed. hopefully the probability is lower than being killed
|
||||
by a wandering radioactive monkey */
|
||||
inthash_assert(! "hashtable internal error: cuckoo/stash collision");
|
||||
inthash_log_stats(hashtable);
|
||||
inthash_assert(hashtable, ! "hashtable internal error: cuckoo/stash collision");
|
||||
|
||||
/* not reachable code */
|
||||
return -1;
|
||||
}
|
||||
@@ -801,11 +970,15 @@ int inthash_write_value(inthash hashtable, const char *name,
|
||||
/* size of half of the table */
|
||||
const size_t half_size = POW2(hashtable->lg_size - 1);
|
||||
|
||||
/* size of half of the stash */
|
||||
const size_t half_stash_size = STASH_SIZE / 2;
|
||||
|
||||
/* item was added: increase count */
|
||||
hashtable->used++;
|
||||
|
||||
/* table is more than half-full */
|
||||
if (hashtable->used >= half_size) {
|
||||
/* table is more than half-full, or stash is more than half-full */
|
||||
if (hashtable->used >= half_size
|
||||
|| hashtable->stash.size >= half_stash_size) {
|
||||
size_t i;
|
||||
|
||||
/* size before */
|
||||
@@ -816,6 +989,16 @@ int inthash_write_value(inthash hashtable, const char *name,
|
||||
/* size after doubling it */
|
||||
const size_t alloc_size = prev_alloc_size * 2;
|
||||
|
||||
/* log stash issues */
|
||||
if (hashtable->stash.size >= half_stash_size
|
||||
&& half_size > POW2(16)
|
||||
&& hashtable->used < half_size / 4) {
|
||||
inthash_warning(hashtable,
|
||||
"stash size still full despite %"UINT_64_FORMAT
|
||||
" elements used out of %"UINT_64_FORMAT,
|
||||
(uint64_t) hashtable->used, (uint64_t) half_size*2);
|
||||
}
|
||||
|
||||
/* statistics */
|
||||
hashtable->stats.rehash_count++;
|
||||
|
||||
@@ -828,7 +1011,7 @@ int inthash_write_value(inthash hashtable, const char *name,
|
||||
"** hashtable allocation error: "
|
||||
"could not allocate %"UINT_64_FORMAT" bytes",
|
||||
(uint64_t) alloc_size);
|
||||
inthash_assert(! "hashtable allocation error");
|
||||
inthash_assert(hashtable, ! "hashtable allocation error");
|
||||
}
|
||||
|
||||
/* clear upper half */
|
||||
@@ -844,7 +1027,7 @@ int inthash_write_value(inthash hashtable, const char *name,
|
||||
const size_t pos = inthash_hash_to_pos(hashtable, hashes->hash1);
|
||||
/* no more the expected position */
|
||||
if (pos != i) {
|
||||
inthash_assert(pos >= prev_size);
|
||||
inthash_assert(hashtable, pos >= prev_size);
|
||||
hashtable->items[pos] = hashtable->items[i];
|
||||
memset(&hashtable->items[i], 0, sizeof(hashtable->items[i]));
|
||||
}
|
||||
@@ -853,13 +1036,13 @@ int inthash_write_value(inthash hashtable, const char *name,
|
||||
const size_t pos = inthash_hash_to_pos(hashtable, hashes->hash2);
|
||||
/* no more the expected position */
|
||||
if (pos != i) {
|
||||
inthash_assert(pos >= prev_size);
|
||||
inthash_assert(hashtable, pos >= prev_size);
|
||||
hashtable->items[pos] = hashtable->items[i];
|
||||
memset(&hashtable->items[i], 0, sizeof(hashtable->items[i]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
inthash_assert(! "hashtable unexpected internal error (bad position)");
|
||||
inthash_assert(hashtable, ! "hashtable unexpected internal error (bad position)");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -882,12 +1065,12 @@ int inthash_write_value(inthash hashtable, const char *name,
|
||||
for(i = 0 ; i < old_size ; i++) {
|
||||
const int ret = inthash_add_item_(hashtable, stash[i]);
|
||||
if (ret == 0) {
|
||||
inthash_assert(! "hashtable duplicate key when merging the stash");
|
||||
inthash_assert(hashtable, ! "hashtable duplicate key when merging the stash");
|
||||
}
|
||||
}
|
||||
|
||||
/* logging */
|
||||
inthash_assert(hashtable->stash.size <= old_size);
|
||||
inthash_assert(hashtable, hashtable->stash.size <= old_size);
|
||||
if (hashtable->stash.size < old_size) {
|
||||
inthash_debug(hashtable, "reduced stash size from %"UINT_64_FORMAT" "
|
||||
"to %"UINT_64_FORMAT,
|
||||
@@ -974,7 +1157,7 @@ static size_t inthash_inc_(inthash hashtable, const char *name,
|
||||
} else {
|
||||
/* create a new value */
|
||||
const int ret = inthash_write(hashtable, name, inc);
|
||||
inthash_assert(ret);
|
||||
inthash_assert(hashtable, ret);
|
||||
return inc;
|
||||
}
|
||||
}
|
||||
@@ -1041,7 +1224,7 @@ int inthash_remove(inthash hashtable, const char *name) {
|
||||
|
||||
if (ret) {
|
||||
/* item was removed: decrease count */
|
||||
inthash_assert(hashtable->used != 0);
|
||||
inthash_assert(hashtable, hashtable->used != 0);
|
||||
hashtable->used--;
|
||||
|
||||
/* can we place stash entry back to the table ? */
|
||||
@@ -1114,6 +1297,13 @@ inthash inthash_new(size_t initial_size) {
|
||||
hashtable->custom.key.hash = NULL;
|
||||
hashtable->custom.key.equals = NULL;
|
||||
hashtable->custom.key.arg = NULL;
|
||||
hashtable->custom.error.log = NULL;
|
||||
hashtable->custom.error.fatal = NULL;
|
||||
hashtable->custom.error.name = NULL;
|
||||
hashtable->custom.error.arg = NULL;
|
||||
hashtable->custom.print.key = NULL;
|
||||
hashtable->custom.print.value = NULL;
|
||||
hashtable->custom.print.arg = NULL;
|
||||
}
|
||||
return hashtable;
|
||||
}
|
||||
@@ -1134,6 +1324,10 @@ void inthash_value_is_malloc(inthash hashtable, int flag) {
|
||||
}
|
||||
}
|
||||
|
||||
void inthash_set_name(inthash hashtable, const char *name) {
|
||||
hashtable->custom.error.name = name;
|
||||
}
|
||||
|
||||
void inthash_value_set_value_handler(inthash hashtable,
|
||||
t_inthash_freehandler free,
|
||||
void *arg) {
|
||||
@@ -1148,7 +1342,7 @@ void inthash_value_set_key_handler(inthash hashtable,
|
||||
t_inthash_cmphandler equals,
|
||||
void *arg) {
|
||||
/* dup and free must be consistent */
|
||||
assert( ( dup == NULL ) == ( free == NULL ) );
|
||||
inthash_assert(hashtable, ( dup == NULL ) == ( free == NULL ) );
|
||||
hashtable->custom.key.dup = dup;
|
||||
hashtable->custom.key.free = free;
|
||||
hashtable->custom.key.hash = hash;
|
||||
@@ -1156,6 +1350,24 @@ void inthash_value_set_key_handler(inthash hashtable,
|
||||
hashtable->custom.key.arg = arg;
|
||||
}
|
||||
|
||||
void inthash_set_assert_handler(inthash hashtable,
|
||||
t_inthash_loghandler log,
|
||||
t_inthash_asserthandler fatal,
|
||||
void *arg) {
|
||||
hashtable->custom.error.log = log;
|
||||
hashtable->custom.error.fatal = fatal;
|
||||
hashtable->custom.error.arg = arg;
|
||||
}
|
||||
|
||||
void inthash_set_print_handler(inthash hashtable,
|
||||
t_inthash_printkeyhandler key,
|
||||
t_inthash_printvaluehandler value,
|
||||
void *arg) {
|
||||
hashtable->custom.print.key = key;
|
||||
hashtable->custom.print.value = value;
|
||||
hashtable->custom.print.arg = arg;
|
||||
}
|
||||
|
||||
size_t inthash_nitems(inthash hashtable) {
|
||||
if (hashtable != NULL)
|
||||
return hashtable->used;
|
||||
@@ -1169,31 +1381,6 @@ size_t inthash_memory_size(inthash hashtable) {
|
||||
return size_struct + hash_size + pool_size;
|
||||
}
|
||||
|
||||
static void inthash_log_stats(inthash hashtable) {
|
||||
inthash_info(hashtable, "freeing table ; "
|
||||
"writes=%"UINT_64_FORMAT" "
|
||||
"(new=%"UINT_64_FORMAT") "
|
||||
"moved=%"UINT_64_FORMAT " "
|
||||
"stashed=%"UINT_64_FORMAT" "
|
||||
"max-stash-size=%"UINT_64_FORMAT" "
|
||||
"avg-moved=%g "
|
||||
"rehash=%"UINT_64_FORMAT" "
|
||||
"pool-compact=%"UINT_64_FORMAT" "
|
||||
"pool-realloc=%"UINT_64_FORMAT" "
|
||||
"memory=%"UINT_64_FORMAT,
|
||||
(uint64_t) hashtable->stats.write_count,
|
||||
(uint64_t) hashtable->stats.add_count,
|
||||
(uint64_t) hashtable->stats.cuckoo_moved,
|
||||
(uint64_t) hashtable->stats.stash_added,
|
||||
(uint64_t) hashtable->stats.max_stash_size,
|
||||
(double) hashtable->stats.cuckoo_moved / (double) hashtable->stats.add_count,
|
||||
(uint64_t) hashtable->stats.rehash_count,
|
||||
(uint64_t) hashtable->stats.pool_compact_count,
|
||||
(uint64_t) hashtable->stats.pool_realloc_count,
|
||||
(uint64_t) inthash_memory_size(hashtable)
|
||||
);
|
||||
}
|
||||
|
||||
void inthash_delete(inthash *phashtable) {
|
||||
if (phashtable != NULL) {
|
||||
inthash hashtable = *phashtable;
|
||||
@@ -1261,3 +1448,9 @@ inthash_item *inthash_enum_next(struct_inthash_enum * e) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void inthash_set_global_assert_handler(t_inthash_loghandler log,
|
||||
t_inthash_asserthandler fatal) {
|
||||
global_log_handler = log;
|
||||
global_assert_handler = fatal;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -26,8 +26,7 @@ Please visit our Website: http://www.httrack.com
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* File: httrack.c subroutines: */
|
||||
/* hash table system (fast index) */
|
||||
/* File: hash table system (fast index) */
|
||||
/* Author: Xavier Roche */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
@@ -68,6 +67,7 @@ typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
|
||||
/** Value. **/
|
||||
typedef union inthash_value {
|
||||
@@ -113,18 +113,40 @@ struct inthash_item {
|
||||
inthash_keys hashes;
|
||||
};
|
||||
|
||||
/** Log level. **/
|
||||
typedef enum inthash_loglevel {
|
||||
inthash_log_critical,
|
||||
inthash_log_warning,
|
||||
inthash_log_info,
|
||||
inthash_log_debug,
|
||||
inthash_log_trace
|
||||
} inthash_loglevel;
|
||||
|
||||
/** Alias for legacy code. **/
|
||||
typedef inthash_item inthash_chain;
|
||||
|
||||
/** Value free handler **/
|
||||
typedef void (*t_inthash_freehandler) (void *arg, void *value);
|
||||
typedef void (*t_inthash_freehandler)(void *arg, void *value);
|
||||
|
||||
/** Name dup handler. **/
|
||||
typedef char* (*t_inthash_duphandler) (void *arg, const char *name);
|
||||
typedef char* (*t_inthash_duphandler)(void *arg, const char *name);
|
||||
|
||||
/** Hash computation handler. **/
|
||||
typedef inthash_keys (*t_inthash_hasheshandler)(void *arg, const char *value);
|
||||
|
||||
/** Hashtable logging handler. **/
|
||||
typedef void (*t_inthash_loghandler)(void *arg, inthash_loglevel level,
|
||||
const char* format, va_list args);
|
||||
|
||||
/** Hashtable fatal assertion failure. **/
|
||||
typedef void (*t_inthash_asserthandler)(void *arg, const char* exp, const char* file, int line);
|
||||
|
||||
/** Key printer (debug) **/
|
||||
typedef const char* (*t_inthash_printkeyhandler)(void *arg, const char *name);
|
||||
|
||||
/** Value printer (debug) **/
|
||||
typedef const char* (*t_inthash_printvaluehandler)(void *arg, void *value);
|
||||
|
||||
/**
|
||||
* Value comparison handler (returns non-zero value if strings are equal).
|
||||
**/
|
||||
@@ -215,6 +237,40 @@ void inthash_value_set_key_handler(inthash hashtable,
|
||||
t_inthash_cmphandler equals,
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Set assertion failure handler.
|
||||
* log: handler called upon serious programming error
|
||||
* fatal: handler called upon serious programming error
|
||||
**/
|
||||
void inthash_set_assert_handler(inthash hashtable,
|
||||
t_inthash_loghandler log,
|
||||
t_inthash_asserthandler fatal,
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Set pretty print loggers (debug). Both handlers must return a string
|
||||
* pointer which shall be valid until the next call. Both key and value
|
||||
* pointers shall be valid at the same time.
|
||||
* name: handler called to print the string representation of the name
|
||||
* value: handler called to print the string representation of the value
|
||||
**/
|
||||
void inthash_set_print_handler(inthash hashtable,
|
||||
t_inthash_printkeyhandler key,
|
||||
t_inthash_printvaluehandler value,
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Set the hashtable name, for degugging purpose.
|
||||
* name: the hashtable name (ASCII or UTF-8)
|
||||
*/
|
||||
void inthash_set_name(inthash hashtable, const char *name);
|
||||
|
||||
/**
|
||||
* Get the hashtable name, for degugging purpose.
|
||||
* Return NULL if no name was defined.
|
||||
**/
|
||||
const char* inthash_get_name(inthash hashtable);
|
||||
|
||||
/**
|
||||
* Read an integer entry from the hashtable.
|
||||
* Return non-zero value upon success and sets intvalue.
|
||||
@@ -309,6 +365,18 @@ inthash_item *inthash_enum_next(struct_inthash_enum * e);
|
||||
**/
|
||||
inthash_keys inthash_hash_value(const char *value);
|
||||
|
||||
/**
|
||||
* Set default global assertion failure handler.
|
||||
* The handler will be used if no specific handler was defined in the
|
||||
* hashtable itself.
|
||||
* log: handler called upon serious error log (opaque argument
|
||||
* is the hashtable itself)
|
||||
* fatal: handler called upon serious programming error (opaque argument
|
||||
* is the hashtable itself)
|
||||
**/
|
||||
void inthash_set_global_assert_handler(t_inthash_loghandler log,
|
||||
t_inthash_asserthandler fatal);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -172,7 +172,7 @@ static int hts_parse_java(t_hts_callbackarg * carg, httrackp * opt,
|
||||
#if JAVADEBUG
|
||||
printf("fopen\n");
|
||||
#endif
|
||||
if ((fpout = FOPEN(fconv(catbuff, file), "r+b")) == NULL) {
|
||||
if ((fpout = FOPEN(fconv(catbuff, sizeof(catbuff), file), "r+b")) == NULL) {
|
||||
//fprintf(stderr, "Cannot open input file.\n");
|
||||
sprintf(str->err_msg, "Unable to open file %s", file);
|
||||
return 0; // une erreur..
|
||||
@@ -477,7 +477,7 @@ static int tris(httrackp * opt, char *buffer) {
|
||||
if (strnotempty(type)) // type reconnu!
|
||||
return 1;
|
||||
// ajout RX 05/2001
|
||||
else if (is_dyntype(get_ext(catbuff, buffer))) // asp,cgi...
|
||||
else if (is_dyntype(get_ext(catbuff, sizeof(catbuff), buffer))) // asp,cgi...
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
999
src/htslib.c
999
src/htslib.c
File diff suppressed because it is too large
Load Diff
196
src/htslib.h
196
src/htslib.h
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -35,6 +35,8 @@ Please visit our Website: http://www.httrack.com
|
||||
#ifndef HTS_DEFH
|
||||
#define HTS_DEFH
|
||||
|
||||
#include "httrack-library.h"
|
||||
|
||||
/* Forward definitions */
|
||||
#ifndef HTS_DEF_FWSTRUCT_htsrequest
|
||||
#define HTS_DEF_FWSTRUCT_htsrequest
|
||||
@@ -92,7 +94,8 @@ MSVC2003INLINEBUG HTS_STATIC char *getHtsOptBuff_(httrackp * opt) {
|
||||
}
|
||||
|
||||
#undef MSVC2003INLINEBUG
|
||||
#define OPT_GET_BUFF(OPT) ( getHtsOptBuff_(OPT) )
|
||||
#define OPT_GET_BUFF(OPT) ( getHtsOptBuff_(OPT) )
|
||||
#define OPT_GET_BUFF_SIZE(OPT) ( sizeof(opt->state.concat.buff[0]) )
|
||||
|
||||
// structure pour paramètres supplémentaires lors de la requête
|
||||
#ifndef HTS_DEF_FWSTRUCT_htsrequest_proxy
|
||||
@@ -155,7 +158,7 @@ struct htsblk {
|
||||
short int is_file; // ce n'est pas une socket mais un descripteur de fichier si 1
|
||||
T_SOC soc; // ID socket
|
||||
SOCaddr address; // IP address
|
||||
int address_size; // IP address structure length
|
||||
int address_size; // IP address structure length (unused internally)
|
||||
FILE *fp; // fichier pour file://
|
||||
#if HTS_USEOPENSSL
|
||||
short int ssl; // is this connection a SSL one? (https)
|
||||
@@ -231,6 +234,9 @@ struct t_dnscache {
|
||||
// initialize an htsblk structure
|
||||
void hts_init_htsblk(htsblk * r);
|
||||
|
||||
// attach specific project log to hachtable logger
|
||||
void hts_set_hash_handler(inthash hashtable, httrackp *opt);
|
||||
|
||||
// version
|
||||
HTSEXT_API const char* hts_version(void);
|
||||
|
||||
@@ -240,24 +246,7 @@ int hts_read(htsblk * r, char *buff, int size);
|
||||
//int HTS_TOTAL_RECV_CHECK(int var);
|
||||
LLint check_downloadable_bytes(int rate);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int hts_init(void);
|
||||
HTSEXT_API int hts_uninit(void);
|
||||
HTSEXT_API int hts_uninit_module(void);
|
||||
HTSEXT_API int hts_resetvar(void); /* dummy */
|
||||
HTSEXT_API void hts_debug(int level);
|
||||
HTSEXT_API httrackp *hts_create_opt(void);
|
||||
HTSEXT_API void hts_free_opt(httrackp * opt);
|
||||
HTSEXT_API const hts_stat_struct* hts_get_stats(httrackp * opt);
|
||||
HTSEXT_API void set_wrappers(httrackp * opt); /* LEGACY */
|
||||
HTSEXT_API int plug_wrapper(httrackp * opt, const char *moduleName,
|
||||
const char *argv);
|
||||
|
||||
HTSEXT_API char *hts_strdup(const char *string);
|
||||
HTSEXT_API void *hts_malloc(size_t size);
|
||||
HTSEXT_API void *hts_realloc(void *data, size_t size);
|
||||
HTSEXT_API void hts_free(void *data);
|
||||
#endif
|
||||
|
||||
// fonctions principales
|
||||
T_SOC http_fopen(httrackp * opt, char *adr, char *fil, htsblk * retour);
|
||||
@@ -282,39 +271,32 @@ void treathead(t_cookie * cookie, char *adr, char *fil, htsblk * retour,
|
||||
char *rcvd);
|
||||
void treatfirstline(htsblk * retour, char *rcvd);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API void infostatuscode(char *msg, int statuscode);
|
||||
#endif
|
||||
|
||||
// sous-fonctions
|
||||
LLint http_xfread1(htsblk * r, int bufl);
|
||||
HTS_INLINE t_hostent *hts_gethostbyname2(httrackp * opt, const char *iadr,
|
||||
void *v_buffer, const char **error);
|
||||
HTS_INLINE t_hostent *hts_gethostbyname(httrackp * opt, const char *iadr,
|
||||
void *v_buffer);
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API t_hostent *vxgethostbyname2(char *hostname, void *v_buffer, const char **error);
|
||||
HTSEXT_API t_hostent *vxgethostbyname(char *hostname, void *v_buffer);
|
||||
HTSEXT_API int check_hostname_dns(char *hostname);
|
||||
#endif
|
||||
HTS_INLINE SOCaddr* hts_dns_resolve2(httrackp * opt, const char *iadr,
|
||||
SOCaddr *const addr,
|
||||
const char **error);
|
||||
HTS_INLINE SOCaddr* hts_dns_resolve(httrackp * opt, const char *iadr,
|
||||
SOCaddr *const addr);
|
||||
HTSEXT_API SOCaddr* hts_dns_resolve_nocache2(const char *const hostname,
|
||||
SOCaddr *const addr,
|
||||
const char **error);
|
||||
HTSEXT_API SOCaddr* hts_dns_resolve_nocache(const char *const hostname,
|
||||
SOCaddr *const addr);
|
||||
HTSEXT_API int check_hostname_dns(const char *const hostname);
|
||||
|
||||
int ftp_available(void);
|
||||
|
||||
#if HTS_DNSCACHE
|
||||
void hts_cache_free(t_dnscache * cache);
|
||||
void hts_cache_free(t_dnscache *const cache);
|
||||
t_dnscache *_hts_cache(httrackp * opt);
|
||||
#endif
|
||||
|
||||
// outils divers
|
||||
HTS_INLINE TStamp time_local(void);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API HTS_INLINE TStamp mtime_local(void);
|
||||
#endif
|
||||
void sec2str(char *s, TStamp t);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API void qsec2str(char *st, TStamp t);
|
||||
#endif
|
||||
void time_gmt_rfc822(char *s);
|
||||
void time_local_rfc822(char *s);
|
||||
struct tm *convert_time_rfc822(struct tm *buffer, const char *s);
|
||||
@@ -324,14 +306,8 @@ int get_filetime_rfc822(const char *file, char *date);
|
||||
HTS_INLINE void time_rfc822(char *s, struct tm *A);
|
||||
HTS_INLINE void time_rfc822_local(char *s, struct tm *A);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API char *int2char(strc_int2bytes2 * strc, int n);
|
||||
HTSEXT_API char *int2bytes(strc_int2bytes2 * strc, LLint n);
|
||||
HTSEXT_API char *int2bytessec(strc_int2bytes2 * strc, long int n);
|
||||
HTSEXT_API char **int2bytes2(strc_int2bytes2 * strc, LLint n);
|
||||
#endif
|
||||
HTS_INLINE int sendc(htsblk * r, const char *s);
|
||||
int finput(int fd, char *s, int max);
|
||||
int finput(T_SOC fd, char *s, int max);
|
||||
int binput(char *buff, char *s, int max);
|
||||
int linput(FILE * fp, char *s, int max);
|
||||
int linputsoc(T_SOC soc, char *s, int max);
|
||||
@@ -342,7 +318,7 @@ void rawlinput(FILE * fp, char *s, int max);
|
||||
char *strstrcase(char *s, char *o);
|
||||
int ident_url_absolute(const char *url, char *adr, char *fil);
|
||||
void fil_simplifie(char *f);
|
||||
int is_unicode_utf8(const char *buffer, size_t size);
|
||||
int is_unicode_utf8(const char *buffer, const size_t size);
|
||||
void map_characters(unsigned char *buffer, unsigned int size,
|
||||
unsigned int *map);
|
||||
int ishtml(httrackp * opt, const char *urlfil);
|
||||
@@ -350,125 +326,72 @@ int ishtml_ext(const char *a);
|
||||
int ishttperror(int err);
|
||||
void guess_httptype(httrackp * opt, char *s, const char *fil);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API void get_httptype(httrackp * opt, char *s, const char *fil,
|
||||
int flag);
|
||||
#endif
|
||||
int get_userhttptype(httrackp * opt, char *s, const char *fil);
|
||||
void give_mimext(char *s, const char *st);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int is_knowntype(httrackp * opt, const char *fil);
|
||||
HTSEXT_API int is_userknowntype(httrackp * opt, const char *fil);
|
||||
HTSEXT_API int is_dyntype(const char *fil);
|
||||
HTSEXT_API char *get_ext(char *catbuff, const char *fil);
|
||||
#endif
|
||||
int may_unknown(httrackp * opt, const char *st);
|
||||
int may_bogus_multiple(httrackp * opt, const char *mime, const char *filename);
|
||||
int may_unknown2(httrackp * opt, const char *mime, const char *filename);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API char *jump_identification(const char *);
|
||||
HTSEXT_API char *jump_normalized(const char *);
|
||||
HTSEXT_API char *jump_toport(const char *);
|
||||
HTSEXT_API char *fil_normalized(const char *source, char *dest);
|
||||
HTSEXT_API char *adr_normalized(const char *source, char *dest);
|
||||
#endif
|
||||
char *strrchr_limit(const char *s, char c, const char *limit);
|
||||
char *strstr_limit(const char *s, const char *sub, const char *limit);
|
||||
HTS_INLINE char *jump_protocol(const char *source);
|
||||
void code64(unsigned char *a, int size_a, unsigned char *b, int crlf);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API void unescape_amp(char *s);
|
||||
HTSEXT_API void escape_spc_url(char *s);
|
||||
HTSEXT_API void escape_in_url(char *s);
|
||||
HTSEXT_API void escape_uri(char *s);
|
||||
HTSEXT_API void escape_uri_utf(char *s);
|
||||
HTSEXT_API void escape_check_url(char *s);
|
||||
HTSEXT_API char *escape_check_url_addr(char *catbuff, const char *s);
|
||||
HTSEXT_API void x_escape_http(char *s, int mode);
|
||||
HTSEXT_API void x_escape_html(char *s);
|
||||
HTSEXT_API void escape_remove_control(char *s);
|
||||
HTSEXT_API void escape_for_html_print(char *s, char *d);
|
||||
HTSEXT_API void escape_for_html_print_full(char *s, char *d);
|
||||
#endif
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API char *unescape_http(char *catbuff, const char *s);
|
||||
HTSEXT_API char *unescape_http_unharm(char *catbuff, const char *s,
|
||||
int no_high);
|
||||
HTSEXT_API char *antislash_unescaped(char *catbuff, const char *s);
|
||||
HTSEXT_API char *concat(char *catbuff, const char *a, const char *b);
|
||||
HTSEXT_API char *fconcat(char *catbuff, const char *a, const char *b);
|
||||
HTSEXT_API char *fconv(char *catbuff, const char *a);
|
||||
#endif
|
||||
#define copychar(catbuff,a) concat(catbuff,(a),NULL)
|
||||
char *fslash(char *catbuff, const char *a);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API int hts_log(httrackp * opt, const char *prefix, const char *msg);
|
||||
HTSEXT_API void hts_log_print(httrackp * opt, int type, const char *format,
|
||||
...) HTS_PRINTF_FUN(3, 4);
|
||||
#endif
|
||||
char *convtolower(char *catbuff, const char *a);
|
||||
void hts_lowcase(char *s);
|
||||
void hts_replace(char *s, char from, char to);
|
||||
int multipleStringMatch(const char *s, const char *match);
|
||||
|
||||
char *convtolower(char *catbuff, const char *a);
|
||||
void hts_lowcase(char *s);
|
||||
void hts_replace(char *s, char from, char to);
|
||||
int multipleStringMatch(const char *s, const char *match);
|
||||
|
||||
void fprintfio(FILE * fp, char *buff, char *prefix);
|
||||
void fprintfio(FILE * fp, char *buff, char *prefix);
|
||||
|
||||
#ifdef _WIN32
|
||||
#else
|
||||
int sig_ignore_flag(int setflag); // flag ignore
|
||||
int sig_ignore_flag(int setflag); // flag ignore
|
||||
#endif
|
||||
|
||||
void cut_path(char *fullpath, char *path, char *pname);
|
||||
int fexist(const char *s);
|
||||
int fexist_utf8(const char *s);
|
||||
void cut_path(char *fullpath, char *path, char *pname);
|
||||
int fexist(const char *s);
|
||||
int fexist_utf8(const char *s);
|
||||
|
||||
/*LLint fsize(const char* s); */
|
||||
off_t fpsize(FILE * fp);
|
||||
off_t fsize(const char *s);
|
||||
off_t fsize_utf8(const char *s);
|
||||
|
||||
/* root dir */
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API char *hts_rootdir(char *file);
|
||||
#endif
|
||||
off_t fpsize(FILE * fp);
|
||||
off_t fsize(const char *s);
|
||||
off_t fsize_utf8(const char *s);
|
||||
|
||||
// Threads
|
||||
typedef void *(*beginthread_type) (void *);
|
||||
typedef void *(*beginthread_type) (void *);
|
||||
|
||||
/*unsigned long _beginthread( beginthread_type start_address, unsigned stack_size, void *arglist );*/
|
||||
|
||||
/* variables globales */
|
||||
extern HTSEXT_API hts_stat_struct HTS_STAT;
|
||||
extern int _DEBUG_HEAD;
|
||||
extern FILE *ioinfo;
|
||||
extern HTSEXT_API hts_stat_struct HTS_STAT;
|
||||
extern int _DEBUG_HEAD;
|
||||
extern FILE *ioinfo;
|
||||
|
||||
/* constantes */
|
||||
extern const char *hts_mime_keep[];
|
||||
extern const char *hts_mime[][2];
|
||||
extern const char *hts_main_mime[];
|
||||
extern const char *hts_detect[];
|
||||
extern const char *hts_detectbeg[];
|
||||
extern const char *hts_nodetect[];
|
||||
extern const char *hts_detectURL[];
|
||||
extern const char *hts_detectandleave[];
|
||||
extern const char *hts_detect_js[];
|
||||
extern const char *hts_mime_keep[];
|
||||
extern const char *hts_mime[][2];
|
||||
extern const char *hts_main_mime[];
|
||||
extern const char *hts_detect[];
|
||||
extern const char *hts_detectbeg[];
|
||||
extern const char *hts_nodetect[];
|
||||
extern const char *hts_detectURL[];
|
||||
extern const char *hts_detectandleave[];
|
||||
extern const char *hts_detect_js[];
|
||||
|
||||
// htsmodule.c definitions
|
||||
extern void *openFunctionLib(const char *file_);
|
||||
extern void *getFunctionPtr(void *handle, const char *fncname);
|
||||
extern void closeFunctionLib(void *handle);
|
||||
extern void *openFunctionLib(const char *file_);
|
||||
extern void *getFunctionPtr(void *handle, const char *fncname);
|
||||
extern void closeFunctionLib(void *handle);
|
||||
|
||||
extern void clearCallbacks(htscallbacks * chain);
|
||||
extern size_t hts_get_callback_offs(const char *name);
|
||||
int hts_set_callback(t_hts_htmlcheck_callbacks * callbacks,
|
||||
const char *name, void *function);
|
||||
void *hts_get_callback(t_hts_htmlcheck_callbacks * callbacks,
|
||||
const char *name);
|
||||
extern void clearCallbacks(htscallbacks * chain);
|
||||
int hts_set_callback(t_hts_htmlcheck_callbacks * callbacks,
|
||||
const char *name, void *function);
|
||||
void *hts_get_callback(t_hts_htmlcheck_callbacks * callbacks,
|
||||
const char *name);
|
||||
|
||||
#define CBSTRUCT(OPT) ((t_hts_htmlcheck_callbacks*) ((OPT)->callbacks_fun))
|
||||
#define GET_USERCALLBACK(OPT, NAME) ( CBSTRUCT(OPT)-> NAME .fun )
|
||||
@@ -581,7 +504,7 @@ HTSEXT_API void hts_log_print(httrackp * opt, int type, const char *format,
|
||||
|
||||
// compare le début de f avec s et retourne la position de la fin
|
||||
// 'A=a' (case insensitive)
|
||||
HTS_STATIC int strfield(const char *f, const char *s) {
|
||||
HTS_STATIC int strfield(const char *f, const char *s) {
|
||||
int r = 0;
|
||||
|
||||
while(streql(*f, *s) && ((*f) != 0) && ((*s) != 0)) {
|
||||
@@ -593,7 +516,8 @@ HTSEXT_API void hts_log_print(httrackp * opt, int type, const char *format,
|
||||
return r;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
HTS_STATIC int strcmpnocase(char *a, char *b) {
|
||||
while(*a) {
|
||||
int cmp = hichar(*a) - hichar(*b);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -89,30 +89,6 @@ HTSEXT_API const char *hts_get_version_info(httrackp * opt) {
|
||||
return opt->state.HTbuff;
|
||||
}
|
||||
|
||||
/* memory checks */
|
||||
HTSEXT_API htsErrorCallback htsCallbackErr = NULL;
|
||||
HTSEXT_API int htsMemoryFastXfr = 1; /* fast xfr by default */
|
||||
void abortLog__fnc(char *msg, char *file, int line);
|
||||
void abortLog__fnc(char *msg, char *file, int line) {
|
||||
FILE *fp = fopen("CRASH.TXT", "wb");
|
||||
|
||||
if (!fp)
|
||||
fp = fopen("/tmp/CRASH.TXT", "wb");
|
||||
if (!fp)
|
||||
fp = fopen("C:\\CRASH.TXT", "wb");
|
||||
if (!fp)
|
||||
fp = fopen("CRASH.TXT", "wb");
|
||||
if (fp) {
|
||||
fprintf(fp, "HTTrack " HTTRACK_VERSIONID " closed at '%s', line %d\r\n",
|
||||
file, line);
|
||||
fprintf(fp, "Reason:\r\n%s\r\n", msg);
|
||||
fflush(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
HTSEXT_API t_abortLog abortLog__ = abortLog__fnc; /* avoid VC++ inlining */
|
||||
|
||||
static void htspe_log(htsmoduleStruct * str, const char *msg);
|
||||
|
||||
int hts_parse_externals(htsmoduleStruct * str) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -328,8 +328,8 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
|
||||
is_html = ishtml(opt, fil);
|
||||
switch (is_html) { /* .html,.shtml,.. */
|
||||
case 1:
|
||||
if ((strfield2(get_ext(OPT_GET_BUFF(opt), fil), "html") == 0)
|
||||
&& (strfield2(get_ext(OPT_GET_BUFF(opt), fil), "htm") == 0)
|
||||
if ((strfield2(get_ext(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), fil), "html") == 0)
|
||||
&& (strfield2(get_ext(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), fil), "htm") == 0)
|
||||
) {
|
||||
strcpybuff(ext, "html");
|
||||
ext_chg = 1;
|
||||
@@ -812,7 +812,7 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
|
||||
name[pos][0] = '\0';
|
||||
}
|
||||
pos = 0;
|
||||
while(*a != ']') {
|
||||
while(*a != '\0' && *a != ']') {
|
||||
if (pos < 5) {
|
||||
if (*a == ':') { // next token
|
||||
c = name[++pos];
|
||||
@@ -823,7 +823,9 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
|
||||
}
|
||||
}
|
||||
}
|
||||
a++;
|
||||
if (*a == ']') {
|
||||
a++;
|
||||
}
|
||||
strcatbuff(name[0], "="); /* param=.. */
|
||||
c = strchr(fil_complete, '?');
|
||||
/* parameters exists */
|
||||
@@ -845,7 +847,7 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
|
||||
*d++ = *c++;
|
||||
}
|
||||
*d = '\0';
|
||||
d = unescape_http(catbuff, name[0]);
|
||||
d = unescape_http(catbuff, sizeof(catbuff), name[0]);
|
||||
if (d && *d) {
|
||||
strcpybuff(b, d); /* value */
|
||||
b += strlen(b);
|
||||
@@ -1695,9 +1697,9 @@ void url_savename_refname(const char *adr, const char *fil, char *filename) {
|
||||
MD5_CTX ctx;
|
||||
|
||||
MD5Init(&ctx, 0);
|
||||
MD5Update(&ctx, (const unsigned char *) adr, strlen(adr));
|
||||
MD5Update(&ctx, (const unsigned char *) adr, (int) strlen(adr));
|
||||
MD5Update(&ctx, (const unsigned char *) ",", 1);
|
||||
MD5Update(&ctx, (const unsigned char *) fil, strlen(fil));
|
||||
MD5Update(&ctx, (const unsigned char *) fil, (int) strlen(fil));
|
||||
MD5Final(bindigest, &ctx);
|
||||
sprintf(filename,
|
||||
CACHE_REFNAME "/" "%02x%02x%02x%02x%02x%02x%02x%02x"
|
||||
@@ -1714,7 +1716,8 @@ char *url_savename_refname_fullpath(httrackp * opt, const char *adr,
|
||||
char digest_filename[64];
|
||||
|
||||
url_savename_refname(adr, fil, digest_filename);
|
||||
return fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), digest_filename);
|
||||
return fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), digest_filename);
|
||||
}
|
||||
|
||||
/* remove refname if any */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
314
src/htsnet.h
314
src/htsnet.h
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -38,6 +38,7 @@ Please visit our Website: http://www.httrack.com
|
||||
/* basic net definitions */
|
||||
#include "htsglobal.h"
|
||||
#include "htsbasenet.h"
|
||||
#include "htssafe.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef _WIN32
|
||||
@@ -45,6 +46,8 @@ Please visit our Website: http://www.httrack.com
|
||||
#include <io.h>
|
||||
// pour FindFirstFile
|
||||
#include <winbase.h>
|
||||
typedef USHORT in_port_t;
|
||||
typedef ADDRESS_FAMILY sa_family_t;
|
||||
#else
|
||||
//typedef int T_SOC;
|
||||
#define INVALID_SOCKET -1
|
||||
@@ -70,87 +73,12 @@ typedef unsigned long in_addr_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** ipV4 **
|
||||
*/
|
||||
#if HTS_INET6==0
|
||||
|
||||
/* Ipv4 structures */
|
||||
typedef struct in_addr INaddr;
|
||||
|
||||
/* This should handle all cases */
|
||||
#ifndef HTS_DEF_FWSTRUCT_SOCaddr
|
||||
#define HTS_DEF_FWSTRUCT_SOCaddr
|
||||
typedef struct SOCaddr SOCaddr;
|
||||
#endif
|
||||
struct SOCaddr {
|
||||
union {
|
||||
struct sockaddr_in in;
|
||||
struct sockaddr sa;
|
||||
unsigned char v4data[4];
|
||||
unsigned char v6data[16];
|
||||
unsigned char pad[128];
|
||||
} m_addr;
|
||||
};
|
||||
|
||||
/* Ipv4 structure members */
|
||||
#define SOCaddr_sinaddr(server) ((server).m_addr.in.sin_addr)
|
||||
#define SOCaddr_sinfamily(server) ((server).m_addr.in.sin_family)
|
||||
#define SOCaddr_sinport(server) ((server).m_addr.in.sin_port)
|
||||
|
||||
/* AF_xx */
|
||||
#define AFinet AF_INET
|
||||
|
||||
/* Set port to sockaddr structure */
|
||||
#define SOCaddr_initport(server, port) do { \
|
||||
SOCaddr_sinport(server) = htons((unsigned short int) (port)); \
|
||||
} while(0)
|
||||
|
||||
#define SOCaddr_initany(server, server_len) do { \
|
||||
SOCaddr_sinfamily(server) = AF_INET; \
|
||||
memset(&SOCaddr_sinaddr(server), 0, sizeof(struct sockaddr_in)); \
|
||||
server_len=sizeof(struct sockaddr_in); \
|
||||
} while(0)
|
||||
|
||||
/* Copy sockaddr to another one */
|
||||
#define SOCaddr_copyaddr(server, server_len, hpaddr, hpsize) do { \
|
||||
if (hpsize == sizeof(struct sockaddr_in)) { \
|
||||
server_len=sizeof(struct sockaddr_in); \
|
||||
SOCaddr_sinfamily(server) = (*(struct sockaddr_in*)(hpaddr)).sin_family; \
|
||||
SOCaddr_sinport(server) = (*(struct sockaddr_in*)(hpaddr)).sin_port; \
|
||||
memcpy(&SOCaddr_sinaddr(server), &(*(struct sockaddr_in*)(hpaddr)).sin_addr, sizeof(SOCaddr_sinaddr(server))); \
|
||||
} else if (hpsize == 4) {\
|
||||
server_len=sizeof(struct sockaddr_in); \
|
||||
SOCaddr_sinfamily(server) = AF_INET; \
|
||||
SOCaddr_sinport(server) = 0; \
|
||||
memcpy(&SOCaddr_sinaddr(server), (hpaddr), sizeof(SOCaddr_sinaddr(server))); \
|
||||
} else if ((hpsize > 0) && (hpsize <= sizeof(server))) { \
|
||||
server_len=hpsize; \
|
||||
memcpy(&(server), hpaddr, hpsize); \
|
||||
} else { \
|
||||
server_len=0; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* Get dotted address */
|
||||
#define SOCaddr_inetntoa(namebuf, namebuflen, ss, sslen) do { \
|
||||
char* dot = (char*) inet_ntoa(SOCaddr_sinaddr(ss)); \
|
||||
(namebuf)[0]='\0'; \
|
||||
if (dot) { \
|
||||
strcpy(namebuf, dot); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* Get protocol ID */
|
||||
#define SOCaddr_getproto(ss, sslen) ('1')
|
||||
|
||||
/*
|
||||
** ipV6 **
|
||||
*/
|
||||
#else
|
||||
|
||||
/* Ipv4 structures */
|
||||
#if HTS_INET6 != 0
|
||||
typedef struct in6_addr INaddr;
|
||||
#else
|
||||
typedef struct in_addr INaddr;
|
||||
#endif
|
||||
|
||||
/* This should handle all cases */
|
||||
#ifndef HTS_DEF_FWSTRUCT_SOCaddr
|
||||
@@ -159,117 +87,169 @@ typedef struct SOCaddr SOCaddr;
|
||||
#endif
|
||||
struct SOCaddr {
|
||||
union {
|
||||
struct sockaddr_in6 in6;
|
||||
struct sockaddr_in in;
|
||||
/* Generic version, for network functions such as getnameinfo() */
|
||||
struct sockaddr sa;
|
||||
unsigned char v4data[4];
|
||||
unsigned char v6data[16];
|
||||
unsigned char pad[128];
|
||||
/* IPv4 */
|
||||
struct sockaddr_in in;
|
||||
#if HTS_INET6 != 0
|
||||
/* IPv6 */
|
||||
struct sockaddr_in6 in6;
|
||||
#endif
|
||||
} m_addr;
|
||||
};
|
||||
|
||||
/* Ipv4 structure members */
|
||||
#define SOCaddr_sinaddr(server) ((server).m_addr.in6.sin6_addr)
|
||||
#define SOCaddr_sinfamily(server) ((server).m_addr.in6.sin6_family)
|
||||
#define SOCaddr_sinport(server) ((server).m_addr.in6.sin6_port)
|
||||
#define SOCaddr_sinflowinfo(server) ((server).m_addr.in6.sin6_flowinfo)
|
||||
/* #define SOCaddr_sinscopeid(a) ((a).m_addr.in6.sin6_scope_id) */
|
||||
static HTS_INLINE HTS_UNUSED in_port_t* SOCaddr_sinport_(SOCaddr *const addr,
|
||||
const char *file, const int line) {
|
||||
assertf_(addr != NULL, file, line);
|
||||
switch(addr->m_addr.sa.sa_family) {
|
||||
case AF_INET:
|
||||
return &addr->m_addr.in.sin_port;
|
||||
break;
|
||||
#if HTS_INET6 != 0
|
||||
case AF_INET6:
|
||||
return &addr->m_addr.in6.sin6_port;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
assertf_(! "invalid structure", file, line);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static HTS_INLINE HTS_UNUSED socklen_t SOCaddr_size_(const SOCaddr*const addr,
|
||||
const char *file, const int line) {
|
||||
assertf_(addr != NULL, file, line);
|
||||
switch(addr->m_addr.sa.sa_family) {
|
||||
case AF_INET:
|
||||
return sizeof(addr->m_addr.in);
|
||||
break;
|
||||
#if HTS_INET6 != 0
|
||||
case AF_INET6:
|
||||
return sizeof(addr->m_addr.in6);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static HTS_INLINE HTS_UNUSED void SOCaddr_clear_(SOCaddr*const addr,
|
||||
const char *file, const int line) {
|
||||
assertf_(addr != NULL, file, line);
|
||||
addr->m_addr.sa.sa_family = AF_UNSPEC;
|
||||
}
|
||||
|
||||
/* Ipv4/6 structure members */
|
||||
#define SOCaddr_sinfamily(server) ((server).m_addr.sa.sa_family)
|
||||
#define SOCaddr_sinport(server) (*SOCaddr_sinport_(&(server), __FILE__, __LINE__))
|
||||
#define SOCaddr_size(server) (SOCaddr_size_(&(server), __FILE__, __LINE__))
|
||||
#define SOCaddr_is_valid(server) (SOCaddr_size_(&(server), __FILE__, __LINE__) != 0 )
|
||||
#define SOCaddr_clear(server) SOCaddr_clear_(&(server), __FILE__, __LINE__)
|
||||
#define SOCaddr_sockaddr(server) ((server).m_addr.sa)
|
||||
#define SOCaddr_capacity(server) sizeof((server).m_addr)
|
||||
|
||||
/* AF_xx */
|
||||
#if HTS_INET6 != 0
|
||||
#define AFinet AF_INET6
|
||||
#else
|
||||
#define AFinet AF_INET
|
||||
#endif
|
||||
|
||||
/* Set port to sockaddr structure */
|
||||
#define SOCaddr_initport(server, port) do { \
|
||||
SOCaddr_sinport(server) = htons((unsigned short int) (port)); \
|
||||
SOCaddr_sinport(server) = htons((in_port_t) (port)); \
|
||||
} while(0)
|
||||
|
||||
#define SOCaddr_initany(server, server_len) do { \
|
||||
SOCaddr_sinfamily(server) = AF_INET; \
|
||||
memset(&SOCaddr_sinaddr(server), 0, sizeof(struct sockaddr_in)); \
|
||||
server_len=sizeof(struct sockaddr_in); \
|
||||
static HTS_INLINE HTS_UNUSED socklen_t SOCaddr_initany_(SOCaddr*const addr,
|
||||
const char *file, const int line) {
|
||||
assertf_(addr != NULL, file, line);
|
||||
memset(&addr->m_addr.in, 0, sizeof(addr->m_addr.in));
|
||||
addr->m_addr.in.sin_family = AF_INET;
|
||||
return SOCaddr_size_(addr, file, line);
|
||||
}
|
||||
|
||||
#define SOCaddr_initany(server) do { \
|
||||
SOCaddr_initany_(&(server), __FILE__, __LINE__); \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
Copy sockaddr to SOCaddr
|
||||
|
||||
Note;
|
||||
The '> sizeof(struct sockaddr_in6)' hack if for the VC6 structure which
|
||||
lacks the scope id
|
||||
Copy sockaddr_in/sockaddr_in6/raw IPv4/raw IPv6 to our opaque SOCaddr
|
||||
*/
|
||||
static HTS_UNUSED socklen_t SOCaddr_copyaddr_(SOCaddr*const server,
|
||||
const void *data, const size_t data_size,
|
||||
const char *file, const int line) {
|
||||
assertf_(server != NULL, file, line);
|
||||
assertf_(data != NULL, file, line);
|
||||
|
||||
if (data_size == sizeof(struct sockaddr_in)) {
|
||||
memcpy(&server->m_addr.in, data, sizeof(struct sockaddr_in));
|
||||
assertf_(server->m_addr.sa.sa_family == AF_INET, file, line);
|
||||
#if HTS_INET6 != 0
|
||||
} else if (data_size == sizeof(struct sockaddr_in6)) {
|
||||
memcpy(&server->m_addr.in6, data, sizeof(struct sockaddr_in6));
|
||||
assertf_(server->m_addr.sa.sa_family == AF_INET6, file, line);
|
||||
#endif
|
||||
} else if (data_size == 4) {
|
||||
memset(&server->m_addr.in, 0, sizeof(server->m_addr.in));
|
||||
server->m_addr.in.sin_family = AF_INET;
|
||||
server->m_addr.in.sin_port = 0;
|
||||
memcpy(&server->m_addr.in.sin_addr, data, 4);
|
||||
#if HTS_INET6 != 0
|
||||
} else if (data_size == 16) {
|
||||
memset(&server->m_addr.in6, 0, sizeof(server->m_addr.in6));
|
||||
server->m_addr.in6.sin6_family = AF_INET6;
|
||||
server->m_addr.in6.sin6_port = 0;
|
||||
memcpy(&server->m_addr.in6.sin6_addr, data, 16);
|
||||
#endif
|
||||
} else {
|
||||
server->m_addr.in.sin_family = AF_INET;
|
||||
}
|
||||
return SOCaddr_size_(server, file, line);
|
||||
}
|
||||
|
||||
#define SOCaddr_copyaddr(server, server_len, hpaddr, hpsize) do { \
|
||||
if (hpsize == sizeof(struct sockaddr_in6)) { \
|
||||
server_len=sizeof(struct sockaddr_in6); \
|
||||
SOCaddr_sinfamily(server) = (*(struct sockaddr_in6*)(hpaddr)).sin6_family; \
|
||||
SOCaddr_sinport(server) = (*(struct sockaddr_in6*)(hpaddr)).sin6_port; \
|
||||
SOCaddr_sinflowinfo(server) = (*(struct sockaddr_in6*)(hpaddr)).sin6_flowinfo; \
|
||||
memcpy(&SOCaddr_sinaddr(server), &(*(struct sockaddr_in6*)(hpaddr)).sin6_addr, sizeof(SOCaddr_sinaddr(server))); \
|
||||
} else if (hpsize > sizeof(struct sockaddr_in6)) { \
|
||||
server_len=hpsize; \
|
||||
SOCaddr_sinport(server) = 0; \
|
||||
memcpy(&(server), hpaddr, hpsize); \
|
||||
} else if (hpsize == sizeof(struct sockaddr_in)) { \
|
||||
server_len=sizeof(struct sockaddr_in); \
|
||||
(*(struct sockaddr_in*)(&server)).sin_family = AF_INET; \
|
||||
SOCaddr_sinport(server) = (*(struct sockaddr_in*)(hpaddr)).sin_port; \
|
||||
memcpy(&(*(struct sockaddr_in*)&(server)).sin_addr, &(*(struct sockaddr_in*)(hpaddr)).sin_addr, sizeof((*(struct sockaddr_in*)(hpaddr)).sin_addr)); \
|
||||
} else if (hpsize == 4) {\
|
||||
server_len=sizeof(struct sockaddr_in); \
|
||||
(*(struct sockaddr_in*)(&server)).sin_family = AF_INET; \
|
||||
SOCaddr_sinport(server) = 0; \
|
||||
memcpy(&(*(struct sockaddr_in*)&(server)).sin_addr, hpaddr, 4); \
|
||||
} else if (hpsize == 16) {\
|
||||
server_len=sizeof(struct sockaddr_in6); \
|
||||
SOCaddr_sinfamily(server) = AF_INET6; \
|
||||
SOCaddr_sinport(server) = 0; \
|
||||
memcpy(&SOCaddr_sinaddr(server), (hpaddr), 16); \
|
||||
} else if ((hpsize > 0) && (hpsize <= sizeof(server))) { \
|
||||
server_len=hpsize; \
|
||||
memcpy(&(server), hpaddr, hpsize); \
|
||||
} else { \
|
||||
server_len=0; \
|
||||
} \
|
||||
server_len = (int) SOCaddr_copyaddr_(&(server), hpaddr, hpsize, __FILE__, __LINE__); \
|
||||
} while(0)
|
||||
|
||||
#define SOCaddr_copyaddr2(server, hpaddr, hpsize) do { \
|
||||
(void) SOCaddr_copyaddr_(&(server), hpaddr, hpsize, __FILE__, __LINE__); \
|
||||
} while(0)
|
||||
|
||||
#define SOCaddr_copy_SOCaddr(dest, src) do { \
|
||||
SOCaddr_copyaddr_(&(dest), &(src).m_addr.sa, SOCaddr_size(src), __FILE__, __LINE__); \
|
||||
} while(0)
|
||||
|
||||
/* Get dotted address */
|
||||
#define SOCaddr_inetntoa(namebuf, namebuflen, ss, sslen) do { \
|
||||
char *pos_; \
|
||||
(namebuf)[0]='\0'; \
|
||||
getnameinfo((struct sockaddr *)&(ss), sslen, \
|
||||
(namebuf), namebuflen, NULL, 0, NI_NUMERICHOST); \
|
||||
/* remove scope id */ \
|
||||
pos_ = strrchr(namebuf, '%'); \
|
||||
if (pos_ != NULL) { \
|
||||
*pos_ = '\0'; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static HTS_UNUSED void SOCaddr_inetntoa_(char *namebuf, size_t namebuflen,
|
||||
SOCaddr *const ss,
|
||||
const char *file, const int line) {
|
||||
assertf_(namebuf != NULL, file, line);
|
||||
assertf_(ss != NULL, file, line);
|
||||
|
||||
if (getnameinfo(&ss->m_addr.sa, sizeof(ss->m_addr),
|
||||
namebuf, namebuflen,
|
||||
NULL, 0,
|
||||
NI_NUMERICHOST) == 0) {
|
||||
/* remove scope id(s) */
|
||||
char *const pos = strchr(namebuf, '%');
|
||||
if (pos != NULL) {
|
||||
*pos = '\0';
|
||||
}
|
||||
} else {
|
||||
namebuf[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
#define SOCaddr_inetntoa(namebuf, namebuflen, ss) \
|
||||
SOCaddr_inetntoa_(namebuf, namebuflen, &(ss), __FILE__, __LINE__)
|
||||
|
||||
/* Get protocol ID */
|
||||
#define SOCaddr_getproto(ss, sslen) ((sslen == sizeof(struct sockaddr_in6))?('2'):('1'))
|
||||
|
||||
#endif
|
||||
#define SOCaddr_getproto(ss) ( SOCaddr_size(ss) == sizeof(struct sockaddr_in) ? '1' : '2')
|
||||
|
||||
/* Socket length type */
|
||||
typedef socklen_t SOClen;
|
||||
|
||||
/* Buffer structure to copy various hostent structures */
|
||||
#ifndef HTS_DEF_FWSTRUCT_t_fullhostent
|
||||
#define HTS_DEF_FWSTRUCT_t_fullhostent
|
||||
typedef struct t_fullhostent t_fullhostent;
|
||||
#endif
|
||||
struct t_fullhostent {
|
||||
t_hostent hp;
|
||||
char *list[2];
|
||||
char addr[HTS_MAXADDRLEN]; /* various struct sockaddr structures */
|
||||
unsigned int addr_maxlen;
|
||||
};
|
||||
|
||||
/* Initialize a t_fullhostent structure */
|
||||
#define fullhostent_init(h) do { \
|
||||
memset((h), 0, sizeof(t_fullhostent)); \
|
||||
(h)->hp.h_addr_list = (char **) & ((h)->list); \
|
||||
(h)->list[0] = (char *) & ((h)->addr); \
|
||||
(h)->list[1] = NULL; \
|
||||
(h)->addr_maxlen = HTS_MAXADDRLEN; \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
151
src/htsparse.c
151
src/htsparse.c
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -77,12 +77,14 @@ Please visit our Website: http://www.httrack.com
|
||||
// version optimisée, qui permet de ne pas toucher aux html non modifiés (update)
|
||||
#define REALLOC_SIZE 8192
|
||||
#define HT_ADD_CHK(A) if (((int) (A)+ht_len+1) >= ht_size) { \
|
||||
char message[256]; \
|
||||
ht_size=(A)+ht_len+REALLOC_SIZE; \
|
||||
ht_buff=(char*) realloct(ht_buff,ht_size); \
|
||||
if (ht_buff==NULL) { \
|
||||
printf("PANIC! : Not enough memory [%d]\n", __LINE__); \
|
||||
XH_uninit; \
|
||||
abortLogFmt("not enough memory for current html document in HT_ADD_CHK : realloct("LLintP") failed" _ (LLint) ht_size); \
|
||||
snprintf(message, sizeof(message), "not enough memory for current html document in HT_ADD_CHK : realloct("LLintP") failed", (LLint) ht_size); \
|
||||
abortLog(message); \
|
||||
abort(); \
|
||||
} \
|
||||
} \
|
||||
@@ -106,7 +108,7 @@ Please visit our Website: http://www.httrack.com
|
||||
if ((opt->getmode & 1) && (ptr>0)) { \
|
||||
size_t i_, j_; \
|
||||
char BIGSTK tempo_[HTS_URLMAXSIZE*2]; \
|
||||
escape_for_html_print(A, tempo_); \
|
||||
escape_for_html_print(A, tempo_, sizeof(tempo_)); \
|
||||
i_=strlen(tempo_); \
|
||||
j_=ht_len; \
|
||||
if (i_) { \
|
||||
@@ -118,7 +120,7 @@ Please visit our Website: http://www.httrack.com
|
||||
if ((opt->getmode & 1) && (ptr>0)) { \
|
||||
size_t i_, j_; \
|
||||
char BIGSTK tempo_[HTS_URLMAXSIZE*2]; \
|
||||
escape_for_html_print_full(A, tempo_); \
|
||||
escape_for_html_print_full(A, tempo_, sizeof(tempo_)); \
|
||||
i_=strlen(tempo_); \
|
||||
j_=ht_len; \
|
||||
if (i_) { \
|
||||
@@ -127,6 +129,7 @@ Please visit our Website: http://www.httrack.com
|
||||
ht_buff[j_+i_]='\0'; \
|
||||
} }
|
||||
#define HT_ADD_START \
|
||||
char message[256]; \
|
||||
size_t ht_size=(size_t)(r->size*5)/4+REALLOC_SIZE; \
|
||||
size_t ht_len=0; \
|
||||
char* ht_buff=NULL; \
|
||||
@@ -135,7 +138,8 @@ Please visit our Website: http://www.httrack.com
|
||||
if (ht_buff==NULL) { \
|
||||
printf("PANIC! : Not enough memory [%d]\n",__LINE__); \
|
||||
XH_uninit; \
|
||||
abortLogFmt("not enough memory for current html document in HT_ADD_START : malloct("LLintP") failed" _ (LLint) ht_size); \
|
||||
snprintf(message, sizeof(message), "not enough memory for current html document in HT_ADD_START : malloct("LLintP") failed", (LLint) ht_size); \
|
||||
abortLog(message); \
|
||||
abort(); \
|
||||
} \
|
||||
ht_buff[0]='\0'; \
|
||||
@@ -144,7 +148,7 @@ Please visit our Website: http://www.httrack.com
|
||||
int ok=0;\
|
||||
if (ht_buff) { \
|
||||
char digest[32+2];\
|
||||
off_t fsize_old = fsize(fconv(OPT_GET_BUFF(opt),savename));\
|
||||
off_t fsize_old = fsize(fconv(OPT_GET_BUFF(opt),OPT_GET_BUFF_SIZE(opt),savename));\
|
||||
digest[0]='\0';\
|
||||
domd5mem(ht_buff,ht_len,digest,1);\
|
||||
if (fsize_old==ht_len) { \
|
||||
@@ -210,8 +214,7 @@ Please visit our Website: http://www.httrack.com
|
||||
char BIGSTK tempo[1024]; \
|
||||
if (makeindex_links == 1) { \
|
||||
char BIGSTK link_escaped[HTS_URLMAXSIZE*2]; \
|
||||
strcpybuff(link_escaped, makeindex_firstlink); \
|
||||
escape_uri_utf(link_escaped); \
|
||||
escape_uri_utf(makeindex_firstlink, link_escaped, sizeof(link_escaped)); \
|
||||
sprintf(tempo,"<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=%s\">"CRLF,link_escaped); \
|
||||
} else \
|
||||
tempo[0]='\0'; \
|
||||
@@ -222,7 +225,7 @@ Please visit our Website: http://www.httrack.com
|
||||
fflush(makeindex_fp); \
|
||||
fclose(makeindex_fp); /* à ne pas oublier sinon on passe une nuit blanche */ \
|
||||
makeindex_fp=NULL; \
|
||||
usercommand(opt,0,NULL,fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_html_utf8),"index.html"),"primary","primary"); \
|
||||
usercommand(opt,0,NULL,fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_html_utf8),"index.html"),"primary","primary"); \
|
||||
} \
|
||||
} \
|
||||
makeindex_done=1; /* ok c'est fait */ \
|
||||
@@ -654,13 +657,13 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
if (p) { // ok center
|
||||
if (makeindex_fp == NULL) {
|
||||
file_notify(opt, "", "",
|
||||
fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html_utf8),
|
||||
"index.html"), 1, 1, 0);
|
||||
verif_backblue(opt, StringBuff(opt->path_html_utf8)); // générer gif
|
||||
makeindex_fp =
|
||||
filecreate(&opt->state.strc,
|
||||
fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html_utf8),
|
||||
"index.html"));
|
||||
if (makeindex_fp != NULL) {
|
||||
@@ -692,7 +695,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
}
|
||||
if (lienrelatif
|
||||
(tempo, liens[ptr]->sav,
|
||||
concat(OPT_GET_BUFF(opt),
|
||||
concat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_html_utf8),
|
||||
"index.html")) == 0) {
|
||||
detect_title = 1; // ok détecté pour cette page!
|
||||
@@ -729,7 +732,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
}
|
||||
|
||||
// Body
|
||||
escape_uri_utf(tempo);
|
||||
inplace_escape_uri_utf(tempo, sizeof(tempo));
|
||||
fprintf(makeindex_fp, template_body, tempo, s);
|
||||
}
|
||||
}
|
||||
@@ -1720,7 +1723,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
get_httptype(opt, type, tempo, 0);
|
||||
if (strnotempty(type)) // type reconnu!
|
||||
url_ok = 1;
|
||||
else if (is_dyntype(get_ext(OPT_GET_BUFF(opt), tempo))) // reconnu php,cgi,asp..
|
||||
else if (is_dyntype(get_ext(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), tempo))) // reconnu php,cgi,asp..
|
||||
url_ok = 1;
|
||||
// MAIS pas les foobar@aol.com !!
|
||||
if (strchr(tempo, '@'))
|
||||
@@ -2107,7 +2110,8 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
}
|
||||
|
||||
// Unescape %XX, but not yet high-chars (supposedly encoded with UTF-8)
|
||||
strcpybuff(lien, unescape_http_unharm(catbuff, lien, 1 | 2)); /* note: '%' is still escaped */
|
||||
strcpybuff(lien,
|
||||
unescape_http_unharm(catbuff, sizeof(catbuff), lien, 1 | 2)); /* note: '%' is still escaped */
|
||||
|
||||
// Force to encode non-printable chars (should never happend)
|
||||
escape_remove_control(lien);
|
||||
@@ -2155,10 +2159,8 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
|
||||
// we need to encode query string non-ascii chars,
|
||||
// leaving the encoding as-is (unlike the file part)
|
||||
escape_check_url(query);
|
||||
|
||||
// copy back query
|
||||
strcatbuff(lien, query); /* restore */
|
||||
// and copy back query
|
||||
append_escape_check_url(query, lien, sizeof(lien));
|
||||
}
|
||||
|
||||
// convertir les éventuels \ en des / pour éviter des problèmes de reconnaissance!
|
||||
@@ -2778,7 +2780,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
if (lienrelatif(tempo, save, relativesavename) ==
|
||||
0) {
|
||||
/* Never escape high-chars (we don't know the encoding!!) */
|
||||
escape_uri_utf(tempo); // escape with %xx
|
||||
inplace_escape_uri_utf(tempo, sizeof(tempo)); // escape with %xx
|
||||
//if (!no_esc_utf)
|
||||
// escape_uri(tempo); // escape with %xx
|
||||
//else
|
||||
@@ -2825,7 +2827,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
if (verif_external(opt, cat_nb, 1)) {
|
||||
FILE *fp =
|
||||
filecreate(&opt->state.strc,
|
||||
fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->
|
||||
path_html_utf8),
|
||||
cat_name));
|
||||
@@ -2844,7 +2846,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
}
|
||||
fclose(fp);
|
||||
usercommand(opt, 0, NULL,
|
||||
fconcat(OPT_GET_BUFF(opt),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->
|
||||
path_html_utf8),
|
||||
cat_name), "", "");
|
||||
@@ -2943,21 +2945,11 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
}
|
||||
*/
|
||||
else if (opt->mimehtml) {
|
||||
char BIGSTK buff[HTS_URLMAXSIZE * 3];
|
||||
char BIGSTK cid[HTS_URLMAXSIZE * 3];
|
||||
|
||||
HT_ADD("cid:");
|
||||
strcpybuff(buff, adr);
|
||||
strcatbuff(buff, fil);
|
||||
escape_in_url(buff);
|
||||
{
|
||||
char *a = buff;
|
||||
|
||||
while((a = strchr(a, '%'))) {
|
||||
*a = 'X';
|
||||
a++;
|
||||
}
|
||||
}
|
||||
HT_ADD_HTMLESCAPED(buff);
|
||||
make_content_id(adr, fil, cid, sizeof(cid));
|
||||
HT_ADD_HTMLESCAPED(cid);
|
||||
lastsaved = eadr - 1; // dernier écrit+1 (enfin euh apres on fait un ++ alors hein)
|
||||
} else if (opt->urlmode == 3) { // URI absolue /
|
||||
if ((opt->getmode & 1) && (ptr > 0)) { // ecrire les html
|
||||
@@ -3020,7 +3012,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
if (lienrelatif(tempo, save, relativesavename) == 0) {
|
||||
if (!in_media) { // In media (such as real audio): don't patch
|
||||
/* Never escape high-chars (we don't know the encoding!!) */
|
||||
escape_uri_utf(tempo);
|
||||
inplace_escape_uri_utf(tempo, sizeof(tempo));
|
||||
|
||||
//if (!no_esc_utf)
|
||||
// escape_uri(tempo); // escape with %xx
|
||||
@@ -3535,8 +3527,6 @@ int hts_mirror_check_moved(htsmoduleStruct * str,
|
||||
if (HTTP_IS_REDIRECT(r->statuscode)) {
|
||||
//if (r->adr!=NULL) { // adr==null si fichier direct. [catch: davename normalement si cgi]
|
||||
//int i=0;
|
||||
char *rn = NULL;
|
||||
|
||||
// char* p;
|
||||
|
||||
hts_log_print(opt, LOG_WARNING, "%s for %s%s", r->msg, urladr, urlfil);
|
||||
@@ -3616,7 +3606,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str,
|
||||
urladr, urlfil, mov_adr, mov_fil);
|
||||
// canceller lien actuel
|
||||
error = 1;
|
||||
strcpybuff(liens[ptr]->adr, "!"); // caractère bidon (invalide hash)
|
||||
hash_invalidate_entry(hashptr, ptr); // invalidate hashtable entry
|
||||
// noter NOUVEAU lien
|
||||
//xxc xxc
|
||||
// set_prio_to=0+1; // protection if the moved URL is an html page!!
|
||||
@@ -3676,50 +3666,35 @@ int hts_mirror_check_moved(htsmoduleStruct * str,
|
||||
} // ident_url_xx
|
||||
|
||||
if (get_it == 0) { // adresse vraiment différente et potentiellement en html (pas de possibilité de bouger la page tel quel à cause des <img src..> et cie)
|
||||
rn = (char *) calloct(8192, 1);
|
||||
const size_t rn_size = 8192;
|
||||
char *const rn = (char *) malloct(rn_size);
|
||||
if (rn != NULL) {
|
||||
hts_log_print(opt, LOG_WARNING, "File has moved from %s%s to %s",
|
||||
urladr, urlfil, mov_url);
|
||||
if (!opt->mimehtml) {
|
||||
escape_uri(mov_url);
|
||||
inplace_escape_uri(mov_url, sizeof(mov_url));
|
||||
} else {
|
||||
char BIGSTK buff[HTS_URLMAXSIZE * 3];
|
||||
|
||||
strcpybuff(buff, mov_adr);
|
||||
strcatbuff(buff, mov_fil);
|
||||
escape_in_url(buff);
|
||||
{
|
||||
char *a = buff;
|
||||
|
||||
while((a = strchr(a, '%'))) {
|
||||
*a = 'X';
|
||||
a++;
|
||||
}
|
||||
}
|
||||
char BIGSTK cid[HTS_URLMAXSIZE * 3];
|
||||
make_content_id(mov_adr, mov_fil, cid, sizeof(cid));
|
||||
strcpybuff(mov_url, "cid:");
|
||||
strcatbuff(mov_url, buff);
|
||||
strcatbuff(mov_url, cid);
|
||||
}
|
||||
// On prépare une page qui sautera immédiatement sur la bonne URL
|
||||
// Le scanner re-changera, ensuite, cette URL, pour la mirrorer!
|
||||
strcpybuff(rn, "<HTML>" CRLF);
|
||||
strcatbuff(rn,
|
||||
"<!-- Created by HTTrack Website Copier/" HTTRACK_VERSION
|
||||
" " HTTRACK_AFF_AUTHORS " -->" CRLF);
|
||||
strcatbuff(rn,
|
||||
"<HEAD>" CRLF "<TITLE>Page has moved</TITLE>" CRLF
|
||||
"</HEAD>" CRLF "<BODY>" CRLF);
|
||||
strcatbuff(rn, "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=");
|
||||
strcatbuff(rn, mov_url); // URL
|
||||
strcatbuff(rn, "\">" CRLF);
|
||||
strcatbuff(rn, "<A HREF=\"");
|
||||
strcatbuff(rn, mov_url);
|
||||
strcatbuff(rn, "\">");
|
||||
strcatbuff(rn, "<B>Click here...</B></A>" CRLF);
|
||||
strcatbuff(rn, "</BODY>" CRLF);
|
||||
strcatbuff(rn,
|
||||
"<!-- Created by HTTrack Website Copier/" HTTRACK_VERSION
|
||||
" " HTTRACK_AFF_AUTHORS " -->" CRLF);
|
||||
strcatbuff(rn, "</HTML>" CRLF);
|
||||
snprintf(rn, rn_size,
|
||||
"<HTML>" CRLF
|
||||
"<!-- Created by HTTrack Website Copier/" HTTRACK_VERSION " " HTTRACK_AFF_AUTHORS " -->" CRLF
|
||||
"<HEAD>" CRLF
|
||||
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;charset=UTF-8\">"
|
||||
"<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=%s\">"
|
||||
"<TITLE>Page has moved</TITLE>" CRLF
|
||||
"</HEAD>" CRLF
|
||||
"<BODY>" CRLF
|
||||
"<A HREF=\"%s\"><h3>Click here...</h3></A>" CRLF
|
||||
"</BODY>" CRLF
|
||||
"<!-- Created by HTTrack Website Copier/" HTTRACK_VERSION " " HTTRACK_AFF_AUTHORS " -->" CRLF
|
||||
"</HTML>" CRLF,
|
||||
mov_url, mov_url);
|
||||
|
||||
// changer la page
|
||||
if (r->adr) {
|
||||
@@ -3767,7 +3742,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str,
|
||||
//
|
||||
// canceller lien actuel
|
||||
error = 1;
|
||||
strcpybuff(liens[ptr]->adr, "!"); // caractère bidon (invalide hash)
|
||||
hash_invalidate_entry(hashptr, ptr); // invalidate hashtable entry
|
||||
//
|
||||
} else { // oups erreur, plus de mémoire!!
|
||||
printf("PANIC! : Not enough memory [%d]\n", __LINE__);
|
||||
@@ -3968,13 +3943,16 @@ void hts_mirror_process_user_interaction(htsmoduleStruct * str,
|
||||
// user pause lockfile : create hts-paused.lock --> HTTrack will be paused
|
||||
if (fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-stop.lock"))) {
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-stop.lock"))) {
|
||||
// remove lockfile
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-stop.lock"));
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-stop.lock"));
|
||||
if (!fexist
|
||||
(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-stop.lock"))) {
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log), "hts-stop.lock"))) {
|
||||
do_pause = 1;
|
||||
}
|
||||
}
|
||||
@@ -4022,7 +4000,8 @@ void hts_mirror_process_user_interaction(htsmoduleStruct * str,
|
||||
{
|
||||
FILE *fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-paused.lock"), "wb");
|
||||
if (fp) {
|
||||
fspc(NULL, fp, "info"); // dater
|
||||
@@ -4036,10 +4015,10 @@ void hts_mirror_process_user_interaction(htsmoduleStruct * str,
|
||||
stat_fragment = HTS_STAT.stat_bytes;
|
||||
/* Info for wrappers */
|
||||
hts_log_print(opt, LOG_INFO, "engine: pause: %s",
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-paused.lock"));
|
||||
RUN_CALLBACK1(opt, pause,
|
||||
fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log),
|
||||
"hts-paused.lock"));
|
||||
}
|
||||
//
|
||||
@@ -4375,15 +4354,17 @@ int hts_mirror_wait_for_next_file(htsmoduleStruct * str,
|
||||
int a = 0;
|
||||
|
||||
*stre->last_info_shell_ = tl;
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), StringBuff(opt->path_log), "hts-autopsy"))) { // débuggage: teste si le robot est vivant
|
||||
if (fexist(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), StringBuff(opt->path_log), "hts-autopsy"))) { // débuggage: teste si le robot est vivant
|
||||
// (oui je sais un robot vivant.. mais bon.. il a le droit de vivre lui aussi)
|
||||
// (libérons les robots esclaves de l'internet!)
|
||||
remove(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-autopsy"));
|
||||
fp =
|
||||
fopen(fconcat
|
||||
(OPT_GET_BUFF(opt), StringBuff(opt->path_log),
|
||||
(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt),
|
||||
StringBuff(opt->path_log),
|
||||
"hts-isalive"), "wb");
|
||||
a = 1;
|
||||
}
|
||||
@@ -4786,7 +4767,7 @@ int hts_wait_delayed(htsmoduleStruct * str, char *adr, char *fil, char *save,
|
||||
strcpybuff(mov_url, back[b].r.location); // copier URL
|
||||
|
||||
/* Remove (temporarily created) file if it was created */
|
||||
UNLINK(fconv(OPT_GET_BUFF(opt), back[b].url_sav));
|
||||
UNLINK(fconv(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), back[b].url_sav));
|
||||
|
||||
/* Remove slot! */
|
||||
if (back[b].status == STATUS_READY) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
202
src/htssafe.h
Normal file
202
src/htssafe.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Important notes:
|
||||
|
||||
- We hereby ask people using this source NOT to use it in purpose of grabbing
|
||||
emails addresses, or collecting any other private information on persons.
|
||||
This would disgrace our work, and spoil the many hours we spent on it.
|
||||
|
||||
Please visit our Website: http://www.httrack.com
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* File: htssafe.h safe strings operations, and asserts */
|
||||
/* Author: Xavier Roche */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
#ifndef HTSSAFE_DEFH
|
||||
#define HTSSAFE_DEFH
|
||||
|
||||
#include "htsglobal.h"
|
||||
|
||||
/**
|
||||
* Emergency logging.
|
||||
* Default is to use libhttrack one.
|
||||
*/
|
||||
#ifndef HTSSAFE_ABORT_FUNCTION
|
||||
|
||||
/** Assert error callback. **/
|
||||
#ifndef HTS_DEF_FWSTRUCT_htsErrorCallback
|
||||
#define HTS_DEF_FWSTRUCT_htsErrorCallback
|
||||
typedef void (*htsErrorCallback) (const char *msg, const char *file, int line);
|
||||
HTSEXT_API htsErrorCallback hts_get_error_callback(void);
|
||||
#endif
|
||||
|
||||
#define HTSSAFE_ABORT_FUNCTION(A,B,C) do { \
|
||||
htsErrorCallback callback = hts_get_error_callback(); \
|
||||
if (callback != NULL) { \
|
||||
callback(A,B,C); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Log an abort condition, and calls abort().
|
||||
*/
|
||||
#define abortLog(a) abortf_(a, __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Fatal assertion check.
|
||||
*/
|
||||
#define assertf__(exp, sexp, file, line) (void) ( (exp) || (abortf_(sexp, file, line), 0) )
|
||||
|
||||
/**
|
||||
* Fatal assertion check.
|
||||
*/
|
||||
#define assertf_(exp, file, line) assertf__(exp, #exp, file, line)
|
||||
|
||||
/**
|
||||
* Fatal assertion check.
|
||||
*/
|
||||
#define assertf(exp) assertf_(exp, __FILE__, __LINE__)
|
||||
|
||||
static HTS_UNUSED void log_abort_(const char *msg, const char *file, int line) {
|
||||
fprintf(stderr, "%s failed at %s:%d\n", msg, file, line);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
static HTS_UNUSED void abortf_(const char *exp, const char *file, int line) {
|
||||
HTSSAFE_ABORT_FUNCTION(exp, file, line);
|
||||
log_abort_(exp, file, line);
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wether 'VAR' is of type char[].
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
/* Note: char[] and const char[] are compatible */
|
||||
#define HTS_IS_CHAR_BUFFER(VAR) ( __builtin_types_compatible_p ( typeof (VAR), char[] ) )
|
||||
#else
|
||||
/* Note: a bit lame as char[8] won't be seen. */
|
||||
#define HTS_IS_CHAR_BUFFER(VAR) ( sizeof(VAR) != sizeof(char*) )
|
||||
#endif
|
||||
#define HTS_IS_NOT_CHAR_BUFFER(VAR) ( ! HTS_IS_CHAR_BUFFER(VAR) )
|
||||
|
||||
/* Compile-time checks. */
|
||||
static HTS_UNUSED void htssafe_compile_time_check_(void) {
|
||||
char array[32];
|
||||
char *pointer = array;
|
||||
char check_array[HTS_IS_CHAR_BUFFER(array) ? 1 : -1];
|
||||
char check_pointer[HTS_IS_CHAR_BUFFER(pointer) ? -1 : 1];
|
||||
(void) pointer;
|
||||
(void) check_array;
|
||||
(void) check_pointer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append at most N characters from "B" to "A".
|
||||
* If "A" is a char[] variable whose size is not sizeof(char*), then the size
|
||||
* is assumed to be the capacity of this array.
|
||||
*/
|
||||
#define strncatbuff(A, B, N) \
|
||||
( HTS_IS_NOT_CHAR_BUFFER(A) \
|
||||
? strncat(A, B, N) \
|
||||
: strncat_safe_(A, sizeof(A), B, \
|
||||
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), N, \
|
||||
"overflow while appending '" #B "' to '"#A"'", __FILE__, __LINE__) )
|
||||
|
||||
/**
|
||||
* Copy characters from "B" to "A".
|
||||
* If "A" is a char[] variable whose size is not sizeof(char*), then the size
|
||||
* is assumed to be the capacity of this array.
|
||||
*/
|
||||
#define strcpybuff(A, B) \
|
||||
( HTS_IS_NOT_CHAR_BUFFER(A) \
|
||||
? strcpy(A, B) \
|
||||
: strcpy_safe_(A, sizeof(A), B, \
|
||||
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), \
|
||||
"overflow while copying '" #B "' to '"#A"'", __FILE__, __LINE__) )
|
||||
|
||||
/* note: "size_t is an unsigned integral type" */
|
||||
|
||||
/**
|
||||
* Append characters of "B" to "A".
|
||||
* If "A" is a char[] variable whose size is not sizeof(char*), then the size
|
||||
* is assumed to be the capacity of this array.
|
||||
*/
|
||||
#define strcatbuff(A, B) strncatbuff(A, B, (size_t) -1)
|
||||
|
||||
/**
|
||||
* Append characters of "B" to "A", "A" having a maximum capacity of "S".
|
||||
*/
|
||||
#define strlcatbuff(A, B, S) \
|
||||
strncat_safe_(A, S, B, \
|
||||
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), (size_t) -1, \
|
||||
"overflow while appending '" #B "' to '"#A"'", __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* Copy characters of "B" to "A", "A" having a maximum capacity of "S".
|
||||
*/
|
||||
#define strlcpybuff(A, B, S) \
|
||||
strcpy_safe_(A, S, B, \
|
||||
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), \
|
||||
"overflow while copying '" #B "' to '"#A"'", __FILE__, __LINE__)
|
||||
|
||||
static HTS_INLINE HTS_UNUSED size_t strlen_safe_(const char *source, const size_t sizeof_source,
|
||||
const char *file, int line) {
|
||||
size_t size;
|
||||
assertf_( source != NULL, file, line );
|
||||
size = sizeof_source != (size_t) -1
|
||||
? strnlen(source, sizeof_source) : strlen(source);
|
||||
assertf_( size < sizeof_source, file, line );
|
||||
return size;
|
||||
}
|
||||
|
||||
static HTS_INLINE HTS_UNUSED char* strncat_safe_(char *const dest, const size_t sizeof_dest,
|
||||
const char *const source, const size_t sizeof_source,
|
||||
const size_t n,
|
||||
const char *exp, const char *file, int line) {
|
||||
const size_t source_len = strlen_safe_(source, sizeof_source, file, line);
|
||||
const size_t dest_len = strlen_safe_(dest, sizeof_dest, file, line);
|
||||
const size_t source_copy = source_len <= n ? source_len : n;
|
||||
const size_t dest_final_len = dest_len + source_copy;
|
||||
assertf__(dest_final_len < sizeof_dest, exp, file, line);
|
||||
memcpy(dest + dest_len, source, source_copy);
|
||||
dest[dest_final_len] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
static HTS_INLINE HTS_UNUSED char* strcpy_safe_(char *const dest, const size_t sizeof_dest,
|
||||
const char *const source, const size_t sizeof_source,
|
||||
const char *exp, const char *file, int line) {
|
||||
assertf_(sizeof_dest != 0, file, line);
|
||||
dest[0] = '\0';
|
||||
return strncat_safe_(dest, sizeof_dest, source, sizeof_source, (size_t) -1, exp, file, line);
|
||||
}
|
||||
|
||||
#define malloct(A) malloc(A)
|
||||
#define calloct(A,B) calloc((A), (B))
|
||||
#define freet(A) do { if ((A) != NULL) { free(A); (A) = NULL; } } while(0)
|
||||
#define strdupt(A) strdup(A)
|
||||
#define realloct(A,B) realloc(A, B)
|
||||
#define memcpybuff(A, B, N) memcpy((A), (B), (N))
|
||||
|
||||
#endif
|
||||
190
src/htsserver.c
190
src/htsserver.c
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -119,16 +119,16 @@ HTS_UNUSED static int linputsoc_t(T_SOC soc, char *s, int max, int timeout);
|
||||
HTS_UNUSED static int linput(FILE * fp, char *s, int max);
|
||||
|
||||
/* Language files */
|
||||
HTS_UNUSED static int htslang_load(char *limit_to, char *apppath);
|
||||
HTS_UNUSED static void conv_printf(char *from, char *to);
|
||||
HTS_UNUSED static int htslang_load(char *limit_to, const char *apppath);
|
||||
HTS_UNUSED static void conv_printf(const char *from, char *to);
|
||||
HTS_UNUSED static void LANG_DELETE(void);
|
||||
HTS_UNUSED static void LANG_INIT(char *path);
|
||||
HTS_UNUSED static int LANG_T(char *path, int l);
|
||||
HTS_UNUSED static void LANG_INIT(const char *path);
|
||||
HTS_UNUSED static int LANG_T(const char *path, int l);
|
||||
HTS_UNUSED static int QLANG_T(int l);
|
||||
HTS_UNUSED static char *LANGSEL(char *name);
|
||||
HTS_UNUSED static char *LANGINTKEY(char *name);
|
||||
HTS_UNUSED static int LANG_SEARCH(char *path, char *iso);
|
||||
HTS_UNUSED static int LANG_LIST(char *path, char *buffer);
|
||||
HTS_UNUSED static const char *LANGSEL(const char *name);
|
||||
HTS_UNUSED static const char *LANGINTKEY(const char *name);
|
||||
HTS_UNUSED static int LANG_SEARCH(const char *path, const char *iso);
|
||||
HTS_UNUSED static int LANG_LIST(const char *path, char *buffer, size_t size);
|
||||
|
||||
// URL Link catcher
|
||||
|
||||
@@ -162,16 +162,15 @@ T_SOC smallserver_init_std(int *port_prox, char *adr_prox, int defaultPort) {
|
||||
// 1- Init the URL catcher
|
||||
|
||||
// get hostname. return 1 upon success.
|
||||
static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
|
||||
static int gethost(const char *hostname, SOCaddr * server) {
|
||||
if (hostname != NULL && *hostname != '\0') {
|
||||
#if HTS_INET6==0
|
||||
/* ipV4 resolver */
|
||||
t_hostent *hp = gethostbyname(hostname);
|
||||
struct hostent *hp = gethostbyname(hostname);
|
||||
|
||||
if (hp != NULL) {
|
||||
if (hp->h_length) {
|
||||
SOCaddr_copyaddr(*server, server_size, hp->h_addr_list[0],
|
||||
hp->h_length);
|
||||
SOCaddr_copyaddr2(*server, hp->h_addr_list[0], hp->h_length);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -187,7 +186,7 @@ static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
|
||||
if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
|
||||
if (res) {
|
||||
if ((res->ai_addr) && (res->ai_addrlen)) {
|
||||
SOCaddr_copyaddr(*server, server_size, res->ai_addr, res->ai_addrlen);
|
||||
SOCaddr_copyaddr2(*server, res->ai_addr, res->ai_addrlen);
|
||||
freeaddrinfo(res);
|
||||
return 1;
|
||||
}
|
||||
@@ -204,7 +203,7 @@ static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
|
||||
static int my_getlocalhost(char *h_loc, size_t size) {
|
||||
SOCaddr addr;
|
||||
strcpy(h_loc, "localhost");
|
||||
if (gethost(h_loc, &addr, sizeof(addr)) == 1) {
|
||||
if (gethost(h_loc, &addr) == 1) {
|
||||
return 0;
|
||||
}
|
||||
// come on ...
|
||||
@@ -220,7 +219,7 @@ static int my_gethostname(char *h_loc, size_t size) {
|
||||
h_loc[0] = '\0';
|
||||
if (gethostname(h_loc, (int) size) == 0) { // host name
|
||||
SOCaddr addr;
|
||||
if (gethost(h_loc, &addr, sizeof(addr)) == 1) {
|
||||
if (gethost(h_loc, &addr) == 1) {
|
||||
return 0;
|
||||
} else {
|
||||
return my_getlocalhost(h_loc, size);
|
||||
@@ -247,54 +246,16 @@ T_SOC smallserver_init(int *port, char *adr) {
|
||||
|
||||
if (my_gethostname(h_loc, 256) == 0) { // host name
|
||||
SOCaddr server;
|
||||
int server_size = sizeof(server);
|
||||
|
||||
/*t_hostent* hp_loc;
|
||||
t_fullhostent buffer; */
|
||||
|
||||
// effacer structure
|
||||
memset(&server, 0, sizeof(server));
|
||||
|
||||
/*if ( (hp_loc=vxgethostbyname(h_loc, &buffer)) ) */
|
||||
{
|
||||
// copie adresse
|
||||
// NO (bind all)
|
||||
// SOCaddr_copyaddr(server, server_size, hp_loc->h_addr_list[0], hp_loc->h_length);
|
||||
|
||||
SOCaddr_initany(server, server_size);
|
||||
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) {
|
||||
/*SOClen len;
|
||||
SOCaddr server2;
|
||||
len=sizeof(server2); */
|
||||
// effacer structure
|
||||
/*memset(&server2, 0, sizeof(server2));
|
||||
if (getsockname(soc,(struct sockaddr*) &server2,&len) == 0) {
|
||||
*port=ntohs(SOCaddr_sinport(server)); // récupérer port */
|
||||
if (listen(soc, 10) >= 0) { // au pif le 10
|
||||
// SOCaddr_inetntoa(adr, 128, server2, len);
|
||||
strcpy(adr, h_loc);
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
closesocket(soc);
|
||||
#else
|
||||
close(soc);
|
||||
#endif
|
||||
soc = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
/*} else {
|
||||
#ifdef _WIN32
|
||||
closesocket(soc);
|
||||
#else
|
||||
close(soc);
|
||||
#endif
|
||||
soc=INVALID_SOCKET;
|
||||
} */
|
||||
|
||||
SOCaddr_initany(server);
|
||||
if ((soc =
|
||||
(T_SOC) socket(SOCaddr_sinfamily(server), SOCK_STREAM,
|
||||
0)) != INVALID_SOCKET) {
|
||||
SOCaddr_initport(server, *port);
|
||||
if (bind(soc, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
|
||||
if (listen(soc, 10) >= 0) {
|
||||
// SOCaddr_inetntoa(adr, 128, server2);
|
||||
strcpy(adr, h_loc);
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
closesocket(soc);
|
||||
@@ -303,6 +264,13 @@ T_SOC smallserver_init(int *port, char *adr) {
|
||||
#endif
|
||||
soc = INVALID_SOCKET;
|
||||
}
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
closesocket(soc);
|
||||
#else
|
||||
close(soc);
|
||||
#endif
|
||||
soc = INVALID_SOCKET;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -381,7 +349,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
initStrElt initStr[] = {
|
||||
{"user", "Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98)"},
|
||||
{"footer",
|
||||
"<!-- Mirrored from %s%s by HTTrack Website Copier/3.x [XR&CO'2013], %s -->"},
|
||||
"<!-- Mirrored from %s%s by HTTrack Website Copier/3.x [XR&CO'2014], %s -->"},
|
||||
{"url2", "+*.png +*.gif +*.jpg +*.jpeg +*.css +*.js -ad.doubleclick.net/*"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
@@ -936,7 +904,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
&& (n = (pos - str)) && n < 1024) {
|
||||
char name_[1024 + 2];
|
||||
char *name = name_;
|
||||
char *langstr = NULL;
|
||||
const char *langstr = NULL;
|
||||
int p;
|
||||
int format = 0;
|
||||
int listDefault = 0;
|
||||
@@ -964,7 +932,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
if (pos2 != NULL) {
|
||||
*pos2 = '\0';
|
||||
if (strstr(name, "..") == NULL) {
|
||||
if (fexist(fconcat(catbuff, path, name))) {
|
||||
if (fexist(fconcat(catbuff, sizeof(catbuff), path, name))) {
|
||||
langstr = pos2 + 1;
|
||||
}
|
||||
}
|
||||
@@ -994,20 +962,20 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
}
|
||||
} else if (strcmp(name, "if-file-exists") == 0) {
|
||||
if (strstr(pos2, "..") == NULL) {
|
||||
if (!fexist(fconcat(catbuff, path, pos2))) {
|
||||
if (!fexist(fconcat(catbuff, sizeof(catbuff), path, pos2))) {
|
||||
outputmode = -1;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(name, "if-project-file-exists") == 0) {
|
||||
if (strstr(pos2, "..") == NULL) {
|
||||
if (!fexist
|
||||
(fconcat(catbuff, StringBuff(fspath), pos2))) {
|
||||
(fconcat(catbuff, sizeof(catbuff), StringBuff(fspath), pos2))) {
|
||||
outputmode = -1;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(name, "if-file-do-not-exists") == 0) {
|
||||
if (strstr(pos2, "..") == NULL) {
|
||||
if (fexist(fconcat(catbuff, path, pos2))) {
|
||||
if (fexist(fconcat(catbuff, sizeof(catbuff), path, pos2))) {
|
||||
outputmode = -1;
|
||||
}
|
||||
}
|
||||
@@ -1171,8 +1139,8 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
if (langstr == NULL) {
|
||||
if (strfield2(name, "#iso")) {
|
||||
langstr = line2;
|
||||
langstr[0] = '\0';
|
||||
LANG_LIST(path, langstr);
|
||||
line2[0] = '\0';
|
||||
LANG_LIST(path, line2, sizeof(line2));
|
||||
assertf(strlen(langstr) < sizeof(line2) - 2);
|
||||
} else {
|
||||
langstr = LANGSEL(name);
|
||||
@@ -1191,7 +1159,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
switch (format) {
|
||||
case 0:
|
||||
{
|
||||
char *a = langstr;
|
||||
const char *a = langstr;
|
||||
|
||||
while(*a) {
|
||||
if (a[0] == '\\' && isxdigit(a[1])
|
||||
@@ -1237,7 +1205,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
default:
|
||||
if (*langstr) {
|
||||
int id = 1;
|
||||
char *fstr = langstr;
|
||||
const char *fstr = langstr;
|
||||
|
||||
StringClear(tmpbuff);
|
||||
if (format == 2) {
|
||||
@@ -1443,6 +1411,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
|
||||
int htslang_init(void) {
|
||||
if (NewLangList == NULL) {
|
||||
NewLangList = inthash_new(0);
|
||||
inthash_set_name(NewLangList, "NewLangList");
|
||||
if (NewLangList == NULL) {
|
||||
abortLog("Error in lang.h: not enough memory");
|
||||
} else {
|
||||
@@ -1459,24 +1428,25 @@ int htslang_uninit(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smallserver_setkey(char *key, char *value) {
|
||||
int smallserver_setkey(const char *key, const char *value) {
|
||||
return inthash_write(NewLangList, key, (intptr_t) strdup(value));
|
||||
}
|
||||
int smallserver_setkeyint(char *key, LLint value) {
|
||||
|
||||
int smallserver_setkeyint(const char *key, LLint value) {
|
||||
char tmp[256];
|
||||
|
||||
sprintf(tmp, LLintP, value);
|
||||
snprintf(tmp, sizeof(tmp), LLintP, value);
|
||||
return inthash_write(NewLangList, key, (intptr_t) strdup(tmp));
|
||||
}
|
||||
int smallserver_setkeyarr(char *key, int id, char *key2, char *value) {
|
||||
int smallserver_setkeyarr(const char *key, int id, const char *key2, const char *value) {
|
||||
char tmp[256];
|
||||
|
||||
sprintf(tmp, "%s%d%s", key, id, key2);
|
||||
snprintf(tmp, sizeof(tmp), "%s%d%s", key, id, key2);
|
||||
return inthash_write(NewLangList, tmp, (intptr_t) strdup(value));
|
||||
}
|
||||
|
||||
static int htslang_load(char *limit_to, char *path) {
|
||||
char *hashname;
|
||||
static int htslang_load(char *limit_to, const char *path) {
|
||||
const char *hashname;
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
|
||||
//
|
||||
@@ -1487,6 +1457,8 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
LANG_DELETE();
|
||||
NewLangStr = inthash_new(0);
|
||||
NewLangStrKeys = inthash_new(0);
|
||||
inthash_set_name(NewLangStr, "NewLangStr");
|
||||
inthash_set_name(NewLangStrKeys, "NewLangStrKeys");
|
||||
if ((NewLangStr == NULL) || (NewLangStrKeys == NULL)) {
|
||||
abortLog("Error in lang.h: not enough memory");
|
||||
} else {
|
||||
@@ -1498,7 +1470,7 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
/* Load master file (list of keys and internal keys) */
|
||||
if (!limit_to) {
|
||||
char *mname = "lang.def";
|
||||
FILE *fp = fopen(fconcat(catbuff, path, mname), "rb");
|
||||
FILE *fp = fopen(fconcat(catbuff, sizeof(catbuff), path, mname), "rb");
|
||||
|
||||
if (fp) {
|
||||
char intkey[8192];
|
||||
@@ -1508,7 +1480,7 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
linput_cpp(fp, intkey, 8000);
|
||||
linput_cpp(fp, key, 8000);
|
||||
if (strnotempty(intkey) && strnotempty(key)) {
|
||||
char *test = LANGINTKEY(key);
|
||||
const char *test = LANGINTKEY(key);
|
||||
|
||||
/* Increment for multiple definitions */
|
||||
if (strnotempty(test)) {
|
||||
@@ -1579,7 +1551,7 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
hashname = LANGINTKEY(name);
|
||||
}
|
||||
sprintf(lbasename, "lang/%s.txt", hashname);
|
||||
fp = fopen(fconcat(catbuff, path, lbasename), "rb");
|
||||
fp = fopen(fconcat(catbuff, sizeof(catbuff), path, lbasename), "rb");
|
||||
if (fp) {
|
||||
char extkey[8192];
|
||||
char value[8192];
|
||||
@@ -1590,7 +1562,7 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
if (strnotempty(extkey) && strnotempty(value)) {
|
||||
int len;
|
||||
char *buff;
|
||||
char *intkey;
|
||||
const char *intkey;
|
||||
|
||||
intkey = LANGINTKEY(extkey);
|
||||
|
||||
@@ -1598,7 +1570,7 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
|
||||
/* Increment for multiple definitions */
|
||||
{
|
||||
char *test = LANGSEL(intkey);
|
||||
const char *test = LANGSEL(intkey);
|
||||
|
||||
if (strnotempty(test)) {
|
||||
if (loops == 0) {
|
||||
@@ -1652,7 +1624,7 @@ static int htslang_load(char *limit_to, char *path) {
|
||||
}
|
||||
|
||||
/* NOTE : also contains the "webhttrack" hack */
|
||||
static void conv_printf(char *from, char *to) {
|
||||
static void conv_printf(const char *from, char *to) {
|
||||
int i = 0, j = 0, len;
|
||||
|
||||
len = (int) strlen(from);
|
||||
@@ -1726,7 +1698,7 @@ static void LANG_DELETE(void) {
|
||||
}
|
||||
|
||||
// sélection de la langue
|
||||
static void LANG_INIT(char *path) {
|
||||
static void LANG_INIT(const char *path) {
|
||||
//CWinApp* pApp = AfxGetApp();
|
||||
//if (pApp) {
|
||||
/* pApp->GetProfileInt("Language","IntId",0); */
|
||||
@@ -1734,7 +1706,7 @@ static void LANG_INIT(char *path) {
|
||||
//}
|
||||
}
|
||||
|
||||
static int LANG_T(char *path, int l) {
|
||||
static int LANG_T(const char *path, int l) {
|
||||
if (l >= 0) {
|
||||
QLANG_T(l);
|
||||
htslang_load(NULL, path);
|
||||
@@ -1742,7 +1714,7 @@ static int LANG_T(char *path, int l) {
|
||||
return QLANG_T(-1); // 0=default (english)
|
||||
}
|
||||
|
||||
static int LANG_SEARCH(char *path, char *iso) {
|
||||
static int LANG_SEARCH(const char *path, const char *iso) {
|
||||
char lang_str[1024];
|
||||
int i = 0;
|
||||
int curr_lng = LANG_T(path, -1);
|
||||
@@ -1761,7 +1733,7 @@ static int LANG_SEARCH(char *path, char *iso) {
|
||||
return found;
|
||||
}
|
||||
|
||||
static int LANG_LIST(char *path, char *buffer) {
|
||||
static int LANG_LIST(const char *path, char *buffer, size_t size) {
|
||||
char lang_str[1024];
|
||||
int i = 0;
|
||||
int curr_lng = LANG_T(path, -1);
|
||||
@@ -1769,7 +1741,7 @@ static int LANG_LIST(char *path, char *buffer) {
|
||||
buffer[0] = '\0';
|
||||
do {
|
||||
QLANG_T(i);
|
||||
strcpybuff(lang_str, "LANGUAGE_NAME");
|
||||
strlcpybuff(lang_str, "LANGUAGE_NAME", size);
|
||||
htslang_load(lang_str, path);
|
||||
if (strlen(lang_str) > 0) {
|
||||
if (buffer[0])
|
||||
@@ -1791,28 +1763,26 @@ static int QLANG_T(int l) {
|
||||
return lng; // 0=default (english)
|
||||
}
|
||||
|
||||
static char *LANGSEL(char *name) {
|
||||
intptr_t adr = 0;
|
||||
|
||||
if (NewLangStr)
|
||||
if (!inthash_read(NewLangStr, name, &adr))
|
||||
adr = 0;
|
||||
if (adr) {
|
||||
return (char *) adr;
|
||||
const char* LANGSEL(const char* name) {
|
||||
inthash_value value;
|
||||
if (NewLangStr != NULL
|
||||
&& inthash_read_value(NewLangStr, name, &value) != 0
|
||||
&& value.ptr != NULL) {
|
||||
return (char*) value.ptr;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static char *LANGINTKEY(char *name) {
|
||||
intptr_t adr = 0;
|
||||
|
||||
if (NewLangStrKeys)
|
||||
if (!inthash_read(NewLangStrKeys, name, &adr))
|
||||
adr = 0;
|
||||
if (adr) {
|
||||
return (char *) adr;
|
||||
const char* LANGINTKEY(const char* name) {
|
||||
inthash_value value;
|
||||
if (NewLangStrKeys != NULL
|
||||
&& inthash_read_value(NewLangStrKeys, name, &value) != 0
|
||||
&& value.ptr != NULL) {
|
||||
return (char*) value.ptr;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/* *** Various functions *** */
|
||||
@@ -1845,7 +1815,7 @@ static int check_readinput(htsblk * r) {
|
||||
FD_SET(r->soc, &fds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
select(r->soc + 1, &fds, NULL, NULL, &tv);
|
||||
select((int) r->soc + 1, &fds, NULL, NULL, &tv);
|
||||
if (FD_ISSET(r->soc, &fds))
|
||||
return 1;
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -91,9 +91,9 @@ extern httrackp *global_opt;
|
||||
#define min(a,b) ((a)>(b)?(b):(a))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
extern int smallserver_setkey(char *key, char *value);
|
||||
extern int smallserver_setkeyint(char *key, LLint value);
|
||||
extern int smallserver_setkeyarr(char *key, int id, char *key2, char *value);
|
||||
extern int smallserver_setkey(const char *key, const char *value);
|
||||
extern int smallserver_setkeyint(const char *key, LLint value);
|
||||
extern int smallserver_setkeyarr(const char *key, int id, const char *key2, const char *value);
|
||||
|
||||
int htslang_init(void);
|
||||
int htslang_uninit(void);
|
||||
@@ -147,7 +147,7 @@ HTS_UNUSED static int check_readinput_t(T_SOC soc, int timeout) {
|
||||
FD_SET(soc, &fds);
|
||||
tv.tv_sec = timeout;
|
||||
tv.tv_usec = 0;
|
||||
select(soc + 1, &fds, NULL, NULL, &tv);
|
||||
select((int) soc + 1, &fds, NULL, NULL, &tv);
|
||||
if (FD_ISSET(soc, &fds))
|
||||
return 1;
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -36,6 +36,7 @@ Please visit our Website: http://www.httrack.com
|
||||
#include "htsglobal.h"
|
||||
#include "htsbase.h"
|
||||
#include "htsthread.h"
|
||||
#include "httrack-library.h"
|
||||
|
||||
#if USE_BEGINTHREAD
|
||||
#ifdef _WIN32
|
||||
@@ -196,7 +197,7 @@ HTSEXT_API void hts_mutexlock(htsmutex * mutex) {
|
||||
}
|
||||
assertf(*mutex != NULL);
|
||||
#ifdef _WIN32
|
||||
assert((*mutex)->handle != NULL);
|
||||
assertf((*mutex)->handle != NULL);
|
||||
WaitForSingleObject((*mutex)->handle, INFINITE);
|
||||
#else
|
||||
pthread_mutex_lock(&(*mutex)->handle);
|
||||
@@ -206,7 +207,7 @@ HTSEXT_API void hts_mutexlock(htsmutex * mutex) {
|
||||
HTSEXT_API void hts_mutexrelease(htsmutex * mutex) {
|
||||
assertf(mutex != NULL && *mutex != NULL);
|
||||
#ifdef _WIN32
|
||||
assert((*mutex)->handle != NULL);
|
||||
assertf((*mutex)->handle != NULL);
|
||||
ReleaseMutex((*mutex)->handle);
|
||||
#else
|
||||
pthread_mutex_unlock(&(*mutex)->handle);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -64,9 +64,6 @@ struct htsmutex_s {
|
||||
/* Library internal definictions */
|
||||
HTSEXT_API int hts_newthread(void (*fun) (void *arg), void *arg);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API void htsthread_wait(void);
|
||||
#endif
|
||||
HTSEXT_API void htsthread_wait_n(int n_wait);
|
||||
|
||||
/* Locking functions */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -68,16 +68,16 @@ struct find_handle_struct {
|
||||
char path[2048];
|
||||
};
|
||||
#endif
|
||||
#ifndef HTS_DEF_FWSTRUCT_topindex_chain
|
||||
#define HTS_DEF_FWSTRUCT_topindex_chain
|
||||
typedef struct topindex_chain topindex_chain;
|
||||
#endif
|
||||
struct topindex_chain {
|
||||
int level; /* sort level */
|
||||
char *category; /* category */
|
||||
char name[2048]; /* path */
|
||||
struct topindex_chain *next; /* next element */
|
||||
};
|
||||
//#ifndef HTS_DEF_FWSTRUCT_topindex_chain
|
||||
//#define HTS_DEF_FWSTRUCT_topindex_chain
|
||||
//typedef struct topindex_chain topindex_chain;
|
||||
//#endif
|
||||
//struct topindex_chain {
|
||||
// int level; /* sort level */
|
||||
// char *category; /* category */
|
||||
// char name[2048]; /* path */
|
||||
// struct topindex_chain *next; /* next element */
|
||||
//};
|
||||
|
||||
/* Tools */
|
||||
|
||||
@@ -541,11 +541,11 @@ int verif_backblue(httrackp * opt, const char *base) {
|
||||
return 0;
|
||||
}
|
||||
if ((!*done)
|
||||
|| (fsize_utf8(fconcat(OPT_GET_BUFF(opt), base, "backblue.gif")) !=
|
||||
|| (fsize_utf8(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "backblue.gif")) !=
|
||||
HTS_DATA_BACK_GIF_LEN)) {
|
||||
FILE *fp =
|
||||
filecreate(&opt->state.strc,
|
||||
fconcat(OPT_GET_BUFF(opt), base, "backblue.gif"));
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "backblue.gif"));
|
||||
*done = 1;
|
||||
if (fp) {
|
||||
if (fwrite(HTS_DATA_BACK_GIF, HTS_DATA_BACK_GIF_LEN, 1, fp) !=
|
||||
@@ -553,19 +553,19 @@ int verif_backblue(httrackp * opt, const char *base) {
|
||||
ret = 1;
|
||||
fclose(fp);
|
||||
usercommand(opt, 0, NULL,
|
||||
fconcat(OPT_GET_BUFF(opt), base, "backblue.gif"), "", "");
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "backblue.gif"), "", "");
|
||||
} else
|
||||
ret = 1;
|
||||
//
|
||||
fp =
|
||||
filecreate(&opt->state.strc,
|
||||
fconcat(OPT_GET_BUFF(opt), base, "fade.gif"));
|
||||
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "fade.gif"));
|
||||
if (fp) {
|
||||
if (fwrite(HTS_DATA_FADE_GIF, HTS_DATA_FADE_GIF_LEN, 1, fp) !=
|
||||
HTS_DATA_FADE_GIF_LEN)
|
||||
ret = 1;
|
||||
fclose(fp);
|
||||
usercommand(opt, 0, NULL, fconcat(OPT_GET_BUFF(opt), base, "fade.gif"),
|
||||
usercommand(opt, 0, NULL, fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "fade.gif"),
|
||||
"", "");
|
||||
} else
|
||||
ret = 1;
|
||||
@@ -758,7 +758,7 @@ static int sortTopIndexFnc(const void *a_, const void *b_) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
HTSEXT_API char *hts_getcategory(const char *filename);
|
||||
//HTSEXT_API char *hts_getcategory(const char *filename);
|
||||
|
||||
/* Note: NOT utf-8 */
|
||||
HTSEXT_API int hts_buildtopindex(httrackp * opt, const char *path,
|
||||
@@ -772,16 +772,16 @@ HTSEXT_API int hts_buildtopindex(httrackp * opt, const char *path,
|
||||
|
||||
// et templates html
|
||||
toptemplate_header =
|
||||
readfile_or(fconcat(catbuff, binpath, "templates/topindex-header.html"),
|
||||
readfile_or(fconcat(catbuff, sizeof(catbuff), binpath, "templates/topindex-header.html"),
|
||||
HTS_INDEX_HEADER);
|
||||
toptemplate_body =
|
||||
readfile_or(fconcat(catbuff, binpath, "templates/topindex-body.html"),
|
||||
readfile_or(fconcat(catbuff, sizeof(catbuff), binpath, "templates/topindex-body.html"),
|
||||
HTS_INDEX_BODY);
|
||||
toptemplate_bodycat =
|
||||
readfile_or(fconcat(catbuff, binpath, "templates/topindex-bodycat.html"),
|
||||
readfile_or(fconcat(catbuff, sizeof(catbuff), binpath, "templates/topindex-bodycat.html"),
|
||||
HTS_INDEX_BODYCAT);
|
||||
toptemplate_footer =
|
||||
readfile_or(fconcat(catbuff, binpath, "templates/topindex-footer.html"),
|
||||
readfile_or(fconcat(catbuff, sizeof(catbuff), binpath, "templates/topindex-footer.html"),
|
||||
HTS_INDEX_FOOTER);
|
||||
|
||||
if (toptemplate_header && toptemplate_body && toptemplate_footer
|
||||
@@ -793,11 +793,11 @@ HTSEXT_API int hts_buildtopindex(httrackp * opt, const char *path,
|
||||
rpath[strlen(rpath) - 1] = '\0';
|
||||
}
|
||||
|
||||
fpo = fopen(fconcat(catbuff, rpath, "/index.html"), "wb");
|
||||
fpo = fopen(fconcat(catbuff, sizeof(catbuff), rpath, "/index.html"), "wb");
|
||||
if (fpo) {
|
||||
find_handle h;
|
||||
|
||||
verif_backblue(opt, concat(catbuff, rpath, "/")); // générer gif
|
||||
verif_backblue(opt, concat(catbuff, sizeof(catbuff), rpath, "/")); // générer gif
|
||||
// Header
|
||||
fprintf(fpo, toptemplate_header,
|
||||
"<!-- Mirror and index made by HTTrack Website Copier/"
|
||||
@@ -887,8 +887,7 @@ HTSEXT_API int hts_buildtopindex(httrackp * opt, const char *path,
|
||||
for(i = 0; i < chainSize; i++) {
|
||||
char BIGSTK hname[HTS_URLMAXSIZE * 2];
|
||||
|
||||
strcpybuff(hname, sortedElts[i]->name);
|
||||
escape_uri_utf(hname);
|
||||
escape_uri_utf(sortedElts[i]->name, hname, sizeof(hname));
|
||||
|
||||
/* Changed category */
|
||||
if (strcmp(category, sortedElts[i]->category) != 0) {
|
||||
@@ -981,6 +980,7 @@ HTSEXT_API char *hts_getcategories(char *path, int type) {
|
||||
|
||||
if (type == 1) {
|
||||
hashCateg = inthash_new(0);
|
||||
inthash_set_name(hashCateg, "hashCateg");
|
||||
StringCat(categ, "Test category 1");
|
||||
StringCat(categ, "\r\nTest category 2");
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ HTSEXT_API int hts_findnext(find_handle find) {
|
||||
if ((find->dirp = readdir(find->hdir)))
|
||||
if (find->dirp->d_name)
|
||||
if (!STAT
|
||||
(concat(catbuff, find->path, find->dirp->d_name), &find->filestat))
|
||||
(concat(catbuff, sizeof(catbuff), find->path, find->dirp->d_name), &find->filestat))
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -106,11 +106,6 @@ HTSEXT_API int hts_findisdir(find_handle find);
|
||||
HTSEXT_API int hts_findisfile(find_handle find);
|
||||
HTSEXT_API int hts_findissystem(find_handle find);
|
||||
|
||||
#ifndef HTTRACK_DEFLIB
|
||||
HTSEXT_API char *hts_getcategory(const char *filename);
|
||||
HTSEXT_API char *hts_getcategories(char *path, int type);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -61,7 +61,6 @@ Please visit our Website: http://www.httrack.com
|
||||
#include "htsinthash.c"
|
||||
#include "htsmd5.c"
|
||||
#include "md5.c"
|
||||
#undef HTS_PRINTF_FUN
|
||||
|
||||
#include "htsserver.h"
|
||||
#include "htsweb.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -49,8 +49,8 @@ typedef struct httrackp httrackp;
|
||||
HTSEXT_API int htswrap_init(void); // LEGACY
|
||||
HTSEXT_API int htswrap_free(void); // LEGACY
|
||||
|
||||
HTSEXT_API int htswrap_add(httrackp * opt, const char *name, void *fct);
|
||||
HTSEXT_API uintptr_t htswrap_read(httrackp * opt, const char *name);
|
||||
//HTSEXT_API int htswrap_add(httrackp * opt, const char *name, void *fct);
|
||||
//HTSEXT_API uintptr_t htswrap_read(httrackp * opt, const char *name);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -57,13 +57,14 @@ int hts_zunpack(char *filename, char *newfile) {
|
||||
if (filename != NULL && newfile != NULL) {
|
||||
if (filename[0] && newfile[0]) {
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
FILE *const in = FOPEN(fconv(catbuff, filename), "rb");
|
||||
FILE *const in = FOPEN(fconv(catbuff, sizeof(catbuff), filename), "rb");
|
||||
const int fd = in != NULL ? fileno(in) : -1;
|
||||
const int dup_fd = fd != -1 ? dup(fd) : -1;
|
||||
// Note: we must dup to be able to flose cleanly.
|
||||
gzFile gz = fd != -1 ? gzdopen(dup(fd), "rb") : NULL;
|
||||
const gzFile gz = dup_fd != -1 ? gzdopen(dup_fd, "rb") : NULL;
|
||||
|
||||
if (gz) {
|
||||
FILE *const fpout = FOPEN(fconv(catbuff, newfile), "wb");
|
||||
FILE *const fpout = FOPEN(fconv(catbuff, sizeof(catbuff), newfile), "wb");
|
||||
int size = 0;
|
||||
|
||||
if (fpout) {
|
||||
@@ -95,8 +96,8 @@ int hts_zunpack(char *filename, char *newfile) {
|
||||
|
||||
int hts_extract_meta(const char *path) {
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
unzFile zFile = unzOpen(fconcat(catbuff, path, "hts-cache/new.zip"));
|
||||
zipFile zFileOut = zipOpen(fconcat(catbuff, path, "hts-cache/meta.zip"), 0);
|
||||
unzFile zFile = unzOpen(fconcat(catbuff, sizeof(catbuff), path, "hts-cache/new.zip"));
|
||||
zipFile zFileOut = zipOpen(fconcat(catbuff, sizeof(catbuff), path, "hts-cache/meta.zip"), 0);
|
||||
|
||||
if (zFile != NULL && zFileOut != NULL) {
|
||||
if (unzGoToFirstFile(zFile) == Z_OK) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -35,6 +35,11 @@ Please visit our Website: http://www.httrack.com
|
||||
|
||||
#include "htsglobal.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef HTS_DEF_FWSTRUCT_httrackp
|
||||
#define HTS_DEF_FWSTRUCT_httrackp
|
||||
typedef struct httrackp httrackp;
|
||||
@@ -61,6 +66,12 @@ typedef enum hts_log_type {
|
||||
typedef struct hts_stat_struct hts_stat_struct;
|
||||
#endif
|
||||
|
||||
/** Assert error callback. **/
|
||||
#ifndef HTS_DEF_FWSTRUCT_htsErrorCallback
|
||||
#define HTS_DEF_FWSTRUCT_htsErrorCallback
|
||||
typedef void (*htsErrorCallback) (const char *msg, const char *file, int line);
|
||||
#endif
|
||||
|
||||
/* Helpers for plugging callbacks
|
||||
requires: htsdefines.h */
|
||||
|
||||
@@ -103,14 +114,22 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt);
|
||||
/* Options handling */
|
||||
HTSEXT_API httrackp *hts_create_opt(void);
|
||||
HTSEXT_API void hts_free_opt(httrackp * opt);
|
||||
HTSEXT_API void set_wrappers(httrackp * opt); // DEPRECATED - DUMMY FUNCTION
|
||||
HTSEXT_API const hts_stat_struct* hts_get_stats(httrackp * opt);
|
||||
HTSEXT_API void set_wrappers(httrackp * opt); /* LEGACY */
|
||||
HTSEXT_API int plug_wrapper(httrackp * opt, const char *moduleName,
|
||||
const char *argv);
|
||||
HTSEXT_API void hts_set_error_callback(htsErrorCallback handler);
|
||||
HTSEXT_API htsErrorCallback hts_get_error_callback(void);
|
||||
|
||||
/* Logging */
|
||||
HTSEXT_API int hts_log(httrackp * opt, const char *prefix, const char *msg);
|
||||
HTSEXT_API void hts_log_print(httrackp * opt, int type, const char *format,
|
||||
...);
|
||||
...) HTS_PRINTF_FUN(3, 4);
|
||||
HTSEXT_API void hts_log_vprint(httrackp * opt, int type, const char *format,
|
||||
va_list args);
|
||||
HTSEXT_API void hts_set_log_vprint_callback(void (*callback)(httrackp * opt,
|
||||
int type,
|
||||
const char *format, va_list args));
|
||||
|
||||
/* Infos */
|
||||
HTSEXT_API const char *hts_get_version_info(httrackp * opt);
|
||||
@@ -122,22 +141,22 @@ HTSEXT_API const hts_stat_struct* hts_get_stats(httrackp * opt);
|
||||
HTSEXT_API int htswrap_init(void); // DEPRECATED - DUMMY FUNCTION
|
||||
HTSEXT_API int htswrap_free(void); // DEPRECATED - DUMMY FUNCTION
|
||||
HTSEXT_API int htswrap_add(httrackp * opt, const char *name, void *fct);
|
||||
HTSEXT_API unsigned long int htswrap_read(httrackp * opt, const char *name);
|
||||
HTSEXT_API uintptr_t htswrap_read(httrackp * opt, const char *name);
|
||||
HTSEXT_API int htswrap_set_userdef(httrackp * opt, void *userdef);
|
||||
HTSEXT_API void *htswrap_get_userdef(httrackp * opt);
|
||||
|
||||
/* Internal library allocators, if a different libc is being used by the client */
|
||||
HTSEXT_API char *hts_strdup(const char *string);
|
||||
HTSEXT_API void *hts_malloc(size_t size);
|
||||
HTSEXT_API void *hts_realloc(void *data, size_t size);
|
||||
HTSEXT_API void *hts_realloc(void *const data, const size_t size);
|
||||
HTSEXT_API void hts_free(void *data);
|
||||
|
||||
/* Other functions */
|
||||
HTSEXT_API int hts_resetvar(void); // DEPRECATED - DUMMY FUNCTION
|
||||
HTSEXT_API int hts_buildtopindex(httrackp * opt, const char *path,
|
||||
const char *binpath);
|
||||
HTSEXT_API const char *hts_getcategories(const char *path, int type);
|
||||
HTSEXT_API const char *hts_getcategory(const char *filename);
|
||||
HTSEXT_API char *hts_getcategories(char *path, int type);
|
||||
HTSEXT_API char *hts_getcategory(const char *filename);
|
||||
|
||||
/* Catch-URL */
|
||||
HTSEXT_API T_SOC catch_url_init_std(int *port_prox, char *adr_prox);
|
||||
@@ -150,11 +169,12 @@ HTSEXT_API int hts_is_testing(httrackp * opt);
|
||||
HTSEXT_API int hts_is_exiting(httrackp * opt);
|
||||
|
||||
/*HTSEXT_API int hts_setopt(httrackp* opt); DEPRECATED ; see copy_htsopt() */
|
||||
|
||||
HTSEXT_API int hts_addurl(httrackp * opt, char **url);
|
||||
HTSEXT_API int hts_resetaddurl(httrackp * opt);
|
||||
HTSEXT_API int copy_htsopt(httrackp * from, httrackp * to);
|
||||
HTSEXT_API int copy_htsopt(const httrackp * from, httrackp * to);
|
||||
HTSEXT_API char *hts_errmsg(httrackp * opt);
|
||||
HTSEXT_API int hts_setpause(httrackp * opt, int); // pause transfer
|
||||
HTSEXT_API int hts_setpause(httrackp * opt, int);
|
||||
HTSEXT_API int hts_request_stop(httrackp * opt, int force);
|
||||
HTSEXT_API int hts_cancel_file_push(httrackp * opt, const char *url);
|
||||
HTSEXT_API void hts_cancel_test(httrackp * opt);
|
||||
@@ -164,46 +184,68 @@ HTSEXT_API void hts_cancel_parsing(httrackp * opt);
|
||||
|
||||
/* Tools */
|
||||
HTSEXT_API int structcheck(const char *path);
|
||||
HTSEXT_API int structcheck_utf8(const char *path);
|
||||
HTSEXT_API int dir_exists(const char *path);
|
||||
HTSEXT_API void infostatuscode(char *msg, int statuscode);
|
||||
HTSEXT_API HTS_INLINE TStamp mtime_local(void);
|
||||
HTSEXT_API TStamp mtime_local(void);
|
||||
HTSEXT_API void qsec2str(char *st, TStamp t);
|
||||
HTSEXT_API char *int2char(strc_int2bytes2 * strc, int n);
|
||||
HTSEXT_API char *int2bytes(strc_int2bytes2 * strc, LLint n);
|
||||
HTSEXT_API char *int2bytessec(strc_int2bytes2 * strc, long int n);
|
||||
HTSEXT_API char **int2bytes2(strc_int2bytes2 * strc, LLint n);
|
||||
HTSEXT_API char *jump_identification(char *);
|
||||
HTSEXT_API char *jump_normalized(char *);
|
||||
HTSEXT_API char *jump_toport(char *);
|
||||
HTSEXT_API char *fil_normalized(char *source, char *dest);
|
||||
HTSEXT_API char *adr_normalized(char *source, char *dest);
|
||||
HTSEXT_API char *jump_identification(const char *);
|
||||
HTSEXT_API char *jump_normalized(const char *);
|
||||
HTSEXT_API char *jump_toport(const char *);
|
||||
HTSEXT_API char *fil_normalized(const char *source, char *dest);
|
||||
HTSEXT_API char *adr_normalized(const char *source, char *dest);
|
||||
HTSEXT_API char *hts_rootdir(char *file);
|
||||
|
||||
/* Escaping URLs */
|
||||
HTSEXT_API void unescape_amp(char *s);
|
||||
HTSEXT_API void escape_spc_url(char *s);
|
||||
HTSEXT_API void escape_in_url(char *s);
|
||||
HTSEXT_API void escape_uri(char *s);
|
||||
HTSEXT_API void escape_uri_utf(char *s);
|
||||
HTSEXT_API void escape_check_url(char *s);
|
||||
HTSEXT_API char *escape_check_url_addr(char *s);
|
||||
HTSEXT_API void x_escape_http(char *s, int mode);
|
||||
HTSEXT_API char *unescape_http(char *catbuff, const char *s);
|
||||
HTSEXT_API char *unescape_http_unharm(char *catbuff, const char *s,
|
||||
int no_high);
|
||||
|
||||
HTSEXT_API size_t escape_spc_url(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t escape_in_url(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t escape_uri(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t escape_uri_utf(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t escape_check_url(const char *const src, char *const dest, const size_t size);
|
||||
|
||||
HTSEXT_API size_t append_escape_spc_url(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t append_escape_in_url(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t append_escape_uri(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t append_escape_uri_utf(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t append_escape_check_url(const char *const src, char *const dest, const size_t size);
|
||||
|
||||
HTSEXT_API size_t inplace_escape_spc_url(char *const dest, const size_t size);
|
||||
HTSEXT_API size_t inplace_escape_in_url(char *const dest, const size_t size);
|
||||
HTSEXT_API size_t inplace_escape_uri(char *const dest, const size_t size);
|
||||
HTSEXT_API size_t inplace_escape_uri_utf(char *const dest, const size_t size);
|
||||
HTSEXT_API size_t inplace_escape_check_url(char *const dest, const size_t size);
|
||||
|
||||
HTSEXT_API char *escape_check_url_addr(const char *const src, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t make_content_id(const char *const adr, const char *const fil, char *const dest, const size_t size);
|
||||
|
||||
HTSEXT_API size_t x_escape_http(const char *const s, char *const dest, const size_t max_size, const int mode);
|
||||
HTSEXT_API void escape_remove_control(char *const s);
|
||||
HTSEXT_API size_t escape_for_html_print(const char *const s, char *const dest, const size_t size);
|
||||
HTSEXT_API size_t escape_for_html_print_full(const char *const s, char *const dest, const size_t size);
|
||||
|
||||
HTSEXT_API char *unescape_http(char *const catbuff, const size_t size, const char *const s);
|
||||
HTSEXT_API char *unescape_http_unharm(char *const catbuff, const size_t size, const char *s, const int no_high);
|
||||
HTSEXT_API char *antislash_unescaped(char *catbuff, const char *s);
|
||||
|
||||
HTSEXT_API void escape_remove_control(char *s);
|
||||
HTSEXT_API void get_httptype(httrackp * opt, char *s, const char *fil,
|
||||
int flag);
|
||||
HTSEXT_API int is_knowntype(httrackp * opt, const char *fil);
|
||||
HTSEXT_API int is_userknowntype(httrackp * opt, const char *fil);
|
||||
HTSEXT_API int is_dyntype(const char *fil);
|
||||
HTSEXT_API char *get_ext(char *catbuff, const char *fil);
|
||||
HTSEXT_API char *get_ext(char *catbuff, size_t size, const char *fil);
|
||||
|
||||
/* Ugly string tools */
|
||||
HTSEXT_API char *concat(char *catbuff, const char *a, const char *b);
|
||||
HTSEXT_API char *fconcat(char *catbuff, const char *a, const char *b);
|
||||
HTSEXT_API char *fconv(char *catbuff, const char *a);
|
||||
HTSEXT_API char *concat(char *catbuff, size_t size, const char *a, const char *b);
|
||||
HTSEXT_API char *fconcat(char *catbuff, size_t size, const char *a, const char *b);
|
||||
HTSEXT_API char *fconv(char *catbuff, size_t size, const char *a);
|
||||
HTSEXT_API char *fslash(char *catbuff, size_t size, const char *a);
|
||||
|
||||
/* Debugging */
|
||||
HTSEXT_API void hts_debug(int level);
|
||||
@@ -273,4 +315,19 @@ typedef struct utimbuf STRUCT_UTIMBUF;
|
||||
#define HTS_DEF_FILEAPI
|
||||
#endif
|
||||
|
||||
/** Macro aimed to break at build-time if a size is not a sizeof() strictly
|
||||
* greater than sizeof(char*). **/
|
||||
#undef COMPILE_TIME_CHECK_SIZE
|
||||
#define COMPILE_TIME_CHECK_SIZE(A) (void) ((void (*)(char[A - sizeof(char*) - 1])) NULL)
|
||||
|
||||
/** Macro aimed to break at compile-time if a size is not a sizeof() strictly
|
||||
* greater than sizeof(char*). **/
|
||||
#undef RUNTIME_TIME_CHECK_SIZE
|
||||
#define RUNTIME_TIME_CHECK_SIZE(A) assertf((A) != sizeof(void*))
|
||||
|
||||
#define fconv(A,B,C) (COMPILE_TIME_CHECK_SIZE(B), fconv(A,B,C))
|
||||
#define concat(A,B,C,D) (COMPILE_TIME_CHECK_SIZE(B), concat(A,B,C,D))
|
||||
#define fconcat(A,B,C,D) (COMPILE_TIME_CHECK_SIZE(B), fconcat(A,B,C,D))
|
||||
#define fslash(A,B,C) (COMPILE_TIME_CHECK_SIZE(B), fslash(A,B,C))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
161
src/httrack.h
161
src/httrack.h
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -35,6 +35,7 @@ Please visit our Website: http://www.httrack.com
|
||||
|
||||
#include "htsglobal.h"
|
||||
#include "htscore.h"
|
||||
#include "htssafe.h"
|
||||
|
||||
#ifndef HTS_DEF_FWSTRUCT_t_StatsBuffer
|
||||
#define HTS_DEF_FWSTRUCT_t_StatsBuffer
|
||||
@@ -83,164 +84,6 @@ struct t_InpInfo {
|
||||
int main(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
/* */
|
||||
|
||||
// Engine internal variables
|
||||
typedef void (*htsErrorCallback) (char *msg, char *file, int line);
|
||||
extern HTSEXT_API htsErrorCallback htsCallbackErr;
|
||||
extern HTSEXT_API int htsMemoryFastXfr;
|
||||
|
||||
/* */
|
||||
extern HTSEXT_API hts_stat_struct HTS_STAT;
|
||||
extern int _DEBUG_HEAD;
|
||||
extern FILE *ioinfo;
|
||||
|
||||
// from htsbase.h
|
||||
|
||||
/* protected strcat, strncat and strcpy - definitely useful */
|
||||
#define strcatbuff(A, B) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (htsMemoryFastXfr) { \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strcat(A, B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned int sz = (unsigned int) strlen(A); \
|
||||
unsigned int szf = (unsigned int) strlen(B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf(sz + szf + 1 < sizeof(A)); \
|
||||
if (szf > 0) { \
|
||||
if (sz + szf + 1 < sizeof(A)) { \
|
||||
memcpy((A) + sz, (B), szf + 1); \
|
||||
} \
|
||||
} \
|
||||
} else if (szf > 0) { \
|
||||
memcpybuff((A) + sz, (B), szf + 1); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
#define strncatbuff(A, B, N) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (B) != NULL ); \
|
||||
if (htsMemoryFastXfr) { \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strncat(A, B, N); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned int sz = (unsigned int) strlen(A); \
|
||||
unsigned int szf = (unsigned int) strlen(B); \
|
||||
if (szf > (unsigned int) (N)) szf = (unsigned int) (N); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf(sz + szf + 1 < sizeof(A)); \
|
||||
if (szf > 0) { \
|
||||
if (sz + szf + 1 < sizeof(A)) { \
|
||||
memcpy((A) + sz, (B), szf); \
|
||||
* ( (A) + sz + szf) = '\0'; \
|
||||
} \
|
||||
} \
|
||||
} else if (szf > 0) { \
|
||||
memcpybuff((A) + sz, (B), szf); \
|
||||
* ( (A) + sz + szf) = '\0'; \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
#define strcpybuff(A, B) do { \
|
||||
assertf( (A) != NULL ); \
|
||||
assertf( (const char*) (B) != NULL ); \
|
||||
if (htsMemoryFastXfr) { \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
(A)[sizeof(A) - 1] = '\0'; \
|
||||
} \
|
||||
strcpy(A, B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf((A)[sizeof(A) - 1] == '\0'); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned int szf = (unsigned int) strlen(B); \
|
||||
if (sizeof(A) != sizeof(char*)) { \
|
||||
assertf(szf + 1 < sizeof(A)); \
|
||||
if (szf > 0) { \
|
||||
if (szf + 1 < sizeof(A)) { \
|
||||
memcpy((A), (B), szf + 1); \
|
||||
} else { \
|
||||
* (A) = '\0'; \
|
||||
} \
|
||||
} else { \
|
||||
* (A) = '\0'; \
|
||||
} \
|
||||
} else { \
|
||||
memcpybuff((A), (B), szf + 1); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
// emergency log
|
||||
typedef void (*t_abortLog) (char *msg, char *file, int line);
|
||||
extern HTSEXT_API t_abortLog abortLog__;
|
||||
|
||||
#define abortLog(a) abortLog__(a, __FILE__, __LINE__)
|
||||
#define abortLogFmt(a) do { \
|
||||
FILE* fp = fopen("CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("/tmp/CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("C:\\CRASH.TXT", "wb"); \
|
||||
if (fp) { \
|
||||
fprintf(fp, "HTTrack " HTTRACK_VERSIONID " closed at '" __FILE__ "', line %d\r\n", __LINE__); \
|
||||
fprintf(fp, "Reason:\r\n"); \
|
||||
fprintf(fp, a); \
|
||||
fprintf(fp, "\r\n"); \
|
||||
fflush(fp); \
|
||||
fclose(fp); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define _ ,
|
||||
#define abortLogFmt(a) do { \
|
||||
FILE* fp = fopen("CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("/tmp/CRASH.TXT", "wb"); \
|
||||
if (!fp) fp = fopen("C:\\CRASH.TXT", "wb"); \
|
||||
if (fp) { \
|
||||
fprintf(fp, "HTTrack " HTTRACK_VERSIONID " closed at '" __FILE__ "', line %d\r\n", __LINE__); \
|
||||
fprintf(fp, "Reason:\r\n"); \
|
||||
fprintf(fp, a); \
|
||||
fprintf(fp, "\r\n"); \
|
||||
fflush(fp); \
|
||||
fclose(fp); \
|
||||
} \
|
||||
} while(0)
|
||||
#define assertf(exp) do { \
|
||||
if (! ( exp ) ) { \
|
||||
abortLog("assert failed: " #exp); \
|
||||
if (htsCallbackErr != NULL) { \
|
||||
htsCallbackErr("assert failed: " #exp, __FILE__ , __LINE__ ); \
|
||||
} \
|
||||
assert(exp); \
|
||||
abort(); \
|
||||
} \
|
||||
} while(0)
|
||||
/* non-fatal assert */
|
||||
#define assertnf(exp) do { \
|
||||
if (! ( exp ) ) { \
|
||||
abortLog("assert failed: " #exp); \
|
||||
if (htsCallbackErr != NULL) { \
|
||||
htsCallbackErr("assert failed: " #exp, __FILE__ , __LINE__ ); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
//
|
||||
|
||||
#define malloct(A) malloc(A)
|
||||
#define calloct(A,B) calloc((A), (B))
|
||||
#define freet(A) do { assertnf((A) != NULL); if ((A) != NULL) { free(A); (A) = NULL; } } while(0)
|
||||
#define strdupt(A) strdup(A)
|
||||
#define realloct(A,B) ( ((A) != NULL) ? realloc((A), (B)) : malloc(B) )
|
||||
#define memcpybuff(A, B, N) memcpy((A), (B), (N))
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.3\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.8\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
PreprocessorDefinitions="WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -152,7 +152,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.3\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.8\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
PreprocessorDefinitions="WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -246,7 +246,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm200 "
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.3\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.8\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
@@ -343,7 +343,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm200 "
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.3\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.8\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
@@ -440,7 +440,7 @@
|
||||
AdditionalOptions="/Zm200 "
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.3\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.8\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
@@ -535,7 +535,7 @@
|
||||
AdditionalOptions="/Zm200 "
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.3\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
AdditionalIncludeDirectories=""C:\Dev\zlib-1.2.8\";"C:\Dev\openssl-1.0.1e\include";C:\Dev\Winhttrack"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
|
||||
/* Args */
|
||||
printf("ProxyTrack %s, build proxies upon HTTrack Website Copier Archives\n",
|
||||
PROXYTRACK_VERSION);
|
||||
printf("Copyright (C) 1998-2013 Xavier Roche and other contributors\n");
|
||||
printf("Copyright (C) 1998-2014 Xavier Roche and other contributors\n");
|
||||
printf("\n");
|
||||
printf("This program is free software: you can redistribute it and/or modify\n");
|
||||
printf("it under the terms of the GNU General Public License as published by\n");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -85,35 +85,21 @@ HTS_UNUSED static void escapexml(const char *s, String * tempo) {
|
||||
}
|
||||
}
|
||||
|
||||
HTS_UNUSED static char *concat(char *catbuff, const char *a, const char *b) {
|
||||
if (a != NULL && a[0] != '\0') {
|
||||
strcpy(catbuff, a);
|
||||
} else {
|
||||
catbuff[0] = '\0';
|
||||
}
|
||||
if (b != NULL && b[0] != '\0') {
|
||||
strcat(catbuff, b);
|
||||
}
|
||||
return catbuff;
|
||||
}
|
||||
|
||||
HTS_UNUSED static char *__fconv(char *a) {
|
||||
#ifdef WIN32
|
||||
int i;
|
||||
|
||||
for(i = 0; a[i] != 0; i++)
|
||||
if (a[i] == '/') // Unix-to-DOS style
|
||||
a[i] = '\\';
|
||||
HTS_UNUSED static char* file_convert(char *dest, size_t size, const char *src) {
|
||||
size_t i;
|
||||
for(i = 0 ; src[i] != '\0' && i + 1 < size ; i++) {
|
||||
#ifdef _WIN32
|
||||
if (src[i] == '/') {
|
||||
dest[i] = '\\';
|
||||
} else {
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
HTS_UNUSED static char *fconcat(char *catbuff, const char *a, const char *b) {
|
||||
return __fconv(concat(catbuff, a, b));
|
||||
}
|
||||
|
||||
HTS_UNUSED static char *fconv(char *catbuff, const char *a) {
|
||||
return __fconv(concat(catbuff, a, ""));
|
||||
dest[i] = src[i];
|
||||
#ifdef _WIN32
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dest[i] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -103,6 +103,7 @@ Remark: If no cache newer than the added one is found, all entries can be added
|
||||
*/
|
||||
|
||||
/* HTTrack definitions */
|
||||
#define HTSSAFE_ABORT_FUNCTION(A,B,C)
|
||||
#include "htsbase.h"
|
||||
#include "htsnet.h"
|
||||
#include "htslib.h"
|
||||
@@ -145,8 +146,6 @@ Remark: If no cache newer than the added one is found, all entries can be added
|
||||
#endif
|
||||
|
||||
/* External references */
|
||||
// htsErrorCallback htsCallbackErr = NULL;
|
||||
int htsMemoryFastXfr = 1; /* fast xfr by default */
|
||||
void abortLog__fnc(char *msg, char *file, int line);
|
||||
void abortLog__fnc(char *msg, char *file, int line) {
|
||||
FILE *fp = fopen("CRASH.TXT", "wb");
|
||||
@@ -166,7 +165,6 @@ void abortLog__fnc(char *msg, char *file, int line) {
|
||||
}
|
||||
}
|
||||
|
||||
// HTSEXT_API t_abortLog abortLog__ = abortLog__fnc; /* avoid VC++ inlining */
|
||||
#define webhttrack_lock(A) do{}while(0)
|
||||
|
||||
/* Static definitions */
|
||||
@@ -228,18 +226,17 @@ static int linputsoc_t(T_SOC soc, char *s, int max, int timeout) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
|
||||
static int gethost(const char *hostname, SOCaddr * server) {
|
||||
if (hostname != NULL && *hostname != '\0') {
|
||||
#if HTS_INET6==0
|
||||
/*
|
||||
ipV4 resolver
|
||||
*/
|
||||
t_hostent *hp = gethostbyname(hostname);
|
||||
struct hostent *hp = gethostbyname(hostname);
|
||||
|
||||
if (hp != NULL) {
|
||||
if (hp->h_length) {
|
||||
SOCaddr_copyaddr(*server, server_size, hp->h_addr_list[0],
|
||||
hp->h_length);
|
||||
SOCaddr_copyaddr2(*server, hp->h_addr_list[0], hp->h_length);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -258,13 +255,13 @@ static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
|
||||
hints.ai_family = PF_INET6;
|
||||
else
|
||||
#endif
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
|
||||
if (res) {
|
||||
if ((res->ai_addr) && (res->ai_addrlen)) {
|
||||
SOCaddr_copyaddr(*server, server_size, res->ai_addr, res->ai_addrlen);
|
||||
SOCaddr_copyaddr2(*server, res->ai_addr, res->ai_addrlen);
|
||||
freeaddrinfo(res);
|
||||
return 1;
|
||||
}
|
||||
@@ -278,7 +275,7 @@ static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static String getip(SOCaddr * server, int serverLen) {
|
||||
static String getip(SOCaddr * server) {
|
||||
String s = STRING_EMPTY;
|
||||
|
||||
#if HTS_INET6==0
|
||||
@@ -293,7 +290,7 @@ static String getip(SOCaddr * server, int serverLen) {
|
||||
proxytrack_print_log(CRITICAL, "memory exhausted");
|
||||
return s;
|
||||
}
|
||||
SOCaddr_inetntoa(dotted, sizeMax, *server, serverLen);
|
||||
SOCaddr_inetntoa(dotted, sizeMax, *server);
|
||||
sprintf(dotted + strlen(dotted), ":%d", port);
|
||||
StringAttach(&s, &dotted);
|
||||
return s;
|
||||
@@ -301,18 +298,15 @@ static String getip(SOCaddr * server, int serverLen) {
|
||||
|
||||
static T_SOC smallserver_init(const char *adr, int port, int family) {
|
||||
SOCaddr server;
|
||||
size_t server_size = sizeof(server);
|
||||
|
||||
memset(&server, 0, sizeof(server));
|
||||
SOCaddr_initany(server, server_size);
|
||||
if (gethost(adr, &server, server_size)) { // host name
|
||||
SOCaddr_initany(server);
|
||||
if (gethost(adr, &server)) { // host name
|
||||
T_SOC soc = INVALID_SOCKET;
|
||||
|
||||
if ((soc =
|
||||
(T_SOC) socket(SOCaddr_sinfamily(server), family,
|
||||
0)) != INVALID_SOCKET) {
|
||||
SOCaddr_initport(server, port);
|
||||
if (bind(soc, (struct sockaddr *) &server, (int) server_size) == 0) {
|
||||
if (bind(soc, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
|
||||
if (family != SOCK_STREAM || listen(soc, 10) >= 0) {
|
||||
return soc;
|
||||
} else {
|
||||
@@ -1322,12 +1316,12 @@ static void proxytrack_process_HTTP(PT_Indexes indexes, T_SOC soc_c) {
|
||||
/* */
|
||||
String ip = STRING_EMPTY;
|
||||
SOCaddr serverClient;
|
||||
SOClen lenServerClient = (int) sizeof(serverClient);
|
||||
SOClen lenServerClient = SOCaddr_capacity(serverClient);
|
||||
|
||||
memset(&serverClient, 0, sizeof(serverClient));
|
||||
if (getsockname
|
||||
(soc_c, (struct sockaddr *) &serverClient, &lenServerClient) == 0) {
|
||||
ip = getip(&serverClient, lenServerClient);
|
||||
(soc_c, &SOCaddr_sockaddr(serverClient), &lenServerClient) == 0) {
|
||||
ip = getip(&serverClient);
|
||||
} else {
|
||||
StringCopy(ip, "unknown");
|
||||
}
|
||||
@@ -1573,14 +1567,14 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
|
||||
return -1;
|
||||
}
|
||||
while(soc != INVALID_SOCKET) {
|
||||
struct sockaddr clientAddr;
|
||||
SOClen clientAddrLen = sizeof(struct sockaddr);
|
||||
SOCaddr clientAddr;
|
||||
SOClen clientAddrLen = SOCaddr_capacity(clientAddr);
|
||||
int n;
|
||||
|
||||
memset(&clientAddr, 0, sizeof(clientAddr));
|
||||
n =
|
||||
recvfrom(soc, (char *) buffer, bufferSize, 0, &clientAddr,
|
||||
&clientAddrLen);
|
||||
n = recvfrom(soc, (char *) buffer, bufferSize, 0,
|
||||
&SOCaddr_sockaddr(clientAddr),
|
||||
&clientAddrLen);
|
||||
if (n != -1) {
|
||||
const char *LogRequest = "ERROR";
|
||||
const char *LogReply = "ERROR";
|
||||
@@ -1623,11 +1617,11 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
|
||||
UrlRequestSize = (unsigned int) strlen((char *) UrlRequest);
|
||||
LogRequest = "ICP_OP_QUERY";
|
||||
if (indexes == NULL) {
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_DENIED,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_DENIED,
|
||||
Version, 0, Request_Number, 0, 0, 0, UrlRequest);
|
||||
LogReply = "ICP_OP_DENIED";
|
||||
} else if (PT_LookupIndex(indexes, (char*) UrlRequest)) {
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_HIT,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_HIT,
|
||||
Version, 0, Request_Number, 0, 0, 0, UrlRequest);
|
||||
LogReply = "ICP_OP_HIT";
|
||||
} else {
|
||||
@@ -1639,7 +1633,7 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
|
||||
if (UrlRedirect != NULL) {
|
||||
sprintf(UrlRedirect, "%s/", UrlRequest);
|
||||
if (PT_LookupIndex(indexes, UrlRedirect)) { /* We'll generate a redirect */
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_HIT,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_HIT,
|
||||
Version, 0, Request_Number, 0, 0, 0,
|
||||
UrlRequest);
|
||||
LogReply = "ICP_OP_HIT";
|
||||
@@ -1650,7 +1644,7 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
|
||||
}
|
||||
}
|
||||
/* We won't retrive the cache MISS online, no way! */
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc,
|
||||
ICP_OP_MISS_NOFETCH, Version, 0, Request_Number,
|
||||
0, 0, 0, UrlRequest);
|
||||
LogReply = "ICP_OP_MISS_NOFETCH";
|
||||
@@ -1662,24 +1656,24 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
|
||||
UrlRequest = &Payload[4];
|
||||
LogRequest = "ICP_OP_QUERY";
|
||||
LogReply = "ICP_OP_QUERY";
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_SECHO,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_SECHO,
|
||||
Version, 0, Request_Number, 0, 0, 0, UrlRequest);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LogRequest = "NOTIMPLEMENTED";
|
||||
LogReply = "ICP_OP_ERR";
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_ERR, Version,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_ERR, Version,
|
||||
0, Request_Number, 0, 0, 0, NULL);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_ERR, 2, 0,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_ERR, 2, 0,
|
||||
Request_Number, 0, 0, 0, NULL);
|
||||
}
|
||||
} /* Ignored (RFC2186) */
|
||||
} else {
|
||||
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_ERR, Version, 0,
|
||||
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_ERR, Version, 0,
|
||||
Request_Number, 0, 0, 0, NULL);
|
||||
}
|
||||
}
|
||||
@@ -1693,7 +1687,7 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
|
||||
SOCaddr_copyaddr(serverClient, lenServerClient, &clientAddr,
|
||||
clientAddrLen);
|
||||
if (lenServerClient > 0) {
|
||||
ip = getip(&serverClient, lenServerClient);
|
||||
ip = getip(&clientAddr);
|
||||
} else {
|
||||
StringCopy(ip, "unknown");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -91,7 +91,7 @@ HTS_UNUSED static void proxytrack_print_log(const char *severity, const char *fo
|
||||
|
||||
/* Header for generated pages */
|
||||
#define PROXYTRACK_COMMENT_HEADER \
|
||||
"<!-- Generated by ProxyTrack " PROXYTRACK_VERSION " build " __DATE__ " -->\r\n" \
|
||||
"<!-- Generated by ProxyTrack " PROXYTRACK_VERSION " -->\r\n" \
|
||||
"<!-- This is an add-on for HTTrack " HTTRACK_VERSIONID " -->\r\n"
|
||||
|
||||
/* See IE "feature" (MSKB Q294807) */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -41,6 +41,7 @@ static long int timezone = 0;
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#define HTSSAFE_ABORT_FUNCTION(A,B,C)
|
||||
#include "htsglobal.h"
|
||||
|
||||
#define HTS_INTERNAL_BYTECODE
|
||||
@@ -237,6 +238,7 @@ PT_Indexes PT_New(void) {
|
||||
PT_Indexes index = (PT_Indexes) calloc(sizeof(_PT_Indexes), 1);
|
||||
|
||||
index->cil = inthash_new(0);
|
||||
inthash_set_name(index->cil, "index->cil");
|
||||
index->index_size = 0;
|
||||
index->index = NULL;
|
||||
return index;
|
||||
@@ -253,8 +255,6 @@ int PT_RemoveIndex(PT_Indexes index, int indexId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define assertf(exp)
|
||||
|
||||
static int binput(char *buff, char *s, int max) {
|
||||
int count = 0;
|
||||
int destCount = 0;
|
||||
@@ -433,8 +433,10 @@ char **PT_Enumerate(PT_Indexes indexes, const char *url, int subtree) {
|
||||
inthash_chain *chain;
|
||||
inthash hdupes = NULL;
|
||||
|
||||
if (!subtree)
|
||||
if (!subtree) {
|
||||
hdupes = inthash_new(0);
|
||||
inthash_set_name(hdupes, "hdupes");
|
||||
}
|
||||
StringClear(list);
|
||||
StringClear(listindexes);
|
||||
StringClear(subitem);
|
||||
@@ -552,6 +554,7 @@ PT_Index PT_LoadCache(const char *filename) {
|
||||
index->slots.common.timestamp = (time_t) time(NULL);
|
||||
index->slots.common.startUrl[0] = '\0';
|
||||
index->slots.common.hash = inthash_new(0);
|
||||
inthash_set_name(index->slots.common.hash, "index->slots.common.hash");
|
||||
if (!_IndexFuncts[type].PT_LoadCache(index, filename)) {
|
||||
proxytrack_print_log(DEBUG,
|
||||
"reading httrack cache (format #%d) %s : error",
|
||||
@@ -1157,7 +1160,7 @@ static PT_Element PT_ReadCache__New_u(PT_Index index_, const char *url,
|
||||
/* Read in memory from cache */
|
||||
if (flags & FETCH_BODY) {
|
||||
if (strnotempty(previous_save)) {
|
||||
FILE *fp = fopen(fconv(catbuff, previous_save), "rb");
|
||||
FILE *fp = fopen(file_convert(catbuff, sizeof(catbuff), previous_save), "rb");
|
||||
|
||||
if (fp != NULL) {
|
||||
r->adr = (char *) malloc(r->size + 4);
|
||||
@@ -1179,7 +1182,7 @@ static PT_Element PT_ReadCache__New_u(PT_Index index_, const char *url,
|
||||
} else {
|
||||
r->statuscode = STATUSCODE_INVALID;
|
||||
sprintf(r->msg, "Read error (can't open '%s') from cache",
|
||||
fconv(catbuff, previous_save));
|
||||
file_convert(catbuff, sizeof(catbuff), previous_save));
|
||||
}
|
||||
} else {
|
||||
r->statuscode = STATUSCODE_INVALID;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
HTTrack Website Copier, Offline Browser for Windows and Unix
|
||||
Copyright (C) 1998-2013 Xavier Roche and other contributors
|
||||
Copyright (C) 1998-2014 Xavier Roche and other contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -13,3 +13,9 @@ bash crawl-test.sh \
|
||||
httrack 'http://ut.httrack.com/unicode-links/idna.html' \
|
||||
'+*.ut.httrack.com/*' --robots=0
|
||||
|
||||
# unicode tests (bogus links)
|
||||
bash crawl-test.sh \
|
||||
--errors 0 --files 1 \
|
||||
--found 'ut.httrack.com/unicode-links/idna_bogus.html' \
|
||||
httrack 'http://ut.httrack.com/unicode-links/idna_bogus.html' \
|
||||
'-*' --robots=0
|
||||
|
||||
10
tests/11_crawl-longurl.test
Executable file
10
tests/11_crawl-longurl.test
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
bash check-network.sh || ! echo "skipping online unit tests" || exit 77
|
||||
|
||||
# http://code.google.com/p/httrack/issues/detail?id=42&can=1
|
||||
# we expect 2 errors only because other links are too longs (to be modified if suitable)
|
||||
bash crawl-test.sh --errors 2 --files 1 \
|
||||
--found ut.httrack.com/overflow/longquerywithaccents.html \
|
||||
httrack http://ut.httrack.com/overflow/longquerywithaccents.php
|
||||
@@ -8,6 +8,6 @@ TESTS_ENVIRONMENT += ONLINE_UNIT_TESTS=$(ONLINE_UNIT_TESTS)
|
||||
TESTS_ENVIRONMENT += HTTPS_SUPPORT=$(HTTPS_SUPPORT)
|
||||
|
||||
TEST_EXTENSIONS = .test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-simplify.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-simplify.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-longurl.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
|
||||
CLEANFILES = check-network_sh.cache
|
||||
|
||||
@@ -214,7 +214,7 @@ TESTS_ENVIRONMENT = PATH=$(top_builddir)/src$(PATH_SEPARATOR)$$PATH \
|
||||
ONLINE_UNIT_TESTS=$(ONLINE_UNIT_TESTS) \
|
||||
HTTPS_SUPPORT=$(HTTPS_SUPPORT)
|
||||
TEST_EXTENSIONS = .test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-simplify.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-simplify.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-longurl.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
CLEANFILES = check-network_sh.cache
|
||||
all: all-am
|
||||
|
||||
|
||||
Reference in New Issue
Block a user