1 Commits

Author SHA1 Message Date
Xavier Roche
97f9d1d6cf Tagged 3.48.6 2014-05-13 19:42:59 +00:00
33 changed files with 992 additions and 1100 deletions

View File

@@ -108,9 +108,3 @@
/* Version number of package */
#undef VERSION
/* in_port_t */
#undef in_port_t
/* sa_family_t */
#undef sa_family_t

50
configure vendored
View File

@@ -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.9.
# Generated by GNU Autoconf 2.69 for httrack 3.48.5.
#
# 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.9'
PACKAGE_STRING='httrack 3.48.9'
PACKAGE_VERSION='3.48.5'
PACKAGE_STRING='httrack 3.48.5'
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.9 to adapt to many kinds of systems.
\`configure' configures httrack 3.48.5 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.9:";;
short | recursive ) echo "Configuration of httrack 3.48.5:";;
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.9
httrack configure 3.48.5
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.9, which was
It was created by httrack $as_me 3.48.5, 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.9'
VERSION='3.48.5'
cat >>confdefs.h <<_ACEOF
@@ -15408,36 +15408,6 @@ $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
@@ -16922,7 +16892,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.9, which was
This file was extended by httrack $as_me 3.48.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16989,7 +16959,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.9
httrack config.status 3.48.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,4 +1,4 @@
AC_INIT([httrack], [3.48.9], [roche+packaging@httrack.com], [httrack], [http://www.httrack.com/])
AC_INIT([httrack], [3.48.5], [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,18 +47,6 @@ 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()

24
debian/changelog vendored
View File

@@ -1,27 +1,3 @@
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)

View File

@@ -4,13 +4,7 @@ HTTrack Website Copier release history:
This file lists all changes and fixes that have been made for HTTrack.
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
3.48-3
+ Fixed: buggy option pannels
+ New: Enforce check against CVE-2014-0160
+ New: improved hashtables to speedup large mirrors

View File

@@ -51,99 +51,98 @@ offline browser : copy websites to a local directory</p>
<p style="margin-left:11%; margin-top: 1em"><b>httrack [
url ]... [ &minus;filter ]... [ +filter ]... [ &minus;O,
&minus;&minus;path</b> ] [ <b>&minus;w,
&minus;&minus;mirror</b> ] [ <b>&minus;W,
&minus;&minus;mirror&minus;wizard</b> ] [ <b>&minus;g,
&minus;&minus;get&minus;files</b> ] [ <b>&minus;i,
&minus;&minus;continue</b> ] [ <b>&minus;Y,
&minus;&minus;mirrorlinks</b> ] [ <b>&minus;P,
&minus;&minus;proxy</b> ] [ <b>&minus;%f,
&minus;&minus;httpproxy&minus;ftp[=N]</b> ] [ <b>&minus;%b,
&minus;&minus;bind</b> ] [ <b>&minus;rN,
&minus;&minus;depth[=N]</b> ] [ <b>&minus;%eN,
&minus;&minus;ext&minus;depth[=N]</b> ] [ <b>&minus;mN,
&minus;&minus;max&minus;files[=N]</b> ] [ <b>&minus;MN,
&minus;&minus;max&minus;size[=N]</b> ] [ <b>&minus;EN,
&minus;&minus;max&minus;time[=N]</b> ] [ <b>&minus;AN,
&minus;&minus;max&minus;rate[=N]</b> ] [ <b>&minus;%cN,
url ]... [ &minus;filter ]... [ +filter ]... [ &minus;O
&minus;&minus;path</b> ] [ <b>&minus;w
&minus;&minus;mirror</b> ] [ <b>&minus;W
&minus;&minus;mirror&minus;wizard</b> ] [ <b>&minus;g
&minus;&minus;get&minus;files</b> ] [ <b>&minus;i
&minus;&minus;continue</b> ] [ <b>&minus;Y
&minus;&minus;mirrorlinks</b> ] [ <b>&minus;P
&minus;&minus;proxy</b> ] [ <b>&minus;%f
&minus;&minus;httpproxy&minus;ftp[=N]</b> ] [ <b>&minus;%b
&minus;&minus;bind</b> ] [ <b>&minus;rN
&minus;&minus;depth[=N]</b> ] [ <b>&minus;%eN
&minus;&minus;ext&minus;depth[=N]</b> ] [ <b>&minus;mN
&minus;&minus;max&minus;files[=N]</b> ] [ <b>&minus;MN
&minus;&minus;max&minus;size[=N]</b> ] [ <b>&minus;EN
&minus;&minus;max&minus;time[=N]</b> ] [ <b>&minus;AN
&minus;&minus;max&minus;rate[=N]</b> ] [ <b>&minus;%cN
&minus;&minus;connection&minus;per&minus;second[=N]</b> ] [
<b>&minus;GN, &minus;&minus;max&minus;pause[=N]</b> ] [
<b>&minus;cN, &minus;&minus;sockets[=N]</b> ] [
<b>&minus;TN, &minus;&minus;timeout[=N]</b> ] [
<b>&minus;RN, &minus;&minus;retries[=N]</b> ] [
<b>&minus;JN, &minus;&minus;min&minus;rate[=N]</b> ] [
<b>&minus;HN, &minus;&minus;host&minus;control[=N]</b> ] [
<b>&minus;%P, &minus;&minus;extended&minus;parsing[=N]</b> ]
[ <b>&minus;n, &minus;&minus;near</b> ] [ <b>&minus;t,
&minus;&minus;test</b> ] [ <b>&minus;%L,
&minus;&minus;list</b> ] [ <b>&minus;%S,
&minus;&minus;urllist</b> ] [ <b>&minus;NN,
&minus;&minus;structure[=N]</b> ] [ <b>&minus;%D,
<b>&minus;GN &minus;&minus;max&minus;pause[=N]</b> ] [
<b>&minus;cN &minus;&minus;sockets[=N]</b> ] [ <b>&minus;TN
&minus;&minus;timeout[=N]</b> ] [ <b>&minus;RN
&minus;&minus;retries[=N]</b> ] [ <b>&minus;JN
&minus;&minus;min&minus;rate[=N]</b> ] [ <b>&minus;HN
&minus;&minus;host&minus;control[=N]</b> ] [ <b>&minus;%P
&minus;&minus;extended&minus;parsing[=N]</b> ] [ <b>&minus;n
&minus;&minus;near</b> ] [ <b>&minus;t
&minus;&minus;test</b> ] [ <b>&minus;%L
&minus;&minus;list</b> ] [ <b>&minus;%S
&minus;&minus;urllist</b> ] [ <b>&minus;NN
&minus;&minus;structure[=N]</b> ] [ <b>&minus;%D
&minus;&minus;cached&minus;delayed&minus;type&minus;check</b>
] [ <b>&minus;%M, &minus;&minus;mime&minus;html</b> ] [
<b>&minus;LN, &minus;&minus;long&minus;names[=N]</b> ] [
<b>&minus;KN, &minus;&minus;keep&minus;links[=N]</b> ] [
<b>&minus;x, &minus;&minus;replace&minus;external</b> ] [
<b>&minus;%x, &minus;&minus;disable&minus;passwords</b> ] [
<b>&minus;%q,
] [ <b>&minus;%M &minus;&minus;mime&minus;html</b> ] [
<b>&minus;LN &minus;&minus;long&minus;names[=N]</b> ] [
<b>&minus;KN &minus;&minus;keep&minus;links[=N]</b> ] [
<b>&minus;x &minus;&minus;replace&minus;external</b> ] [
<b>&minus;%x &minus;&minus;disable&minus;passwords</b> ] [
<b>&minus;%q
&minus;&minus;include&minus;query&minus;string</b> ] [
<b>&minus;o, &minus;&minus;generate&minus;errors</b> ] [
<b>&minus;X, &minus;&minus;purge&minus;old[=N]</b> ] [
<b>&minus;%p, &minus;&minus;preserve</b> ] [ <b>&minus;%T,
&minus;&minus;utf8&minus;conversion</b> ] [ <b>&minus;bN,
&minus;&minus;cookies[=N]</b> ] [ <b>&minus;u,
&minus;&minus;check&minus;type[=N]</b> ] [ <b>&minus;j,
&minus;&minus;parse&minus;java[=N]</b> ] [ <b>&minus;sN,
&minus;&minus;robots[=N]</b> ] [ <b>&minus;%h,
&minus;&minus;http&minus;10</b> ] [ <b>&minus;%k,
&minus;&minus;keep&minus;alive</b> ] [ <b>&minus;%B,
&minus;&minus;tolerant</b> ] [ <b>&minus;%s,
&minus;&minus;updatehack</b> ] [ <b>&minus;%u,
&minus;&minus;urlhack</b> ] [ <b>&minus;%A,
&minus;&minus;assume</b> ] [ <b>&minus;@iN,
&minus;&minus;protocol[=N]</b> ] [ <b>&minus;%w,
&minus;&minus;disable&minus;module</b> ] [ <b>&minus;F,
&minus;&minus;user&minus;agent</b> ] [ <b>&minus;%R,
&minus;&minus;referer</b> ] [ <b>&minus;%E,
&minus;&minus;from</b> ] [ <b>&minus;%F,
&minus;&minus;footer</b> ] [ <b>&minus;%l,
&minus;&minus;language</b> ] [ <b>&minus;%a,
&minus;&minus;accept</b> ] [ <b>&minus;%X,
&minus;&minus;headers</b> ] [ <b>&minus;C,
&minus;&minus;cache[=N]</b> ] [ <b>&minus;k,
<b>&minus;o &minus;&minus;generate&minus;errors</b> ] [
<b>&minus;X &minus;&minus;purge&minus;old[=N]</b> ] [
<b>&minus;%p &minus;&minus;preserve</b> ] [ <b>&minus;%T
&minus;&minus;utf8&minus;conversion</b> ] [ <b>&minus;bN
&minus;&minus;cookies[=N]</b> ] [ <b>&minus;u
&minus;&minus;check&minus;type[=N]</b> ] [ <b>&minus;j
&minus;&minus;parse&minus;java[=N]</b> ] [ <b>&minus;sN
&minus;&minus;robots[=N]</b> ] [ <b>&minus;%h
&minus;&minus;http&minus;10</b> ] [ <b>&minus;%k
&minus;&minus;keep&minus;alive</b> ] [ <b>&minus;%B
&minus;&minus;tolerant</b> ] [ <b>&minus;%s
&minus;&minus;updatehack</b> ] [ <b>&minus;%u
&minus;&minus;urlhack</b> ] [ <b>&minus;%A
&minus;&minus;assume</b> ] [ <b>&minus;@iN
&minus;&minus;protocol[=N]</b> ] [ <b>&minus;%w
&minus;&minus;disable&minus;module</b> ] [ <b>&minus;F
&minus;&minus;user&minus;agent</b> ] [ <b>&minus;%R
&minus;&minus;referer</b> ] [ <b>&minus;%E
&minus;&minus;from</b> ] [ <b>&minus;%F
&minus;&minus;footer</b> ] [ <b>&minus;%l
&minus;&minus;language</b> ] [ <b>&minus;%a
&minus;&minus;accept</b> ] [ <b>&minus;%X
&minus;&minus;headers</b> ] [ <b>&minus;C
&minus;&minus;cache[=N]</b> ] [ <b>&minus;k
&minus;&minus;store&minus;all&minus;in&minus;cache</b> ] [
<b>&minus;%n, &minus;&minus;do&minus;not&minus;recatch</b> ]
[ <b>&minus;%v, &minus;&minus;display</b> ] [ <b>&minus;Q,
&minus;&minus;do&minus;not&minus;log</b> ] [ <b>&minus;q,
&minus;&minus;quiet</b> ] [ <b>&minus;z,
&minus;&minus;extra&minus;log</b> ] [ <b>&minus;Z,
&minus;&minus;debug&minus;log</b> ] [ <b>&minus;v,
&minus;&minus;verbose</b> ] [ <b>&minus;f,
&minus;&minus;file&minus;log</b> ] [ <b>&minus;f2,
&minus;&minus;single&minus;log</b> ] [ <b>&minus;I,
&minus;&minus;index</b> ] [ <b>&minus;%i,
<b>&minus;%n &minus;&minus;do&minus;not&minus;recatch</b> ]
[ <b>&minus;%v &minus;&minus;display</b> ] [ <b>&minus;Q
&minus;&minus;do&minus;not&minus;log</b> ] [ <b>&minus;q
&minus;&minus;quiet</b> ] [ <b>&minus;z
&minus;&minus;extra&minus;log</b> ] [ <b>&minus;Z
&minus;&minus;debug&minus;log</b> ] [ <b>&minus;v
&minus;&minus;verbose</b> ] [ <b>&minus;f
&minus;&minus;file&minus;log</b> ] [ <b>&minus;f2
&minus;&minus;single&minus;log</b> ] [ <b>&minus;I
&minus;&minus;index</b> ] [ <b>&minus;%i
&minus;&minus;build&minus;top&minus;index</b> ] [
<b>&minus;%I, &minus;&minus;search&minus;index</b> ] [
<b>&minus;pN, &minus;&minus;priority[=N]</b> ] [
<b>&minus;S,
<b>&minus;%I &minus;&minus;search&minus;index</b> ] [
<b>&minus;pN &minus;&minus;priority[=N]</b> ] [ <b>&minus;S
&minus;&minus;stay&minus;on&minus;same&minus;dir</b> ] [
<b>&minus;D, &minus;&minus;can&minus;go&minus;down</b> ] [
<b>&minus;U, &minus;&minus;can&minus;go&minus;up</b> ] [
<b>&minus;B,
<b>&minus;D &minus;&minus;can&minus;go&minus;down</b> ] [
<b>&minus;U &minus;&minus;can&minus;go&minus;up</b> ] [
<b>&minus;B
&minus;&minus;can&minus;go&minus;up&minus;and&minus;down</b>
] [ <b>&minus;a,
] [ <b>&minus;a
&minus;&minus;stay&minus;on&minus;same&minus;address</b> ] [
<b>&minus;d,
<b>&minus;d
&minus;&minus;stay&minus;on&minus;same&minus;domain</b> ] [
<b>&minus;l,
<b>&minus;l
&minus;&minus;stay&minus;on&minus;same&minus;tld</b> ] [
<b>&minus;e, &minus;&minus;go&minus;everywhere</b> ] [
<b>&minus;%H, &minus;&minus;debug&minus;headers</b> ] [
<b>&minus;%!,
<b>&minus;e &minus;&minus;go&minus;everywhere</b> ] [
<b>&minus;%H &minus;&minus;debug&minus;headers</b> ] [
<b>&minus;%!
&minus;&minus;disable&minus;security&minus;limits</b> ] [
<b>&minus;V, &minus;&minus;userdef&minus;cmd</b> ] [
<b>&minus;%W, &minus;&minus;callback</b> ] [ <b>&minus;K,
<b>&minus;V &minus;&minus;userdef&minus;cmd</b> ] [
<b>&minus;%W &minus;&minus;callback</b> ] [ <b>&minus;K
&minus;&minus;keep&minus;links[=N]</b> ] [</p>
<h2>DESCRIPTION
@@ -185,7 +184,7 @@ sites</p>
www.someweb.com/bob/bobby.html +* &minus;r6</b></p>
<p style="margin-left:22%;">means get all files starting
from bobby.html, with 6 link&minus;depth, and possibility of
from bobby.html with 6 link&minus;depth and possibility of
going everywhere on the web</p>
<p style="margin-left:11%;"><b>httrack
@@ -234,7 +233,7 @@ options:</b></p>
<p>path for mirror/logfiles+cache (&minus;O path
mirror[,path cache and logfiles]) (&minus;&minus;path
mirror[path cache and logfiles]) (&minus;&minus;path
&lt;param&gt;)</p> </td></tr>
</table>
@@ -265,7 +264,7 @@ options:</b></p>
<td width="78%">
<p>mirror web sites, semi&minus;automatic (asks questions)
<p>mirror web sites semi&minus;automatic (asks questions)
(&minus;&minus;mirror&minus;wizard)</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -356,11 +355,11 @@ options:</b></p>
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p style="margin-top: 1em">&minus;rN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
@@ -368,11 +367,11 @@ options:</b></p>
r9999) (&minus;&minus;depth[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;%eN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
@@ -380,11 +379,11 @@ r9999) (&minus;&minus;depth[=N])</p></td></tr>
(&minus;&minus;ext&minus;depth[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;mN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
@@ -392,22 +391,22 @@ r9999) (&minus;&minus;depth[=N])</p></td></tr>
(&minus;&minus;max&minus;files[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;mN,N2</p></td>
<td width="2%"></td>
<p>&minus;mNN2</p></td>
<td width="4%"></td>
<td width="78%">
<p>maximum file length for non html (N) and html (N2)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;MN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
@@ -415,23 +414,23 @@ r9999) (&minus;&minus;depth[=N])</p></td></tr>
(&minus;&minus;max&minus;size[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;EN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
<p>maximum mirror time in seconds (60=1 minute, 3600=1
hour) (&minus;&minus;max&minus;time[=N])</p></td></tr>
<p>maximum mirror time in seconds (60=1 minute 3600=1 hour)
(&minus;&minus;max&minus;time[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;AN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
@@ -439,11 +438,11 @@ hour) (&minus;&minus;max&minus;time[=N])</p></td></tr>
(&minus;&minus;max&minus;rate[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;%cN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
@@ -451,15 +450,15 @@ hour) (&minus;&minus;max&minus;time[=N])</p></td></tr>
(&minus;&minus;connection&minus;per&minus;second[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<td width="7%">
<p>&minus;GN</p></td>
<td width="2%"></td>
<td width="4%"></td>
<td width="78%">
<p>pause transfer if N bytes reached, and wait until lock
<p>pause transfer if N bytes reached and wait until lock
file is deleted (&minus;&minus;max&minus;pause[=N])</p></td></tr>
</table>
@@ -490,7 +489,7 @@ control:</b></p>
<td width="78%">
<p>timeout, number of seconds after a non&minus;responding
<p>timeout number of seconds after a non&minus;responding
link is shutdown (&minus;&minus;timeout[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -502,7 +501,7 @@ link is shutdown (&minus;&minus;timeout[=N])</p></td></tr>
<td width="78%">
<p>number of retries, in case of timeout or non&minus;fatal
<p>number of retries in case of timeout or non&minus;fatal
errors (*R1) (&minus;&minus;retries[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -514,7 +513,7 @@ errors (*R1) (&minus;&minus;retries[=N])</p></td></tr>
<td width="78%">
<p>traffic jam control, minimum transfert rate
<p>traffic jam control minimum transfert rate
(bytes/seconds) tolerated for a link
(&minus;&minus;min&minus;rate[=N])</p> </td></tr>
<tr valign="top" align="left">
@@ -527,7 +526,7 @@ errors (*R1) (&minus;&minus;retries[=N])</p></td></tr>
<td width="78%">
<p>host is abandonned if: 0=never, 1=timeout, 2=slow,
<p>host is abandonned if: 0=never 1=timeout 2=slow
3=timeout or slow (&minus;&minus;host&minus;control[=N])</p></td></tr>
</table>
@@ -546,8 +545,8 @@ options:</b></p>
<td width="78%">
<p style="margin-top: 1em">*extended parsing, attempt to
parse all links, even in unknown tags or Javascript (%P0 don
<p style="margin-top: 1em">*extended parsing attempt to
parse all links even in unknown tags or Javascript (%P0 don
t use) (&minus;&minus;extended&minus;parsing[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -616,7 +615,7 @@ options:</b></p>
<p style="margin-top: 1em">structure type (0 *original
structure, 1+: see below) (&minus;&minus;structure[=N])</p></td></tr>
structure 1+: see below) (&minus;&minus;structure[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
@@ -639,9 +638,9 @@ structure, 1+: see below) (&minus;&minus;structure[=N])</p></td></tr>
<td width="78%">
<p>delayed type check, don t make any link test but wait
for files download to start instead (experimental) (%N0 don
t use, %N1 use for unknown extensions, * %N2 always use)</p></td></tr>
<p>delayed type check don t make any link test but wait for
files download to start instead (experimental) (%N0 don t
use %N1 use for unknown extensions * %N2 always use)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
@@ -652,8 +651,8 @@ t use, %N1 use for unknown extensions, * %N2 always use)</p></td></tr>
<td width="78%">
<p>cached delayed type check, don t wait for remote type
during updates, to speedup them (%D0 wait, * %D1 don t wait)
<p>cached delayed type check don t wait for remote type
during updates to speedup them (%D0 wait * %D1 don t wait)
(&minus;&minus;cached&minus;delayed&minus;type&minus;check)</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -692,8 +691,8 @@ L2 ISO9660 compatible)
<p>keep original links (e.g. http://www.adr/link) (K0
*relative link, K absolute links, K4 original links, K3
absolute URI links, K5 transparent proxy link)
*relative link K absolute links K4 original links K3
absolute URI links K5 transparent proxy link)
(&minus;&minus;keep&minus;links[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -730,7 +729,7 @@ protected websites (%x0 include)
<td width="78%">
<p>*include query string for local files (useless, for
<p>*include query string for local files (useless for
information purpose only) (%q0 don t include)
(&minus;&minus;include&minus;query&minus;string)</p> </td></tr>
<tr valign="top" align="left">
@@ -799,7 +798,7 @@ options:</b></p>
<p style="margin-top: 1em">accept cookies in cookies.txt
(0=do not accept,* 1=accept) (&minus;&minus;cookies[=N])</p></td></tr>
(0=do not accept* 1=accept) (&minus;&minus;cookies[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -810,8 +809,8 @@ options:</b></p>
<td width="78%">
<p>check document type if unknown (cgi,asp..) (u0 don t
check, * u1 check but /, u2 check always)
<p>check document type if unknown (cgiasp..) (u0 don t
check * u1 check but / u2 check always)
(&minus;&minus;check&minus;type[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -823,9 +822,9 @@ check, * u1 check but /, u2 check always)
<td width="78%">
<p>*parse Java Classes (j0 don t parse, bitmask: |1 parse
default, |2 don t parse .class |4 don t parse .js |8 don t
be aggressive) (&minus;&minus;parse&minus;java[=N])</p></td></tr>
<p>*parse Java Classes (j0 don t parse bitmask: |1 parse
default |2 don t parse .class |4 don t parse .js |8 don t be
aggressive) (&minus;&minus;parse&minus;java[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -837,8 +836,8 @@ be aggressive) (&minus;&minus;parse&minus;java[=N])</p></td></tr>
<p>follow robots.txt and meta robots tags
(0=never,1=sometimes,* 2=always, 3=always (even strict
rules)) (&minus;&minus;robots[=N])</p></td></tr>
(0=never1=sometimes* 2=always 3=always (even strict rules))
(&minus;&minus;robots[=N])</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -849,9 +848,8 @@ rules)) (&minus;&minus;robots[=N])</p></td></tr>
<td width="78%">
<p>force HTTP/1.0 requests (reduce update features, only
for old servers or proxies)
(&minus;&minus;http&minus;10)</p> </td></tr>
<p>force HTTP/1.0 requests (reduce update features only for
old servers or proxies) (&minus;&minus;http&minus;10)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -862,7 +860,7 @@ for old servers or proxies)
<td width="78%">
<p>use keep&minus;alive if possible, greately reducing
<p>use keep&minus;alive if possible greately reducing
latency for small files and test requests (%k0 don t use)
(&minus;&minus;keep&minus;alive)</p> </td></tr>
<tr valign="top" align="left">
@@ -876,7 +874,7 @@ latency for small files and test requests (%k0 don t use)
<p>tolerant requests (accept bogus responses on some
servers, but not standard!) (&minus;&minus;tolerant)</p></td></tr>
servers but not standard!) (&minus;&minus;tolerant)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -888,7 +886,7 @@ servers, but not standard!) (&minus;&minus;tolerant)</p></td></tr>
<p>update hacks: various hacks to limit re&minus;transfers
when updating (identical size, bogus response..)
when updating (identical size bogus response..)
(&minus;&minus;updatehack)</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -901,7 +899,7 @@ when updating (identical size, bogus response..)
<p>url hacks: various hacks to limit duplicate URLs (strip
//, www.foo.com==foo.com..) (&minus;&minus;urlhack)</p></td></tr>
// www.foo.com==foo.com..) (&minus;&minus;urlhack)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -912,9 +910,9 @@ when updating (identical size, bogus response..)
<td width="78%">
<p>assume that a type (cgi,asp..) is always linked with a
<p>assume that a type (cgiasp..) is always linked with a
mime type (&minus;%A
php3,cgi=text/html;dat,bin=application/x&minus;zip)
php3cgi=text/html;datbin=application/x&minus;zip)
(&minus;&minus;assume &lt;param&gt;)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -938,7 +936,7 @@ php3,cgi=text/html;dat,bin=application/x&minus;zip)
<td width="78%">
<p>internet protocol (0=both ipv6+ipv4, 4=ipv4 only, 6=ipv6
<p>internet protocol (0=both ipv6+ipv4 4=ipv4 only 6=ipv6
only) (&minus;&minus;protocol[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -1020,7 +1018,7 @@ HTTP headers (&minus;F &quot;user&minus;agent name&quot;)
<td width="78%">
<p>preffered language (&minus;%l &quot;fr, en, jp, *&quot;
<p>preffered language (&minus;%l &quot;fr en jp *&quot;
(&minus;&minus;language &lt;param&gt;)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -1033,7 +1031,7 @@ HTTP headers (&minus;F &quot;user&minus;agent name&quot;)
<p>accepted formats (&minus;%l
&quot;text/html,image/png,image/jpeg,image/gif;q=0.9,*/*;q=0.1&quot;
&quot;text/htmlimage/pngimage/jpegimage/gif;q=0.9*/*;q=0.1&quot;
(&minus;&minus;accept &lt;param&gt;)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -1050,7 +1048,7 @@ HTTP headers (&minus;F &quot;user&minus;agent name&quot;)
&lt;param&gt;)</p> </td></tr>
</table>
<p style="margin-left:11%; margin-top: 1em"><b>Log, index,
<p style="margin-left:11%; margin-top: 1em"><b>Log index
cache</b></p>
<table width="100%" border="0" rules="none" frame="void"
@@ -1066,7 +1064,7 @@ cache</b></p>
<p style="margin-top: 1em">create/use a cache for updates
and retries (C0 no cache,C1 cache is prioritary,* C2 test
and retries (C0 no cacheC1 cache is prioritary* C2 test
update before) (&minus;&minus;cache[=N])</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -1249,7 +1247,7 @@ options:</b></p>
<td width="78%">
<p>just scan, don t save anything (for checking links)</p></td></tr>
<p>just scan don t save anything (for checking links)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -1293,7 +1291,7 @@ options:</b></p>
<td width="78%">
<p>get html files before, then treat other files</p></td></tr>
<p>get html files before then treat other files</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">
@@ -1650,14 +1648,14 @@ doing)</b></p>
<p style="margin-top: 1em">bypass built&minus;in security
limits aimed to avoid bandwidth abuses (bandwidth,
limits aimed to avoid bandwidth abuses (bandwidth
simultaneous connections)
(&minus;&minus;disable&minus;security&minus;limits)</p> </td></tr>
</table>
<p style="margin-left:11%;">&minus;IMPORTANT</p>
<p style="margin-left:22%;">NOTE: DANGEROUS OPTION, ONLY
<p style="margin-left:22%;">NOTE: DANGEROUS OPTION ONLY
SUITABLE FOR EXPERTS</p>
<table width="100%" border="0" rules="none" frame="void"
@@ -1694,7 +1692,7 @@ specific options:</b></p>
<p style="margin-top: 1em">execute system command after
each files ($0 is the filename: &minus;V &quot;rm \$0&quot;)
each files ($0 is the filename: &minus;V &quot;rm &quot;)
(&minus;&minus;userdef&minus;cmd &lt;param&gt;)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -1707,7 +1705,7 @@ each files ($0 is the filename: &minus;V &quot;rm \$0&quot;)
<p>use an external library function as a wrapper (&minus;%W
myfoo.so[,myparameters]) (&minus;&minus;callback
myfoo.so[myparameters]) (&minus;&minus;callback
&lt;param&gt;)</p> </td></tr>
</table>
@@ -1738,7 +1736,7 @@ Option N</b></p>
<td width="78%">
<p>HTML in web/, images/other files in web/images/</p></td></tr>
<p>HTML in web/ images/other files in web/images/</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
@@ -1749,7 +1747,7 @@ Option N</b></p>
<td width="78%">
<p>HTML in web/HTML, images/other in web/images</p></td></tr>
<p>HTML in web/HTML images/other in web/images</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
@@ -1760,7 +1758,7 @@ Option N</b></p>
<td width="78%">
<p>HTML in web/, images/other in web/</p></td></tr>
<p>HTML in web/ images/other in web/</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
@@ -1771,8 +1769,8 @@ Option N</b></p>
<td width="78%">
<p>HTML in web/, images/other in web/xxx, where xxx is the
file extension (all gif will be placed onto web/gif, for
<p>HTML in web/ images/other in web/xxx where xxx is the
file extension (all gif will be placed onto web/gif for
example)</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -1795,7 +1793,7 @@ example)</p> </td></tr>
<td width="78%">
<p>All files in web/, with random names (gadget !)</p></td></tr>
<p>All files in web/ with random names (gadget !)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
@@ -1806,7 +1804,7 @@ example)</p> </td></tr>
<td width="78%">
<p>Site&minus;structure, without www.domain.xxx/</p></td></tr>
<p>Site&minus;structure without www.domain.xxx/</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
@@ -1956,15 +1954,15 @@ directory</p> </td></tr>
<p style="margin-left:11%; margin-top: 1em"><b>Details:
User&minus;defined option N</b> <br>
%n Name of file without file type (ex: image) <br>
%N Name of file, including file type (ex: image.gif) <br>
%N Name of file including file type (ex: image.gif) <br>
%t File type (ex: gif) <br>
%p Path [without ending /] (ex: /someimages) <br>
%h Host name (ex: www.someweb.com) <br>
%M URL MD5 (128 bits, 32 ascii bytes) <br>
%Q query string MD5 (128 bits, 32 ascii bytes) <br>
%M URL MD5 (128 bits 32 ascii bytes) <br>
%Q query string MD5 (128 bits 32 ascii bytes) <br>
%k full query string <br>
%r protocol name (ex: http) <br>
%q small query string MD5 (16 bits, 4 ascii bytes) <br>
%q small query string MD5 (16 bits 4 ascii bytes) <br>
%s? Short name version (ex: %sN) <br>
%[param] param variable in query string <br>
%[param:before:after:empty:notfound] advanced variable
@@ -2042,8 +2040,8 @@ parameter could not be found</p>
<td width="78%">
<p>fields, except the first one (the parameter name), can
be empty</p></td></tr>
<p>fields except the first one (the parameter name) can be
empty</p> </td></tr>
</table>
<p style="margin-left:11%; margin-top: 1em"><b>Details:
@@ -2062,7 +2060,7 @@ Option K</b></p>
<p style="margin-top: 1em">foo.cgi?q=45 &minus;&gt;
foo4B54.html?q=45 (relative URI, default)</p></td></tr>
foo4B54.html?q=45 (relative URI default)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="4%">
@@ -2132,7 +2130,7 @@ site(s) (default)</p>
<td width="78%">
<p>&lt;URLs&gt; get the files indicated, do not seek other
<p>&lt;URLs&gt; get the files indicated do not seek other
URLs (&minus;qg)</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
@@ -2160,7 +2158,7 @@ pages (&minus;r1p0C0I0t)</p>
<p style="margin-left:11%;">&minus;&minus;spider</p>
<p style="margin-left:22%;">&lt;URLs&gt; spider site(s), to
<p style="margin-left:22%;">&lt;URLs&gt; spider site(s) to
test links: reports Errors &amp; Warnings
(&minus;p0C0I0t)</p>
@@ -2171,17 +2169,17 @@ test links: reports Errors &amp; Warnings
<p style="margin-left:11%;">&minus;&minus;skeleton</p>
<p style="margin-left:22%;">&lt;URLs&gt; make a mirror, but
<p style="margin-left:22%;">&lt;URLs&gt; make a mirror but
gets only html files (&minus;p1)</p>
<p style="margin-left:11%;">&minus;&minus;update</p>
<p style="margin-left:22%;">update a mirror, without
<p style="margin-left:22%;">update a mirror without
confirmation (&minus;iC2)</p>
<p style="margin-left:11%;">&minus;&minus;continue</p>
<p style="margin-left:22%;">continue a mirror, without
<p style="margin-left:22%;">continue a mirror without
confirmation (&minus;iC1)</p>
<p style="margin-left:11%;">&minus;&minus;catchurl</p>

View File

@@ -1,182 +1,182 @@
.\" Process this file with
.\" groff -man -Tascii httrack.1
.\"
.TH httrack 1 "15 May 2014" "httrack website copier"
.TH httrack 1 "02 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\, \-\-path
] [
.B \-w, \-\-mirror
.B \-w\, \-\-mirror
] [
.B \-W, \-\-mirror\-wizard
.B \-W\, \-\-mirror\-wizard
] [
.B \-g, \-\-get\-files
.B \-g\, \-\-get\-files
] [
.B \-i, \-\-continue
.B \-i\, \-\-continue
] [
.B \-Y, \-\-mirrorlinks
.B \-Y\, \-\-mirrorlinks
] [
.B \-P, \-\-proxy
.B \-P\, \-\-proxy
] [
.B \-%f, \-\-httpproxy\-ftp[=N]
.B \-%f\, \-\-httpproxy\-ftp[=N]
] [
.B \-%b, \-\-bind
.B \-%b\, \-\-bind
] [
.B \-rN, \-\-depth[=N]
.B \-rN\, \-\-depth[=N]
] [
.B \-%eN, \-\-ext\-depth[=N]
.B \-%eN\, \-\-ext\-depth[=N]
] [
.B \-mN, \-\-max\-files[=N]
.B \-mN\, \-\-max\-files[=N]
] [
.B \-MN, \-\-max\-size[=N]
.B \-MN\, \-\-max\-size[=N]
] [
.B \-EN, \-\-max\-time[=N]
.B \-EN\, \-\-max\-time[=N]
] [
.B \-AN, \-\-max\-rate[=N]
.B \-AN\, \-\-max\-rate[=N]
] [
.B \-%cN, \-\-connection\-per\-second[=N]
.B \-%cN\, \-\-connection\-per\-second[=N]
] [
.B \-GN, \-\-max\-pause[=N]
.B \-GN\, \-\-max\-pause[=N]
] [
.B \-cN, \-\-sockets[=N]
.B \-cN\, \-\-sockets[=N]
] [
.B \-TN, \-\-timeout[=N]
.B \-TN\, \-\-timeout[=N]
] [
.B \-RN, \-\-retries[=N]
.B \-RN\, \-\-retries[=N]
] [
.B \-JN, \-\-min\-rate[=N]
.B \-JN\, \-\-min\-rate[=N]
] [
.B \-HN, \-\-host\-control[=N]
.B \-HN\, \-\-host\-control[=N]
] [
.B \-%P, \-\-extended\-parsing[=N]
.B \-%P\, \-\-extended\-parsing[=N]
] [
.B \-n, \-\-near
.B \-n\, \-\-near
] [
.B \-t, \-\-test
.B \-t\, \-\-test
] [
.B \-%L, \-\-list
.B \-%L\, \-\-list
] [
.B \-%S, \-\-urllist
.B \-%S\, \-\-urllist
] [
.B \-NN, \-\-structure[=N]
.B \-NN\, \-\-structure[=N]
] [
.B \-%D, \-\-cached\-delayed\-type\-check
.B \-%D\, \-\-cached\-delayed\-type\-check
] [
.B \-%M, \-\-mime\-html
.B \-%M\, \-\-mime\-html
] [
.B \-LN, \-\-long\-names[=N]
.B \-LN\, \-\-long\-names[=N]
] [
.B \-KN, \-\-keep\-links[=N]
.B \-KN\, \-\-keep\-links[=N]
] [
.B \-x, \-\-replace\-external
.B \-x\, \-\-replace\-external
] [
.B \-%x, \-\-disable\-passwords
.B \-%x\, \-\-disable\-passwords
] [
.B \-%q, \-\-include\-query\-string
.B \-%q\, \-\-include\-query\-string
] [
.B \-o, \-\-generate\-errors
.B \-o\, \-\-generate\-errors
] [
.B \-X, \-\-purge\-old[=N]
.B \-X\, \-\-purge\-old[=N]
] [
.B \-%p, \-\-preserve
.B \-%p\, \-\-preserve
] [
.B \-%T, \-\-utf8\-conversion
.B \-%T\, \-\-utf8\-conversion
] [
.B \-bN, \-\-cookies[=N]
.B \-bN\, \-\-cookies[=N]
] [
.B \-u, \-\-check\-type[=N]
.B \-u\, \-\-check\-type[=N]
] [
.B \-j, \-\-parse\-java[=N]
.B \-j\, \-\-parse\-java[=N]
] [
.B \-sN, \-\-robots[=N]
.B \-sN\, \-\-robots[=N]
] [
.B \-%h, \-\-http\-10
.B \-%h\, \-\-http\-10
] [
.B \-%k, \-\-keep\-alive
.B \-%k\, \-\-keep\-alive
] [
.B \-%B, \-\-tolerant
.B \-%B\, \-\-tolerant
] [
.B \-%s, \-\-updatehack
.B \-%s\, \-\-updatehack
] [
.B \-%u, \-\-urlhack
.B \-%u\, \-\-urlhack
] [
.B \-%A, \-\-assume
.B \-%A\, \-\-assume
] [
.B \-@iN, \-\-protocol[=N]
.B \-@iN\, \-\-protocol[=N]
] [
.B \-%w, \-\-disable\-module
.B \-%w\, \-\-disable\-module
] [
.B \-F, \-\-user\-agent
.B \-F\, \-\-user\-agent
] [
.B \-%R, \-\-referer
.B \-%R\, \-\-referer
] [
.B \-%E, \-\-from
.B \-%E\, \-\-from
] [
.B \-%F, \-\-footer
.B \-%F\, \-\-footer
] [
.B \-%l, \-\-language
.B \-%l\, \-\-language
] [
.B \-%a, \-\-accept
.B \-%a\, \-\-accept
] [
.B \-%X, \-\-headers
.B \-%X\, \-\-headers
] [
.B \-C, \-\-cache[=N]
.B \-C\, \-\-cache[=N]
] [
.B \-k, \-\-store\-all\-in\-cache
.B \-k\, \-\-store\-all\-in\-cache
] [
.B \-%n, \-\-do\-not\-recatch
.B \-%n\, \-\-do\-not\-recatch
] [
.B \-%v, \-\-display
.B \-%v\, \-\-display
] [
.B \-Q, \-\-do\-not\-log
.B \-Q\, \-\-do\-not\-log
] [
.B \-q, \-\-quiet
.B \-q\, \-\-quiet
] [
.B \-z, \-\-extra\-log
.B \-z\, \-\-extra\-log
] [
.B \-Z, \-\-debug\-log
.B \-Z\, \-\-debug\-log
] [
.B \-v, \-\-verbose
.B \-v\, \-\-verbose
] [
.B \-f, \-\-file\-log
.B \-f\, \-\-file\-log
] [
.B \-f2, \-\-single\-log
.B \-f2\, \-\-single\-log
] [
.B \-I, \-\-index
.B \-I\, \-\-index
] [
.B \-%i, \-\-build\-top\-index
.B \-%i\, \-\-build\-top\-index
] [
.B \-%I, \-\-search\-index
.B \-%I\, \-\-search\-index
] [
.B \-pN, \-\-priority[=N]
.B \-pN\, \-\-priority[=N]
] [
.B \-S, \-\-stay\-on\-same\-dir
.B \-S\, \-\-stay\-on\-same\-dir
] [
.B \-D, \-\-can\-go\-down
.B \-D\, \-\-can\-go\-down
] [
.B \-U, \-\-can\-go\-up
.B \-U\, \-\-can\-go\-up
] [
.B \-B, \-\-can\-go\-up\-and\-down
.B \-B\, \-\-can\-go\-up\-and\-down
] [
.B \-a, \-\-stay\-on\-same\-address
.B \-a\, \-\-stay\-on\-same\-address
] [
.B \-d, \-\-stay\-on\-same\-domain
.B \-d\, \-\-stay\-on\-same\-domain
] [
.B \-l, \-\-stay\-on\-same\-tld
.B \-l\, \-\-stay\-on\-same\-tld
] [
.B \-e, \-\-go\-everywhere
.B \-e\, \-\-go\-everywhere
] [
.B \-%H, \-\-debug\-headers
.B \-%H\, \-\-debug\-headers
] [
.B \-%!, \-\-disable\-security\-limits
.B \-%!\, \-\-disable\-security\-limits
] [
.B \-V, \-\-userdef\-cmd
.B \-V\, \-\-userdef\-cmd
] [
.B \-%W, \-\-callback
.B \-%W\, \-\-callback
] [
.B \-K, \-\-keep\-links[=N]
.B \-K\, \-\-keep\-links[=N]
] [
.B
.SH DESCRIPTION
@@ -191,7 +191,7 @@ allows you to download a World Wide Web site from the Internet to a local direct
mirror the two sites together (with shared links) and accept any .jpg files on .com sites
.TP
.B httrack www.someweb.com/bob/bobby.html +* \-r6
means get all files starting from bobby.html, with 6 link\-depth, and possibility of going everywhere on the web
means get all files starting from bobby.html\, with 6 link\-depth\, and possibility of going everywhere on the web
.TP
.B httrack www.someweb.com/bob/bobby.html \-\-spider \-P proxy.myhost.com:8080
runs the spider on www.someweb.com/bob/bobby.html using a proxy
@@ -208,7 +208,7 @@ continues a mirror in the current folder
.SS General options:
.IP \-O
path for mirror/logfiles+cache (\-O path
mirror[,path
mirror[\,path
cache
and
logfiles]) (\-\-path <param>)
@@ -217,7 +217,7 @@ logfiles]) (\-\-path <param>)
.IP \-w
*mirror web sites (\-\-mirror)
.IP \-W
mirror web sites, semi\-automatic (asks questions) (\-\-mirror\-wizard)
mirror web sites\, semi\-automatic (asks questions) (\-\-mirror\-wizard)
.IP \-g
just get files (saved in the current directory) (\-\-get\-files)
.IP \-i
@@ -240,34 +240,34 @@ set the mirror depth to N (* r9999) (\-\-depth[=N])
set the external links depth to N (* %e0) (\-\-ext\-depth[=N])
.IP \-mN
maximum file length for a non\-html file (\-\-max\-files[=N])
.IP \-mN,N2
.IP \-mN\,N2
maximum file length for non html (N) and html (N2)
.IP \-MN
maximum overall size that can be uploaded/scanned (\-\-max\-size[=N])
.IP \-EN
maximum mirror time in seconds (60=1 minute, 3600=1 hour) (\-\-max\-time[=N])
maximum mirror time in seconds (60=1 minute\, 3600=1 hour) (\-\-max\-time[=N])
.IP \-AN
maximum transfer rate in bytes/seconds (1000=1KB/s max) (\-\-max\-rate[=N])
.IP \-%cN
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])
pause transfer if N bytes reached\, and wait until lock file is deleted (\-\-max\-pause[=N])
.SS Flow control:
.IP \-cN
number of multiple connections (*c8) (\-\-sockets[=N])
.IP \-TN
timeout, number of seconds after a non\-responding link is shutdown (\-\-timeout[=N])
timeout\, number of seconds after a non\-responding link is shutdown (\-\-timeout[=N])
.IP \-RN
number of retries, in case of timeout or non\-fatal errors (*R1) (\-\-retries[=N])
number of retries\, in case of timeout or non\-fatal errors (*R1) (\-\-retries[=N])
.IP \-JN
traffic jam control, minimum transfert rate (bytes/seconds) tolerated for a link (\-\-min\-rate[=N])
traffic jam control\, minimum transfert rate (bytes/seconds) tolerated for a link (\-\-min\-rate[=N])
.IP \-HN
host is abandonned if: 0=never, 1=timeout, 2=slow, 3=timeout or slow (\-\-host\-control[=N])
host is abandonned if: 0=never\, 1=timeout\, 2=slow\, 3=timeout or slow (\-\-host\-control[=N])
.SS Links options:
.IP \-%P
*extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don t use) (\-\-extended\-parsing[=N])
*extended parsing\, attempt to parse all links\, even in unknown tags or Javascript (%P0 don t use) (\-\-extended\-parsing[=N])
.IP \-n
get non\-html files near an html file (ex: an image located outside) (\-\-near)
.IP \-t
@@ -279,25 +279,25 @@ test all URLs (even forbidden ones) (\-\-test)
.SS Build options:
.IP \-NN
structure type (0 *original structure, 1+: see below) (\-\-structure[=N])
structure type (0 *original structure\, 1+: see below) (\-\-structure[=N])
.IP \-or
user defined structure (\-N "%h%p/%n%q.%t")
.IP \-%N
delayed type check, don t make any link test but wait for files download to start instead (experimental) (%N0 don t use, %N1 use for unknown extensions, * %N2 always use)
delayed type check\, don t make any link test but wait for files download to start instead (experimental) (%N0 don t use\, %N1 use for unknown extensions\, * %N2 always use)
.IP \-%D
cached delayed type check, don t wait for remote type during updates, to speedup them (%D0 wait, * %D1 don t wait) (\-\-cached\-delayed\-type\-check)
cached delayed type check\, don t wait for remote type during updates\, to speedup them (%D0 wait\, * %D1 don t wait) (\-\-cached\-delayed\-type\-check)
.IP \-%M
generate a RFC MIME\-encapsulated full\-archive (.mht) (\-\-mime\-html)
.IP \-LN
long names (L1 *long names / L0 8\-3 conversion / L2 ISO9660 compatible) (\-\-long\-names[=N])
.IP \-KN
keep original links (e.g. http://www.adr/link) (K0 *relative link, K absolute links, K4 original links, K3 absolute URI links, K5 transparent proxy link) (\-\-keep\-links[=N])
keep original links (e.g. http://www.adr/link) (K0 *relative link\, K absolute links\, K4 original links\, K3 absolute URI links\, K5 transparent proxy link) (\-\-keep\-links[=N])
.IP \-x
replace external html links by error pages (\-\-replace\-external)
.IP \-%x
do not include any password for external password protected websites (%x0 include) (\-\-disable\-passwords)
.IP \-%q
*include query string for local files (useless, for information purpose only) (%q0 don t include) (\-\-include\-query\-string)
*include query string for local files (useless\, for information purpose only) (%q0 don t include) (\-\-include\-query\-string)
.IP \-o
*generate output html file in case of error (404..) (o0 don t generate) (\-\-generate\-errors)
.IP \-X
@@ -309,29 +309,29 @@ links conversion to UTF\-8 (\-\-utf8\-conversion)
.SS Spider options:
.IP \-bN
accept cookies in cookies.txt (0=do not accept,* 1=accept) (\-\-cookies[=N])
accept cookies in cookies.txt (0=do not accept\,* 1=accept) (\-\-cookies[=N])
.IP \-u
check document type if unknown (cgi,asp..) (u0 don t check, * u1 check but /, u2 check always) (\-\-check\-type[=N])
check document type if unknown (cgi\,asp..) (u0 don t check\, * u1 check but /\, u2 check always) (\-\-check\-type[=N])
.IP \-j
*parse Java Classes (j0 don t parse, bitmask: |1 parse default, |2 don t parse .class |4 don t parse .js |8 don t be aggressive) (\-\-parse\-java[=N])
*parse Java Classes (j0 don t parse\, bitmask: |1 parse default\, |2 don t parse .class |4 don t parse .js |8 don t be aggressive) (\-\-parse\-java[=N])
.IP \-sN
follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always, 3=always (even strict rules)) (\-\-robots[=N])
follow robots.txt and meta robots tags (0=never\,1=sometimes\,* 2=always\, 3=always (even strict rules)) (\-\-robots[=N])
.IP \-%h
force HTTP/1.0 requests (reduce update features, only for old servers or proxies) (\-\-http\-10)
force HTTP/1.0 requests (reduce update features\, only for old servers or proxies) (\-\-http\-10)
.IP \-%k
use keep\-alive if possible, greately reducing latency for small files and test requests (%k0 don t use) (\-\-keep\-alive)
use keep\-alive if possible\, greately reducing latency for small files and test requests (%k0 don t use) (\-\-keep\-alive)
.IP \-%B
tolerant requests (accept bogus responses on some servers, but not standard!) (\-\-tolerant)
tolerant requests (accept bogus responses on some servers\, but not standard!) (\-\-tolerant)
.IP \-%s
update hacks: various hacks to limit re\-transfers when updating (identical size, bogus response..) (\-\-updatehack)
update hacks: various hacks to limit re\-transfers when updating (identical size\, bogus response..) (\-\-updatehack)
.IP \-%u
url hacks: various hacks to limit duplicate URLs (strip //, www.foo.com==foo.com..) (\-\-urlhack)
url hacks: various hacks to limit duplicate URLs (strip //\, www.foo.com==foo.com..) (\-\-urlhack)
.IP \-%A
assume that a type (cgi,asp..) is always linked with a mime type (\-%A php3,cgi=text/html;dat,bin=application/x\-zip) (\-\-assume <param>)
assume that a type (cgi\,asp..) is always linked with a mime type (\-%A php3\,cgi=text/html;dat\,bin=application/x\-zip) (\-\-assume <param>)
.IP \-can
also be used to force a specific file type: \-\-assume foo.cgi=text/html
.IP \-@iN
internet protocol (0=both ipv6+ipv4, 4=ipv4 only, 6=ipv6 only) (\-\-protocol[=N])
internet protocol (0=both ipv6+ipv4\, 4=ipv4 only\, 6=ipv6 only) (\-\-protocol[=N])
.IP \-%w
disable a specific external mime module (\-%w htsswf \-%w htsjava) (\-\-disable\-module <param>)
@@ -345,15 +345,15 @@ from email address sent in HTTP headers (\-\-from <param>)
.IP \-%F
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>)
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>)
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
.SS Log\, index\, cache
.IP \-C
create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before) (\-\-cache[=N])
create/use a cache for updates and retries (C0 no cache\,C1 cache is prioritary\,* C2 test update before) (\-\-cache[=N])
.IP \-k
store all files in cache (not useful if files on disk) (\-\-store\-all\-in\-cache)
.IP \-%n
@@ -385,7 +385,7 @@ make an searchable index for this mirror (* %I0 don t make) (\-\-search\-index)
.IP \-pN
priority mode: (* p3) (\-\-priority[=N])
.IP \-p0
just scan, don t save anything (for checking links)
just scan\, don t save anything (for checking links)
.IP \-p1
save only html files
.IP \-p2
@@ -393,7 +393,7 @@ save only non html files
.IP \-*p3
save all files
.IP \-p7
get html files before, then treat other files
get html files before\, then treat other files
.IP \-S
stay on the same directory (\-\-stay\-on\-same\-dir)
.IP \-D
@@ -455,35 +455,35 @@ generate transfer rate statictics every minutes (\-\-debug\-ratestats)
.SS Dangerous options: (do NOT use unless you exactly know what you are doing)
.IP \-%!
bypass built\-in security limits aimed to avoid bandwidth abuses (bandwidth, simultaneous connections) (\-\-disable\-security\-limits)
bypass built\-in security limits aimed to avoid bandwidth abuses (bandwidth\, simultaneous connections) (\-\-disable\-security\-limits)
.IP \-IMPORTANT
NOTE: DANGEROUS OPTION, ONLY SUITABLE FOR EXPERTS
NOTE: DANGEROUS OPTION\, ONLY SUITABLE FOR EXPERTS
.IP \-USE
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>)
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>)
use an external library function as a wrapper (\-%W myfoo.so[\,myparameters]) (\-\-callback <param>)
.SS Details: Option N
.IP \-N0
Site\-structure (default)
.IP \-N1
HTML in web/, images/other files in web/images/
HTML in web/\, images/other files in web/images/
.IP \-N2
HTML in web/HTML, images/other in web/images
HTML in web/HTML\, images/other in web/images
.IP \-N3
HTML in web/, images/other in web/
HTML in web/\, images/other in web/
.IP \-N4
HTML in web/, images/other in web/xxx, where xxx is the file extension (all gif will be placed onto web/gif, for example)
HTML in web/\, images/other in web/xxx\, where xxx is the file extension (all gif will be placed onto web/gif\, for example)
.IP \-N5
Images/other in web/xxx and HTML in web/HTML
.IP \-N99
All files in web/, with random names (gadget !)
All files in web/\, with random names (gadget !)
.IP \-N100
Site\-structure, without www.domain.xxx/
Site\-structure\, without www.domain.xxx/
.IP \-N101
Identical to N1 exept that "web" is replaced by the site s name
.IP \-N102
@@ -510,15 +510,15 @@ Identical to N5 exept that there is no "web" directory
Identical to N99 exept that there is no "web" directory
.SS Details: User\-defined option N
%n Name of file without file type (ex: image)
%N Name of file, including file type (ex: image.gif)
%N Name of file\, including file type (ex: image.gif)
%t File type (ex: gif)
%p Path [without ending /] (ex: /someimages)
%h Host name (ex: www.someweb.com)
%M URL MD5 (128 bits, 32 ascii bytes)
%Q query string MD5 (128 bits, 32 ascii bytes)
%M URL MD5 (128 bits\, 32 ascii bytes)
%Q query string MD5 (128 bits\, 32 ascii bytes)
%k full query string
%r protocol name (ex: http)
%q small query string MD5 (16 bits, 4 ascii bytes)
%q small query string MD5 (16 bits\, 4 ascii bytes)
%s? Short name version (ex: %sN)
%[param] param variable in query string
%[param:before:after:empty:notfound] advanced variable extraction
@@ -535,11 +535,11 @@ Identical to N99 exept that there is no "web" directory
.IP \-empty
: string replacement if the parameter was empty
.IP \-all
fields, except the first one (the parameter name), can be empty
fields\, except the first one (the parameter name)\, can be empty
.SS Details: Option K
.IP \-K0
foo.cgi?q=45 \-> foo4B54.html?q=45 (relative URI, default)
foo.cgi?q=45 \-> foo4B54.html?q=45 (relative URI\, default)
.IP \-K
\-> http://www.foobar.com/folder/foo.cgi?q=45 (absolute URL) (\-\-keep\-links[=N])
.IP \-K3
@@ -553,7 +553,7 @@ foo.cgi?q=45 \-> foo4B54.html?q=45 (relative URI, default)
.IP \-\-mirror
<URLs> *make a mirror of site(s) (default)
.IP \-\-get
<URLs> get the files indicated, do not seek other URLs (\-qg)
<URLs> get the files indicated\, do not seek other URLs (\-qg)
.IP \-\-list
<text file> add all URL located in this text file (\-%L)
.IP \-\-mirrorlinks
@@ -561,15 +561,15 @@ foo.cgi?q=45 \-> foo4B54.html?q=45 (relative URI, default)
.IP \-\-testlinks
<URLs> test links in pages (\-r1p0C0I0t)
.IP \-\-spider
<URLs> spider site(s), to test links: reports Errors & Warnings (\-p0C0I0t)
<URLs> spider site(s)\, to test links: reports Errors & Warnings (\-p0C0I0t)
.IP \-\-testsite
<URLs> identical to \-\-spider
.IP \-\-skeleton
<URLs> make a mirror, but gets only html files (\-p1)
<URLs> make a mirror\, but gets only html files (\-p1)
.IP \-\-update
update a mirror, without confirmation (\-iC2)
update a mirror\, without confirmation (\-iC2)
.IP \-\-continue
continue a mirror, without confirmation (\-iC1)
continue a mirror\, without confirmation (\-iC1)
.IP \-\-catchurl
create a temporary proxy to capture an URL or a form post URL

View File

@@ -517,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,

View File

@@ -54,9 +54,12 @@ 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

View File

@@ -77,25 +77,40 @@ 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, /* 128 bytes */ char *adr) {
HTSEXT_API T_SOC catch_url_init(int *port, char *adr) {
T_SOC soc = INVALID_SOCKET;
char h_loc[256];
char h_loc[256 + 2];
if (gethostname(h_loc, sizeof(h_loc)) == 0) { // host name
if (gethostname(h_loc, 256) == 0) { // host name
SOCaddr server;
if (hts_dns_resolve_nocache(h_loc, &server) != NULL) { // notre host
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 ((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 (bind(soc, (struct sockaddr *) &server, server_size) == 0) {
SOCaddr server2;
SOClen len = SOCaddr_capacity(server2);
SOClen len;
if (getsockname(soc, &SOCaddr_sockaddr(server2), &len) == 0) {
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, 1) >= 0) {
SOCaddr_inetntoa(adr, 128, server2);
if (listen(soc, 10) >= 0) { // au pif le 10
SOCaddr_inetntoa(adr, 128, server2, len);
} else {
#ifdef _WIN32
closesocket(soc);
@@ -153,13 +168,15 @@ HTSEXT_API int catch_url(T_SOC soc, char *url, char *method, char *data) {
/* INFOS */
{
SOCaddr server2;
SOClen len = SOCaddr_capacity(server2);
SOClen len = sizeof(server2);
if (getpeername(soc, &SOCaddr_sockaddr(server2), &len) == 0) {
// effacer structure
memset(&server2, 0, sizeof(server2));
if (getpeername(soc, (struct sockaddr *) &server2, &len) == 0) {
char dot[256 + 2];
SOCaddr_inetntoa(dot, sizeof(dot), server2);
sprintf(url, "%s:%d", dot, ntohs(SOCaddr_sinport(server2)));
SOCaddr_inetntoa(dot, 256, server2, sizeof(server2));
sprintf(url, "%s:%d", dot, htons(SOCaddr_sinport(server2)));
}
}
/* INFOS */

View File

@@ -966,29 +966,24 @@ 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) do { \
if ((C) != -1) { \
/* copy character */ \
assertf(segOutputSize < segSize); \
segInt[segOutputSize++] = (C); \
} \
/* In case of error, abort. */ \
else { \
FREE_BUFFER(); \
return NULL; \
} \
} while(0)
#define WR(C) uc = C != -1 ? (punycode_uint) C : (punycode_uint) 0xfffd
/* Read/Write Unicode character. */
/* Read Unicode character. */
READ_UNICODE(RD, WR);
#undef RD
#undef WR
/* copy character */
assertf(segOutputSize < segSize);
segInt[segOutputSize++] = uc;
/* not anymore in sequence */
utfSeq = (size_t) -1;
}

View File

@@ -2355,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);
hash_invalidate_entry(opt->hash, i); // invalidate hashtable entry
strcpybuff(liens[i]->adr, "!"); // cancel (invalide hash)
// on efface pas le hash, because si on rencontre le lien, reverif sav..
}
} else {

View File

@@ -232,6 +232,7 @@ 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';

View File

@@ -147,12 +147,16 @@ 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';
@@ -245,6 +249,8 @@ 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";
@@ -264,7 +270,8 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
// récupérer adresse résolue
strcpybuff(back->info, "host name");
if (hts_dns_resolve2(opt, _adr, &server, &error) == NULL) {
hp = hts_gethostbyname2(opt, _adr, &fullhostent_buffer, &error);
if (hp == NULL) {
snprintf(back->r.msg, sizeof(back->r.msg),
"Unable to get server's address: %s", error);
// back->status=STATUS_FTP_READY; // fini
@@ -273,8 +280,12 @@ 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_copy_SOCaddr(server_data, server);
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);
// créer ("attachement") une socket (point d'accès) internet,en flot
soc_ctl = (T_SOC) socket(SOCaddr_sinfamily(server), SOCK_STREAM, 0);
@@ -291,7 +302,12 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
// connexion (bloquante, on est en thread)
strcpybuff(back->info, "connect");
if (connect(soc_ctl, &SOCaddr_sockaddr(server), SOCaddr_size(server)) != 0) {
#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
strcpybuff(back->r.msg, "Unable to connect to the server");
// back->status=STATUS_FTP_READY; // fini
back->r.statuscode = STATUSCODE_INVALID;
@@ -403,7 +419,7 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
// Pré-REST
//
#if FTP_PASV
if (SOCaddr_getproto(server) == '1') {
if (SOCaddr_getproto(server, server_size) == '1') {
strcpybuff(back->info, "pasv");
snprintf(line, sizeof(line), "PASV");
send_line(soc_ctl, line);
@@ -565,6 +581,7 @@ 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
@@ -575,9 +592,16 @@ int run_launch_ftp(FTPDownloadStruct * pStruct) {
// résoudre
if (adr_ip[0]) {
hts_dns_resolve2(opt, adr_ip, &server, &error);
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;
}
} else {
SOCaddr_copy_SOCaddr(server, server_data);
memcpy(&server, &server_data, sizeof(server_data));
server_size = server_data_size;
}
// infos
@@ -591,7 +615,15 @@ 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);
if (connect(soc_dat, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
// 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
strcpybuff(back->info, "retr");
strcpybuff(line, line_retr);
send_line(soc_ctl, line);
@@ -824,19 +856,33 @@ 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, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
if (bind(soc, (struct sockaddr *) &server, server_size) == 0) {
SOCaddr server2;
SOClen len = SOCaddr_capacity(server2);
SOClen len;
if (getsockname(soc, &SOCaddr_sockaddr(server2), &len) == 0) {
len = sizeof(server2);
// effacer structure
memset(&server2, 0, sizeof(server2));
if (getsockname(soc, (struct sockaddr *) &server2, &len) == 0) {
// *port=ntohs(server.sin_port); // récupérer port
if (listen(soc, 1) >= 0) {
if (listen(soc, 10) >= 0) { // au pif le 10
#if HTS_INET6==0
unsigned short int a, n1, n2;
@@ -849,7 +895,7 @@ T_SOC get_datasocket(char *to_send, size_t to_send_size) {
char dot[256 + 2];
char *a;
SOCaddr_inetntoa(dot, 256, server2);
SOCaddr_inetntoa(dot, 256, server2, sizeof(server2));
//
dots[0] = '\0';
strncatbuff(dots, dot, 128);
@@ -867,9 +913,9 @@ T_SOC get_datasocket(char *to_send, size_t to_send_size) {
{
char dot[256 + 2];
SOCaddr_inetntoa(dot, 256, server2);
SOCaddr_inetntoa(dot, 256, server2, len);
snprintf(to_send, to_send_size, "EPRT |%c|%s|%d|",
SOCaddr_getproto(server2), dot,
SOCaddr_getproto(server2, len), dot,
SOCaddr_sinport(server2));
}
#endif
@@ -1047,7 +1093,7 @@ int check_socket(T_SOC soc) {
tv.tv_sec = 0;
tv.tv_usec = 0;
// poll!
select((int) soc + 1, &fds, NULL, &fds_e, &tv);
select(soc + 1, &fds, NULL, &fds_e, &tv);
if (FD_ISSET(soc, &fds_e)) { // error detected
return -1;
} else if (FD_ISSET(soc, &fds)) {
@@ -1070,7 +1116,7 @@ int check_socket_connect(T_SOC soc) {
tv.tv_sec = 0;
tv.tv_usec = 0;
// poll!
select((int) soc + 1, NULL, &fds, &fds_e, &tv);
select(soc + 1, NULL, &fds, &fds_e, &tv);
if (FD_ISSET(soc, &fds_e)) { // error detected
return -1;
} else if (FD_ISSET(soc, &fds)) {

View File

@@ -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-9"
#define HTTRACK_VERSIONID "3.48.9"
#define HTTRACK_VERSION "3.48-5"
#define HTTRACK_VERSIONID "3.48.5"
#define HTTRACK_AFF_VERSION "3.x"
#define HTTRACK_LIB_VERSION "2.0"

View File

@@ -85,14 +85,6 @@ 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) {
@@ -159,31 +151,6 @@ 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);
@@ -240,20 +207,6 @@ void hash_init(httrackp *opt, 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) {
@@ -319,14 +272,3 @@ 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");
}
}

View File

@@ -56,7 +56,6 @@ 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

View File

@@ -187,16 +187,6 @@ struct struct_inthash {
/** 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;
};
@@ -899,62 +889,10 @@ 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_log_stats(hashtable);
inthash_assert(hashtable, ! "hashtable internal error: cuckoo/stash collision");
/* not reachable code */
return -1;
}
@@ -996,7 +934,7 @@ int inthash_write_value(inthash hashtable, const char *name,
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);
hashtable->used, half_size*2);
}
/* statistics */
@@ -1297,13 +1235,9 @@ 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;
}
@@ -1354,20 +1288,12 @@ void inthash_set_assert_handler(inthash hashtable,
t_inthash_loghandler log,
t_inthash_asserthandler fatal,
void *arg) {
inthash_assert(hashtable, fatal != NULL);
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;

View File

@@ -67,7 +67,6 @@ typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#include <stdarg.h>
/** Value. **/
typedef union inthash_value {
@@ -141,12 +140,6 @@ typedef void (*t_inthash_loghandler)(void *arg, inthash_loglevel level,
/** 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).
**/
@@ -247,18 +240,6 @@ void inthash_set_assert_handler(inthash hashtable,
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)

View File

@@ -62,7 +62,6 @@ Please visit our Website: http://www.httrack.com
#include <unistd.h>
#endif
#endif /* _WIN32 */
#include <stdarg.h>
#include <string.h>
#include <time.h>
@@ -84,13 +83,6 @@ static long int timezone = 0;
#include <sys/stat.h>
/* END specific definitions */
/* Windows might be missing va_copy */
#ifdef _WIN32
#ifndef va_copy
#define va_copy(dst, src) ((dst) = (src))
#endif
#endif
// Debugging
#if _HTS_WIDE
FILE *DEBUG_fp = NULL;
@@ -2126,16 +2118,27 @@ htsblk http_test(httrackp * opt, char *adr, char *fil, char *loc) {
// peut ouvrir avec des connect() non bloquants: waitconnect=0/1
T_SOC newhttp(httrackp * opt, const char *_iadr, htsblk * retour, int port,
int waitconnect) {
t_fullhostent fullhostent_buffer; // buffer pour resolver
T_SOC soc; // descipteur de la socket
char *iadr;
// unsigned short int port;
// si iadr="#" alors c'est une fausse URL, mais un vrai fichier
// local.
// utile pour les tests!
//## if (iadr[0]!=lOCAL_CHAR) {
if (strcmp(_iadr, "file://") != 0) { /* non fichier */
SOCaddr server;
int server_size = sizeof(server);
t_hostent *hp;
const char *error = "unknown error";
// tester un éventuel id:pass et virer id:pass@ si détecté
const char *const iadr = jump_identification(_iadr);
// effacer structure
memset(&server, 0, sizeof(server));
SOCaddr_clear(server);
// tester un éventuel id:pass et virer id:pass@ si détecté
iadr = jump_identification(_iadr);
#if HDEBUG
printf("gethostbyname\n");
@@ -2153,8 +2156,7 @@ T_SOC newhttp(httrackp * opt, const char *_iadr, htsblk * retour, int port,
#else
port = 80; // port par défaut
#endif
if (a != NULL) {
if (a) {
char BIGSTK iadr2[HTS_URLMAXSIZE * 2];
int i = -1;
@@ -2163,24 +2165,25 @@ T_SOC newhttp(httrackp * opt, const char *_iadr, htsblk * retour, int port,
if (i != -1) {
port = (unsigned short int) i;
}
// adresse véritable (sans :xx)
strncatbuff(iadr2, iadr, (int) (a - iadr));
// adresse sans le :xx
hts_dns_resolve2(opt, iadr2, &server, &error);
hp = hts_gethostbyname2(opt, iadr2, &fullhostent_buffer, &error);
} else {
// adresse normale (port par défaut par la suite)
hts_dns_resolve2(opt, iadr, &server, &error);
hp = hts_gethostbyname2(opt, iadr, &fullhostent_buffer, &error);
}
} else { // port défini
hts_dns_resolve2(opt, iadr, &server, &error);
}
} else // port défini
hp = hts_gethostbyname2(opt, iadr, &fullhostent_buffer, &error);
if (!SOCaddr_is_valid(server)) {
// Conversion iadr -> adresse
// structure recevant le nom de l'hôte, etc
//struct hostent *hp;
if (hp == NULL) {
#if DEBUG
printf("erreur gethostbyname\n");
#endif
@@ -2195,10 +2198,13 @@ T_SOC newhttp(httrackp * opt, const char *_iadr, htsblk * retour, int port,
}
return INVALID_SOCKET;
}
// copie adresse
SOCaddr_copyaddr(server, server_size, hp->h_addr_list[0], hp->h_length);
// make a copy for external clients
SOCaddr_copy_SOCaddr(retour->address, server);
retour->address_size = SOCaddr_size(retour->address);
retour->address_size = sizeof(retour->address);
SOCaddr_copyaddr(retour->address, retour->address_size, hp->h_addr_list[0],
hp->h_length);
// memcpy(&SOCaddr_sinaddr(server), hp->h_addr_list[0], hp->h_length);
// créer ("attachement") une socket (point d'accès) internet,en flot
#if HDEBUG
@@ -2232,13 +2238,14 @@ T_SOC newhttp(httrackp * opt, const char *_iadr, htsblk * retour, int port,
}
// bind this address
if (retour != NULL && strnotempty(retour->req.proxy.bindhost)) {
t_fullhostent bind_buffer;
const char *error = "unknown error";
SOCaddr bind_addr;
if (hts_dns_resolve2(opt, retour->req.proxy.bindhost,
&bind_addr, &error) == NULL
|| bind(soc, &SOCaddr_sockaddr(bind_addr),
SOCaddr_size(bind_addr)) != 0) {
hp = hts_gethostbyname2(opt, retour->req.proxy.bindhost, &bind_buffer,
&error);
if (hp == NULL
|| bind(soc, (struct sockaddr *) hp->h_addr_list[0],
hp->h_length) != 0) {
if (retour && retour->msg) {
#ifdef _WIN32
snprintf(retour->msg, sizeof(retour->msg),
@@ -2290,20 +2297,25 @@ T_SOC newhttp(httrackp * opt, const char *_iadr, htsblk * retour, int port,
#if HTS_WIDE_DEBUG
DEBUG_W("connect\n");
#endif
if (connect(soc, &SOCaddr_sockaddr(server), SOCaddr_size(server)) != 0) {
#ifdef _WIN32
if (connect(soc, (const struct sockaddr FAR *) &server, server_size) != 0) {
#else
if (connect(soc, (struct sockaddr *) &server, server_size) == -1) {
#endif
// bloquant
if (waitconnect) {
#if HDEBUG
printf("unable to connect!\n");
#endif
if (retour != NULL && retour->msg) {
if (retour && retour->msg) {
#ifdef _WIN32
const int last_errno = WSAGetLastError();
int last_errno = WSAGetLastError();
sprintf(retour->msg, "Unable to connect to the server: %s",
strerror(last_errno));
#else
const int last_errno = errno;
int last_errno = errno;
sprintf(retour->msg, "Unable to connect to the server: %s",
strerror(last_errno));
@@ -2971,7 +2983,7 @@ int sendc(htsblk * r, const char *s) {
}
// Remplace read
int finput(T_SOC fd, char *s, int max) {
int finput(int fd, char *s, int max) {
char c;
int j = 0;
@@ -4399,10 +4411,8 @@ HTSEXT_API char *hts_rootdir(char *file) {
strc.path[0] = '\0';
strc.init = 1;
if (strnotempty(file)) {
const size_t file_len = strlen(file);
char *a;
assertf(file_len < sizeof(strc.path));
strcpybuff(strc.path, file);
while((a = strrchr(strc.path, '\\')))
*a = '/';
@@ -4412,7 +4422,7 @@ HTSEXT_API char *hts_rootdir(char *file) {
strc.path[0] = '\0';
}
if (!strnotempty(strc.path)) {
if (getcwd(strc.path, sizeof(strc.path)) == NULL)
if (getcwd(strc.path, 1024) == NULL)
strc.path[0] = '\0';
else
strcatbuff(strc.path, "/");
@@ -4548,6 +4558,7 @@ int hts_read(htsblk * r, char *buff, int size) {
// -- Gestion cache DNS --
// 'RX98
#if HTS_DNSCACHE
// 'capsule' contenant uniquement le cache
t_dnscache *_hts_cache(httrackp * opt) {
@@ -4581,47 +4592,63 @@ void hts_cache_free(t_dnscache *const root) {
// routine pour le cache - retour optionnel à donner à chaque fois
// NULL: nom non encore testé dans le cache
// si h_length==0 alors le nom n'existe pas dans le dns
static SOCaddr* hts_ghbn(const t_dnscache *cache, const char *const iadr, SOCaddr *const addr) {
assertf(addr != NULL);
static t_hostent *hts_ghbn(const t_dnscache *cache, const char *const iadr, t_hostent *retour) {
for(; cache != NULL; cache = cache->n) {
assertf(cache != NULL);
assertf(iadr != NULL);
if (cache->iadr != NULL && strcmp(cache->iadr, iadr) == 0) { // ok trouvé
if (cache->host_length > 0) { // entrée valide
SOCaddr_copyaddr2(*addr, cache->host_addr, cache->host_length);
return addr;
if (retour->h_addr_list[0])
memcpy(retour->h_addr_list[0], cache->host_addr, cache->host_length);
retour->h_length = cache->host_length;
} else if (cache->host_length == 0) { // en cours
return NULL;
} else { // erreur dans le dns, déja vérifié
SOCaddr_clear(*addr);
return addr;
if (retour->h_addr_list[0])
retour->h_addr_list[0][0] = '\0';
retour->h_length = 0; // erreur, n'existe pas
}
return retour;
}
}
return NULL;
}
static SOCaddr* hts_dns_resolve_nocache2_(const char *const hostname,
SOCaddr *const addr,
const char **error) {
static t_hostent *vxgethostbyname2_(const char *const hostname,
void *const v_buffer, const char **error) {
t_fullhostent *buffer = (t_fullhostent *) v_buffer;
/* Clear */
fullhostent_init(buffer);
{
#if HTS_INET6==0
/* IPv4 resolver */
struct hostent *const hp = gethostbyname(hostname);
/*
ipV4 resolver
*/
t_hostent *hp = gethostbyname(hostname);
if (hp != NULL) {
SOCaddr_copyaddr2(addr, hp->h_addr_list[0], hp->h_length);
return SOCaddr_is_valid(addr) ? &addr : NULL;
} else {
SOCaddr_clear(*addr);
if ((hp->h_length)
&& (((unsigned int) hp->h_length) <= buffer->addr_maxlen)) {
memcpy(buffer->hp.h_addr_list[0], hp->h_addr_list[0], hp->h_length);
buffer->hp.h_length = hp->h_length;
return &(buffer->hp);
}
}
#else
/* IPv6 resolver */
/*
ipV6 resolver
*/
/*
int error_num=0;
t_hostent* hp=getipnodebyname(hostname, AF_INET6, AI_DEFAULT, &error_num);
oops, deprecated :(
*/
struct addrinfo *res = NULL;
struct addrinfo hints;
int gerr;
SOCaddr_clear(*addr);
memset(&hints, 0, sizeof(hints));
if (IPV6_resolver == 1) // V4 only (for bogus V6 entries)
hints.ai_family = PF_INET;
@@ -4632,9 +4659,13 @@ static SOCaddr* hts_dns_resolve_nocache2_(const char *const hostname,
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
if ( ( gerr = getaddrinfo(hostname, NULL, &hints, &res) ) == 0) {
if (res != NULL) {
if (res->ai_addr != NULL && res->ai_addrlen != 0) {
SOCaddr_copyaddr2(*addr, res->ai_addr, res->ai_addrlen);
if (res) {
if ((res->ai_addr) && (res->ai_addrlen)
&& (res->ai_addrlen <= buffer->addr_maxlen)) {
memcpy(buffer->hp.h_addr_list[0], res->ai_addr, res->ai_addrlen);
buffer->hp.h_length = (short) res->ai_addrlen;
freeaddrinfo(res);
return &(buffer->hp);
}
}
} else {
@@ -4647,12 +4678,11 @@ static SOCaddr* hts_dns_resolve_nocache2_(const char *const hostname,
}
#endif
}
return SOCaddr_is_valid(*addr) ? addr : NULL;
return NULL;
}
HTSEXT_API SOCaddr* hts_dns_resolve_nocache2(const char *const hostname,
SOCaddr *const addr, const char **error) {
HTSEXT_API t_hostent *vxgethostbyname2(const char *const hostname,
void *const v_buffer, const char **error) {
/* Protection */
if (!strnotempty(hostname)) {
return NULL;
@@ -4663,40 +4693,43 @@ HTSEXT_API SOCaddr* hts_dns_resolve_nocache2(const char *const hostname,
The resolver doesn't seem to handle IP6 addresses in brackets
*/
if ((hostname[0] == '[') && (hostname[strlen(hostname) - 1] == ']')) {
SOCaddr *ret;
t_hostent *ret;
size_t size = strlen(hostname);
char *copy = malloct(size + 1);
assertf(copy != NULL);
copy[0] = '\0';
strncat(copy, hostname + 1, size - 2);
ret = hts_dns_resolve_nocache2_(copy, addr, error);
ret = vxgethostbyname2_(copy, v_buffer, error);
freet(copy);
return ret;
} else {
return hts_dns_resolve_nocache2_(hostname, addr, error);
return vxgethostbyname2_(hostname, v_buffer, error);
}
}
HTSEXT_API SOCaddr* hts_dns_resolve_nocache(const char *const hostname, SOCaddr *const addr) {
return hts_dns_resolve_nocache2(hostname, addr, NULL);
HTSEXT_API t_hostent *vxgethostbyname(const char *const hostname, void *v_buffer) {
return vxgethostbyname2(hostname, v_buffer, NULL);
}
HTSEXT_API int check_hostname_dns(const char *const hostname) {
SOCaddr buffer;
return hts_dns_resolve_nocache(hostname, &buffer) != NULL;
t_fullhostent buffer;
return vxgethostbyname(hostname, &buffer) != NULL;
}
// Needs locking
// cache dns interne à HTS // ** FREE A FAIRE sur la chaine
static SOCaddr* hts_dns_resolve_(httrackp * opt, const char *_iadr,
SOCaddr *const addr, const char **error) {
static t_hostent *hts_gethostbyname_(httrackp * opt, const char *_iadr, void *v_buffer, const char **error) {
char BIGSTK iadr[HTS_URLMAXSIZE * 2];
t_fullhostent *buffer = (t_fullhostent *) v_buffer;
t_dnscache *cache = _hts_cache(opt); // adresse du cache
SOCaddr *sa;
t_hostent *hp;
assertf(opt != NULL);
assertf(_iadr != NULL);
assertf(addr != NULL);
assertf(v_buffer != NULL);
/* Clear */
fullhostent_init(buffer);
strcpybuff(iadr, jump_identification(_iadr));
// couper éventuel :
@@ -4708,56 +4741,92 @@ static SOCaddr* hts_dns_resolve_(httrackp * opt, const char *_iadr,
}
/* get IP from the dns cache */
sa = hts_ghbn(cache, iadr, addr);
if (sa != NULL) {
return SOCaddr_is_valid(*sa) ? sa : NULL;
hp = hts_ghbn(cache, iadr, &buffer->hp);
if (hp) {
if (hp->h_length > 0)
return hp;
else
return NULL; // entrée erronée (erreur DNS) dans le DNS
} else { // non présent dans le cache dns, tester
// find queue
for(; cache->n != NULL; cache = cache->n) ;
#if DEBUGDNS
printf("resolving (not cached) %s\n", iadr);
#if HTS_WIDE_DEBUG
DEBUG_W("gethostbyname\n");
#endif
#if HDEBUG
printf("gethostbyname (not in cache)\n");
#endif
{
unsigned long inetaddr;
sa = hts_dns_resolve_nocache2(iadr, addr, error); // calculer IP host
#ifdef _WIN32
if ((inetaddr = inet_addr(iadr)) == INADDR_NONE) {
#else
if ((inetaddr = inet_addr(iadr)) == (in_addr_t) - 1) {
#endif
#if DEBUGDNS
printf("resolving (not cached) %s\n", iadr);
#endif
hp = vxgethostbyname2(iadr, buffer, error); // calculer IP host
} else { // numérique, convertir sans passer par le dns
buffer->hp.h_addr_list[0] = (char *) &inetaddr;
buffer->hp.h_length = 4;
hp = &buffer->hp;
}
}
#if HTS_WIDE_DEBUG
DEBUG_W("gethostbyname done\n");
#endif
/* attempt to store new entry */
cache->n = (t_dnscache *) calloct(1, sizeof(t_dnscache));
if (cache->n != NULL) {
strcpybuff(cache->n->iadr, iadr);
if (sa != NULL) {
cache->n->host_length = SOCaddr_size(*sa);
assertf(cache->n->host_length < sizeof(cache->n->host_addr));
memcpy(cache->n->host_addr, &SOCaddr_sockaddr(*sa), cache->n->host_length);
if (hp != NULL) {
memcpy(cache->n->host_addr, hp->h_addr_list[0], hp->h_length);
cache->n->host_length = hp->h_length;
} else {
cache->n->host_addr[0] = '\0';
cache->n->host_length = 0; // non existant dans le dns
}
cache->n->n = NULL;
return sa;
return hp;
} else { // on peut pas noter, mais on peut renvoyer le résultat
return hp;
}
/* return result if any */
return sa;
} // retour hp du cache
}
SOCaddr* hts_dns_resolve2(httrackp * opt, const char *_iadr, SOCaddr *const addr, const char **error) {
SOCaddr *ret;
t_hostent *hts_gethostbyname2(httrackp * opt, const char *_iadr, void *v_buffer, const char **error) {
t_hostent *ret;
hts_mutexlock(&opt->state.lock);
ret = hts_dns_resolve_(opt, _iadr, addr, error);
ret = hts_gethostbyname_(opt, _iadr, v_buffer, error);
hts_mutexrelease(&opt->state.lock);
return ret;
}
SOCaddr* hts_dns_resolve(httrackp * opt, const char *_iadr, SOCaddr *const addr) {
return hts_dns_resolve2(opt, _iadr, addr, NULL);
t_hostent *hts_gethostbyname(httrackp * opt, const char *_iadr, void *v_buffer) {
return hts_gethostbyname2(opt ,_iadr, v_buffer, NULL);
}
#else
static HTS_INLINE t_hostent *hts_gethostbyname(httrackp * opt, char *iadr,
t_fullhostent * buffer) {
t_hostent *retour;
#if HTS_WIDE_DEBUG
DEBUG_W("gethostbyname (2)\n");
#endif
#if DEBUGDNS
printf("blocking method gethostbyname() in progress for %s\n", iadr);
#endif
retour = vxgethostbyname(jump_identification(iadr),);
#if HTS_WIDE_DEBUG
DEBUG_W("gethostbyname (2) done\n");
#endif
return retour;
}
#endif
// --- Tracage des mallocs() ---
#ifdef HTS_TRACE_MALLOC
//#define htsLocker(A, N) htsLocker(A, N)
@@ -5043,17 +5112,6 @@ static int ssl_vulnerable(const char *version) {
return 0;
}
/* user abort callback */
htsErrorCallback htsCallbackErr = NULL;
HTSEXT_API void hts_set_error_callback(htsErrorCallback handler) {
htsCallbackErr = handler;
}
HTSEXT_API htsErrorCallback hts_get_error_callback() {
return htsCallbackErr;
}
static void default_inthash_asserthandler(void *arg, const char* exp, const char* file, int line) {
abortf_(exp, file, line);
}
@@ -5220,21 +5278,8 @@ HTSEXT_API int hts_log(httrackp * opt, const char *prefix, const char *msg) {
return 1; /* Error */
}
static void (*hts_log_print_callback)(httrackp * opt, int type, const char *format, va_list args) = NULL;
HTSEXT_API void hts_set_log_vprint_callback(void (*callback)(httrackp * opt,
int type, const char *format, va_list args)) {
hts_log_print_callback = callback;
}
HTSEXT_API void hts_log_vprint(httrackp * opt, int type, const char *format, va_list args) {
assertf(format != NULL);
if (hts_log_print_callback != NULL) {
va_list args_copy;
va_copy(args_copy, args);
hts_log_print_callback(opt, type, format, args);
va_end(args_copy);
}
if (opt != NULL && opt->log != NULL) {
const int save_errno = errno;
const char *s_type = "unknown";
@@ -5280,11 +5325,13 @@ HTSEXT_API void hts_log_vprint(httrackp * opt, int type, const char *format, va_
}
HTSEXT_API void hts_log_print(httrackp * opt, int type, const char *format, ...) {
va_list args;
assertf(format != NULL);
va_start(args, format);
hts_log_vprint(opt, type, format, args);
va_end(args);
if (opt != NULL && opt->log != NULL) {
va_list args;
va_start(args, format);
hts_log_vprint(opt, type, format, args);
va_end(args);
}
}
HTSEXT_API void set_wrappers(httrackp * opt) { // LEGACY
@@ -5788,56 +5835,68 @@ const t_hts_htmlcheck_callbacks default_callbacks = {
{htsdefault_parse, NULL}
};
#define CALLBACK_OP(CB, NAME, OPERATION, S, FUN) do { \
if (strcmp(NAME, S) == 0) { \
OPERATION(t_hts_htmlcheck_ ##FUN, (CB)->FUN.fun); \
} \
} while(0)
#define CHARCAST(A) ( (char*) (A) )
#define OFFSET_OF(TYPE, MEMBER) ( (size_t) ( CHARCAST(&(((TYPE*) NULL)->MEMBER)) - CHARCAST((TYPE*) NULL) ) )
#define CALLBACK_REF(name, fun) \
{ name, OFFSET_OF(t_hts_htmlcheck_callbacks, fun) }
#define MEMBER_OF(STRUCT, OFFSET, TYPE) ( * ((TYPE*)((char*)(STRUCT) + (OFFSET))) )
#define DISPATCH_CALLBACK(CB, NAME, OPERATION) do { \
CALLBACK_OP(CB, NAME, OPERATION, "init", init); \
CALLBACK_OP(CB, NAME, OPERATION, "free", uninit); \
CALLBACK_OP(CB, NAME, OPERATION, "start", start); \
CALLBACK_OP(CB, NAME, OPERATION, "end", end); \
CALLBACK_OP(CB, NAME, OPERATION, "change-options", chopt); \
CALLBACK_OP(CB, NAME, OPERATION, "preprocess-html", preprocess); \
CALLBACK_OP(CB, NAME, OPERATION, "postprocess-html", postprocess); \
CALLBACK_OP(CB, NAME, OPERATION, "check-html", check_html); \
CALLBACK_OP(CB, NAME, OPERATION, "query", query); \
CALLBACK_OP(CB, NAME, OPERATION, "query2", query2); \
CALLBACK_OP(CB, NAME, OPERATION, "query3", query3); \
CALLBACK_OP(CB, NAME, OPERATION, "loop", loop); \
CALLBACK_OP(CB, NAME, OPERATION, "check-link", check_link); \
CALLBACK_OP(CB, NAME, OPERATION, "check-mime", check_mime); \
CALLBACK_OP(CB, NAME, OPERATION, "pause", pause); \
CALLBACK_OP(CB, NAME, OPERATION, "save-file", filesave); \
CALLBACK_OP(CB, NAME, OPERATION, "save-file2", filesave2); \
CALLBACK_OP(CB, NAME, OPERATION, "link-detected", linkdetected); \
CALLBACK_OP(CB, NAME, OPERATION, "link-detected2", linkdetected2); \
CALLBACK_OP(CB, NAME, OPERATION, "transfer-status", xfrstatus); \
CALLBACK_OP(CB, NAME, OPERATION, "save-name", savename); \
CALLBACK_OP(CB, NAME, OPERATION, "send-header", sendhead); \
CALLBACK_OP(CB, NAME, OPERATION, "receive-header", receivehead); \
} while(0)
const t_hts_callback_ref default_callbacks_ref[] = {
CALLBACK_REF("init", init),
CALLBACK_REF("free", uninit),
CALLBACK_REF("start", start),
CALLBACK_REF("end", end),
CALLBACK_REF("change-options", chopt),
CALLBACK_REF("preprocess-html", preprocess),
CALLBACK_REF("postprocess-html", postprocess),
CALLBACK_REF("check-html", check_html),
CALLBACK_REF("query", query),
CALLBACK_REF("query2", query2),
CALLBACK_REF("query3", query3),
CALLBACK_REF("loop", loop),
CALLBACK_REF("check-link", check_link),
CALLBACK_REF("check-mime", check_mime),
CALLBACK_REF("pause", pause),
CALLBACK_REF("save-file", filesave),
CALLBACK_REF("save-file2", filesave2),
CALLBACK_REF("link-detected", linkdetected),
CALLBACK_REF("link-detected2", linkdetected2),
CALLBACK_REF("transfer-status", xfrstatus),
CALLBACK_REF("save-name", savename),
CALLBACK_REF("send-header", sendhead),
CALLBACK_REF("receive-header", receivehead),
{NULL, 0}
};
size_t hts_get_callback_offs(const char *name) {
const t_hts_callback_ref *ref;
for(ref = &default_callbacks_ref[0]; ref->name != NULL; ref++) {
if (strcmp(name, ref->name) == 0) {
return ref->offset;
}
}
return (size_t) (-1);
}
int hts_set_callback(t_hts_htmlcheck_callbacks * callbacks, const char *name,
void *function) {
int error = 1;
#define CALLBACK_OPERATION(TYPE, FUNCTION) do { \
FUNCTION = (TYPE) function; \
error = 0; \
} while(0)
DISPATCH_CALLBACK(callbacks, name, CALLBACK_OPERATION);
#undef CALLBACK_OPERATION
return error;
size_t offs = hts_get_callback_offs(name);
if (offs != (size_t) - 1) {
MEMBER_OF(callbacks, offs, void *) = function;
return 0;
}
return 1;
}
void *hts_get_callback(t_hts_htmlcheck_callbacks * callbacks, const char *name) {
#define CALLBACK_OPERATION(TYPE, FUNCTION) do { \
return (void*) FUNCTION; \
} while(0)
DISPATCH_CALLBACK(callbacks, name, CALLBACK_OPERATION);
#undef CALLBACK_OPERATION
size_t offs = hts_get_callback_offs(name);
if (offs != (size_t) - 1) {
return MEMBER_OF(callbacks, offs, void *);
}
return NULL;
}

View File

@@ -158,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 (unused internally)
int address_size; // IP address structure length
FILE *fp; // fichier pour file://
#if HTS_USEOPENSSL
short int ssl; // is this connection a SSL one? (https)
@@ -273,16 +273,12 @@ void treatfirstline(htsblk * retour, char *rcvd);
// sous-fonctions
LLint http_xfread1(htsblk * r, int bufl);
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);
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);
HTSEXT_API t_hostent *vxgethostbyname2(const char *const hostname, void *v_buffer, const char **error);
HTSEXT_API t_hostent *vxgethostbyname(const char *const hostname, void *v_buffer);
HTSEXT_API int check_hostname_dns(const char *const hostname);
int ftp_available(void);
@@ -307,7 +303,7 @@ HTS_INLINE void time_rfc822(char *s, struct tm *A);
HTS_INLINE void time_rfc822_local(char *s, struct tm *A);
HTS_INLINE int sendc(htsblk * r, const char *s);
int finput(T_SOC fd, char *s, int max);
int finput(int 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);
@@ -388,6 +384,7 @@ 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,

View File

@@ -812,7 +812,7 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
name[pos][0] = '\0';
}
pos = 0;
while(*a != '\0' && *a != ']') {
while(*a != ']') {
if (pos < 5) {
if (*a == ':') { // next token
c = name[++pos];
@@ -823,9 +823,7 @@ int url_savename(char *adr_complete, char *fil_complete, char *save,
}
}
}
if (*a == ']') {
a++;
}
a++;
strcatbuff(name[0], "="); /* param=.. */
c = strchr(fil_complete, '?');
/* parameters exists */
@@ -1697,9 +1695,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, (int) strlen(adr));
MD5Update(&ctx, (const unsigned char *) adr, strlen(adr));
MD5Update(&ctx, (const unsigned char *) ",", 1);
MD5Update(&ctx, (const unsigned char *) fil, (int) strlen(fil));
MD5Update(&ctx, (const unsigned char *) fil, strlen(fil));
MD5Final(bindigest, &ctx);
sprintf(filename,
CACHE_REFNAME "/" "%02x%02x%02x%02x%02x%02x%02x%02x"

View File

@@ -38,7 +38,6 @@ 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
@@ -46,8 +45,6 @@ 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
@@ -73,12 +70,13 @@ typedef unsigned long in_addr_t;
#endif
#endif
/*
** ipV4 **
*/
#if HTS_INET6==0
/* 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
@@ -87,169 +85,191 @@ typedef struct SOCaddr SOCaddr;
#endif
struct SOCaddr {
union {
/* Generic version, for network functions such as getnameinfo() */
struct sockaddr sa;
/* IPv4 */
struct sockaddr_in in;
#if HTS_INET6 != 0
/* IPv6 */
struct sockaddr_in6 in6;
#endif
struct sockaddr sa;
unsigned char v4data[4];
unsigned char v6data[16];
unsigned char pad[128];
} m_addr;
};
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)
/* 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 */
#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((in_port_t) (port)); \
SOCaddr_sinport(server) = htons((unsigned short int) (port)); \
} while(0)
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__); \
#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_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);
}
/* Copy sockaddr to another one */
#define SOCaddr_copyaddr(server, server_len, hpaddr, hpsize) do { \
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__); \
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 */
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__)
#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) ( SOCaddr_size(ss) == sizeof(struct sockaddr_in) ? '1' : '2')
#define SOCaddr_getproto(ss, sslen) ('1')
/*
** ipV6 **
*/
#else
/* Ipv4 structures */
typedef struct in6_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_in6 in6;
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.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) */
/* AF_xx */
#define AFinet AF_INET6
/* 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 SOCaddr
Note;
The '> sizeof(struct sockaddr_in6)' hack if for the VC6 structure which
lacks the scope id
*/
#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; \
} \
} 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)
/* Get protocol ID */
#define SOCaddr_getproto(ss, sslen) ((sslen == sizeof(struct sockaddr_in6))?('2'):('1'))
#endif
/* 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

View File

@@ -3606,7 +3606,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str,
urladr, urlfil, mov_adr, mov_fil);
// canceller lien actuel
error = 1;
hash_invalidate_entry(hashptr, ptr); // invalidate hashtable entry
strcpybuff(liens[ptr]->adr, "!"); // caractère bidon (invalide hash)
// noter NOUVEAU lien
//xxc xxc
// set_prio_to=0+1; // protection if the moved URL is an html page!!
@@ -3742,7 +3742,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str,
//
// canceller lien actuel
error = 1;
hash_invalidate_entry(hashptr, ptr); // invalidate hashtable entry
strcpybuff(liens[ptr]->adr, "!"); // caractère bidon (invalide hash)
//
} else { // oups erreur, plus de mémoire!!
printf("PANIC! : Not enough memory [%d]\n", __LINE__);

View File

@@ -35,26 +35,17 @@ Please visit our Website: http://www.httrack.com
#include "htsglobal.h"
/**
* Optional user-defined callback upon fatal error.
*/
typedef void (*htsErrorCallback) (const char *msg, const char *file, int line);
/**
* 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)
HTSEXT_API htsErrorCallback htsCallbackErr;
#define HTSSAFE_ABORT_FUNCTION(A,B,C) do { if (htsCallbackErr != NULL) { htsCallbackErr(A,B,C); } } while(0)
#endif
/**
@@ -70,7 +61,7 @@ HTSEXT_API htsErrorCallback hts_get_error_callback(void);
/**
* Fatal assertion check.
*/
#define assertf_(exp, file, line) assertf__(exp, #exp, file, line)
#define assertf_(exp, file, line) assertf__(exp, #exp, __FILE__, __LINE__)
/**
* Fatal assertion check.
@@ -100,17 +91,6 @@ static HTS_UNUSED void abortf_(const char *exp, const char *file, int line) {
#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
@@ -150,22 +130,13 @@ static HTS_UNUSED void htssafe_compile_time_check_(void) {
#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);
size = strnlen(source, sizeof_source);
assertf_( size < sizeof_source, file, line );
return size;
}

View File

@@ -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, const char *apppath);
HTS_UNUSED static void conv_printf(const char *from, char *to);
HTS_UNUSED static int htslang_load(char *limit_to, char *apppath);
HTS_UNUSED static void conv_printf(char *from, char *to);
HTS_UNUSED static void LANG_DELETE(void);
HTS_UNUSED static void LANG_INIT(const char *path);
HTS_UNUSED static int LANG_T(const char *path, int l);
HTS_UNUSED static void LANG_INIT(char *path);
HTS_UNUSED static int LANG_T(char *path, int l);
HTS_UNUSED static int QLANG_T(int l);
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);
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);
// URL Link catcher
@@ -162,15 +162,16 @@ 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) {
static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
if (hostname != NULL && *hostname != '\0') {
#if HTS_INET6==0
/* ipV4 resolver */
struct hostent *hp = gethostbyname(hostname);
t_hostent *hp = gethostbyname(hostname);
if (hp != NULL) {
if (hp->h_length) {
SOCaddr_copyaddr2(*server, hp->h_addr_list[0], hp->h_length);
SOCaddr_copyaddr(*server, server_size, hp->h_addr_list[0],
hp->h_length);
return 1;
}
}
@@ -186,7 +187,7 @@ static int gethost(const char *hostname, SOCaddr * server) {
if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
if (res) {
if ((res->ai_addr) && (res->ai_addrlen)) {
SOCaddr_copyaddr2(*server, res->ai_addr, res->ai_addrlen);
SOCaddr_copyaddr(*server, server_size, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
return 1;
}
@@ -203,7 +204,7 @@ static int gethost(const char *hostname, SOCaddr * server) {
static int my_getlocalhost(char *h_loc, size_t size) {
SOCaddr addr;
strcpy(h_loc, "localhost");
if (gethost(h_loc, &addr) == 1) {
if (gethost(h_loc, &addr, sizeof(addr)) == 1) {
return 0;
}
// come on ...
@@ -219,7 +220,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) == 1) {
if (gethost(h_loc, &addr, sizeof(addr)) == 1) {
return 0;
} else {
return my_getlocalhost(h_loc, size);
@@ -246,16 +247,54 @@ 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);
@@ -264,13 +303,6 @@ T_SOC smallserver_init(int *port, char *adr) {
#endif
soc = INVALID_SOCKET;
}
} else {
#ifdef _WIN32
closesocket(soc);
#else
close(soc);
#endif
soc = INVALID_SOCKET;
}
}
}
@@ -904,7 +936,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_;
const char *langstr = NULL;
char *langstr = NULL;
int p;
int format = 0;
int listDefault = 0;
@@ -1139,8 +1171,8 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
if (langstr == NULL) {
if (strfield2(name, "#iso")) {
langstr = line2;
line2[0] = '\0';
LANG_LIST(path, line2, sizeof(line2));
langstr[0] = '\0';
LANG_LIST(path, langstr);
assertf(strlen(langstr) < sizeof(line2) - 2);
} else {
langstr = LANGSEL(name);
@@ -1159,7 +1191,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
switch (format) {
case 0:
{
const char *a = langstr;
char *a = langstr;
while(*a) {
if (a[0] == '\\' && isxdigit(a[1])
@@ -1205,7 +1237,7 @@ int smallserver(T_SOC soc, char *url, char *method, char *data, char *path) {
default:
if (*langstr) {
int id = 1;
const char *fstr = langstr;
char *fstr = langstr;
StringClear(tmpbuff);
if (format == 2) {
@@ -1428,25 +1460,24 @@ int htslang_uninit(void) {
return 1;
}
int smallserver_setkey(const char *key, const char *value) {
int smallserver_setkey(char *key, char *value) {
return inthash_write(NewLangList, key, (intptr_t) strdup(value));
}
int smallserver_setkeyint(const char *key, LLint value) {
int smallserver_setkeyint(char *key, LLint value) {
char tmp[256];
snprintf(tmp, sizeof(tmp), LLintP, value);
sprintf(tmp, LLintP, value);
return inthash_write(NewLangList, key, (intptr_t) strdup(tmp));
}
int smallserver_setkeyarr(const char *key, int id, const char *key2, const char *value) {
int smallserver_setkeyarr(char *key, int id, char *key2, char *value) {
char tmp[256];
snprintf(tmp, sizeof(tmp), "%s%d%s", key, id, key2);
sprintf(tmp, "%s%d%s", key, id, key2);
return inthash_write(NewLangList, tmp, (intptr_t) strdup(value));
}
static int htslang_load(char *limit_to, const char *path) {
const char *hashname;
static int htslang_load(char *limit_to, char *path) {
char *hashname;
char catbuff[CATBUFF_SIZE];
//
@@ -1480,7 +1511,7 @@ static int htslang_load(char *limit_to, const char *path) {
linput_cpp(fp, intkey, 8000);
linput_cpp(fp, key, 8000);
if (strnotempty(intkey) && strnotempty(key)) {
const char *test = LANGINTKEY(key);
char *test = LANGINTKEY(key);
/* Increment for multiple definitions */
if (strnotempty(test)) {
@@ -1562,7 +1593,7 @@ static int htslang_load(char *limit_to, const char *path) {
if (strnotempty(extkey) && strnotempty(value)) {
int len;
char *buff;
const char *intkey;
char *intkey;
intkey = LANGINTKEY(extkey);
@@ -1570,7 +1601,7 @@ static int htslang_load(char *limit_to, const char *path) {
/* Increment for multiple definitions */
{
const char *test = LANGSEL(intkey);
char *test = LANGSEL(intkey);
if (strnotempty(test)) {
if (loops == 0) {
@@ -1624,7 +1655,7 @@ static int htslang_load(char *limit_to, const char *path) {
}
/* NOTE : also contains the "webhttrack" hack */
static void conv_printf(const char *from, char *to) {
static void conv_printf(char *from, char *to) {
int i = 0, j = 0, len;
len = (int) strlen(from);
@@ -1698,7 +1729,7 @@ static void LANG_DELETE(void) {
}
// sélection de la langue
static void LANG_INIT(const char *path) {
static void LANG_INIT(char *path) {
//CWinApp* pApp = AfxGetApp();
//if (pApp) {
/* pApp->GetProfileInt("Language","IntId",0); */
@@ -1706,7 +1737,7 @@ static void LANG_INIT(const char *path) {
//}
}
static int LANG_T(const char *path, int l) {
static int LANG_T(char *path, int l) {
if (l >= 0) {
QLANG_T(l);
htslang_load(NULL, path);
@@ -1714,7 +1745,7 @@ static int LANG_T(const char *path, int l) {
return QLANG_T(-1); // 0=default (english)
}
static int LANG_SEARCH(const char *path, const char *iso) {
static int LANG_SEARCH(char *path, char *iso) {
char lang_str[1024];
int i = 0;
int curr_lng = LANG_T(path, -1);
@@ -1733,7 +1764,7 @@ static int LANG_SEARCH(const char *path, const char *iso) {
return found;
}
static int LANG_LIST(const char *path, char *buffer, size_t size) {
static int LANG_LIST(char *path, char *buffer) {
char lang_str[1024];
int i = 0;
int curr_lng = LANG_T(path, -1);
@@ -1741,7 +1772,7 @@ static int LANG_LIST(const char *path, char *buffer, size_t size) {
buffer[0] = '\0';
do {
QLANG_T(i);
strlcpybuff(lang_str, "LANGUAGE_NAME", size);
strcpybuff(lang_str, "LANGUAGE_NAME");
htslang_load(lang_str, path);
if (strlen(lang_str) > 0) {
if (buffer[0])
@@ -1763,26 +1794,28 @@ static int QLANG_T(int l) {
return lng; // 0=default (english)
}
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 "";
static char *LANGSEL(char *name) {
intptr_t adr = 0;
if (NewLangStr)
if (!inthash_read(NewLangStr, name, &adr))
adr = 0;
if (adr) {
return (char *) adr;
}
return "";
}
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 "";
static char *LANGINTKEY(char *name) {
intptr_t adr = 0;
if (NewLangStrKeys)
if (!inthash_read(NewLangStrKeys, name, &adr))
adr = 0;
if (adr) {
return (char *) adr;
}
return "";
}
/* *** Various functions *** */
@@ -1815,7 +1848,7 @@ static int check_readinput(htsblk * r) {
FD_SET(r->soc, &fds);
tv.tv_sec = 0;
tv.tv_usec = 0;
select((int) r->soc + 1, &fds, NULL, NULL, &tv);
select(r->soc + 1, &fds, NULL, NULL, &tv);
if (FD_ISSET(r->soc, &fds))
return 1;
else

View File

@@ -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(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);
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);
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((int) soc + 1, &fds, NULL, NULL, &tv);
select(soc + 1, &fds, NULL, NULL, &tv);
if (FD_ISSET(soc, &fds))
return 1;
else

View File

@@ -36,7 +36,6 @@ 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

View File

@@ -59,9 +59,8 @@ int hts_zunpack(char *filename, char *newfile) {
char catbuff[CATBUFF_SIZE];
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.
const gzFile gz = dup_fd != -1 ? gzdopen(dup_fd, "rb") : NULL;
gzFile gz = fd != -1 ? gzdopen(dup(fd), "rb") : NULL;
if (gz) {
FILE *const fpout = FOPEN(fconv(catbuff, sizeof(catbuff), newfile), "wb");

View File

@@ -38,7 +38,6 @@ Please visit our Website: http://www.httrack.com
#ifndef _WIN32
#include <inttypes.h>
#endif
#include <stdarg.h>
#ifndef HTS_DEF_FWSTRUCT_httrackp
#define HTS_DEF_FWSTRUCT_httrackp
@@ -66,12 +65,6 @@ 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 */
@@ -118,8 +111,6 @@ 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);
@@ -127,9 +118,6 @@ 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);

View File

@@ -53,7 +53,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.8\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.3\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;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="&quot;C:\Dev\zlib-1.2.8\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.3\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
PreprocessorDefinitions="WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
@@ -246,7 +246,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200 "
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.8\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.3\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;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="&quot;C:\Dev\zlib-1.2.8\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.3\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;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="&quot;C:\Dev\zlib-1.2.8\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.3\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;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="&quot;C:\Dev\zlib-1.2.8\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
AdditionalIncludeDirectories="&quot;C:\Dev\zlib-1.2.3\&quot;;&quot;C:\Dev\openssl-1.0.1e\include&quot;;C:\Dev\Winhttrack"
PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;HTS_ANALYSTE_CONSOLE;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="2"

View File

@@ -226,17 +226,18 @@ static int linputsoc_t(T_SOC soc, char *s, int max, int timeout) {
return -1;
}
static int gethost(const char *hostname, SOCaddr * server) {
static int gethost(const char *hostname, SOCaddr * server, size_t server_size) {
if (hostname != NULL && *hostname != '\0') {
#if HTS_INET6==0
/*
ipV4 resolver
*/
struct hostent *hp = gethostbyname(hostname);
t_hostent *hp = gethostbyname(hostname);
if (hp != NULL) {
if (hp->h_length) {
SOCaddr_copyaddr2(*server, hp->h_addr_list[0], hp->h_length);
SOCaddr_copyaddr(*server, server_size, hp->h_addr_list[0],
hp->h_length);
return 1;
}
}
@@ -255,13 +256,13 @@ static int gethost(const char *hostname, SOCaddr * server) {
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_copyaddr2(*server, res->ai_addr, res->ai_addrlen);
SOCaddr_copyaddr(*server, server_size, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
return 1;
}
@@ -275,7 +276,7 @@ static int gethost(const char *hostname, SOCaddr * server) {
return 0;
}
static String getip(SOCaddr * server) {
static String getip(SOCaddr * server, int serverLen) {
String s = STRING_EMPTY;
#if HTS_INET6==0
@@ -290,7 +291,7 @@ static String getip(SOCaddr * server) {
proxytrack_print_log(CRITICAL, "memory exhausted");
return s;
}
SOCaddr_inetntoa(dotted, sizeMax, *server);
SOCaddr_inetntoa(dotted, sizeMax, *server, serverLen);
sprintf(dotted + strlen(dotted), ":%d", port);
StringAttach(&s, &dotted);
return s;
@@ -298,15 +299,18 @@ static String getip(SOCaddr * server) {
static T_SOC smallserver_init(const char *adr, int port, int family) {
SOCaddr server;
SOCaddr_initany(server);
if (gethost(adr, &server)) { // host name
size_t server_size = sizeof(server);
memset(&server, 0, sizeof(server));
SOCaddr_initany(server, server_size);
if (gethost(adr, &server, server_size)) { // 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, &SOCaddr_sockaddr(server), SOCaddr_size(server)) == 0) {
if (bind(soc, (struct sockaddr *) &server, (int) server_size) == 0) {
if (family != SOCK_STREAM || listen(soc, 10) >= 0) {
return soc;
} else {
@@ -1316,12 +1320,12 @@ static void proxytrack_process_HTTP(PT_Indexes indexes, T_SOC soc_c) {
/* */
String ip = STRING_EMPTY;
SOCaddr serverClient;
SOClen lenServerClient = SOCaddr_capacity(serverClient);
SOClen lenServerClient = (int) sizeof(serverClient);
memset(&serverClient, 0, sizeof(serverClient));
if (getsockname
(soc_c, &SOCaddr_sockaddr(serverClient), &lenServerClient) == 0) {
ip = getip(&serverClient);
(soc_c, (struct sockaddr *) &serverClient, &lenServerClient) == 0) {
ip = getip(&serverClient, lenServerClient);
} else {
StringCopy(ip, "unknown");
}
@@ -1567,14 +1571,14 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
return -1;
}
while(soc != INVALID_SOCKET) {
SOCaddr clientAddr;
SOClen clientAddrLen = SOCaddr_capacity(clientAddr);
struct sockaddr clientAddr;
SOClen clientAddrLen = sizeof(struct sockaddr);
int n;
memset(&clientAddr, 0, sizeof(clientAddr));
n = recvfrom(soc, (char *) buffer, bufferSize, 0,
&SOCaddr_sockaddr(clientAddr),
&clientAddrLen);
n =
recvfrom(soc, (char *) buffer, bufferSize, 0, &clientAddr,
&clientAddrLen);
if (n != -1) {
const char *LogRequest = "ERROR";
const char *LogReply = "ERROR";
@@ -1617,11 +1621,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(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_DENIED,
ICP_reply(&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(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_HIT,
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_HIT,
Version, 0, Request_Number, 0, 0, 0, UrlRequest);
LogReply = "ICP_OP_HIT";
} else {
@@ -1633,7 +1637,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(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_HIT,
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_HIT,
Version, 0, Request_Number, 0, 0, 0,
UrlRequest);
LogReply = "ICP_OP_HIT";
@@ -1644,7 +1648,7 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
}
}
/* We won't retrive the cache MISS online, no way! */
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc,
ICP_reply(&clientAddr, clientAddrLen, soc,
ICP_OP_MISS_NOFETCH, Version, 0, Request_Number,
0, 0, 0, UrlRequest);
LogReply = "ICP_OP_MISS_NOFETCH";
@@ -1656,24 +1660,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(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_SECHO,
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_SECHO,
Version, 0, Request_Number, 0, 0, 0, UrlRequest);
}
break;
default:
LogRequest = "NOTIMPLEMENTED";
LogReply = "ICP_OP_ERR";
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_ERR, Version,
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_ERR, Version,
0, Request_Number, 0, 0, 0, NULL);
break;
}
} else {
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_ERR, 2, 0,
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_ERR, 2, 0,
Request_Number, 0, 0, 0, NULL);
}
} /* Ignored (RFC2186) */
} else {
ICP_reply(&SOCaddr_sockaddr(clientAddr), clientAddrLen, soc, ICP_OP_ERR, Version, 0,
ICP_reply(&clientAddr, clientAddrLen, soc, ICP_OP_ERR, Version, 0,
Request_Number, 0, 0, 0, NULL);
}
}
@@ -1687,7 +1691,7 @@ static int proxytrack_start_ICP(PT_Indexes indexes, T_SOC soc) {
SOCaddr_copyaddr(serverClient, lenServerClient, &clientAddr,
clientAddrLen);
if (lenServerClient > 0) {
ip = getip(&clientAddr);
ip = getip(&serverClient, lenServerClient);
} else {
StringCopy(ip, "unknown");
}

View File

@@ -13,9 +13,3 @@ 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