mirror of
https://github.com/xroche/httrack.git
synced 2026-06-13 13:54:37 +03:00
Compare commits
14 Commits
fix/mutex-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5351e96d71 | ||
|
|
9d39a57576 | ||
|
|
e3d4ec01f7 | ||
|
|
a0bf50f6b1 | ||
|
|
794404bba2 | ||
|
|
82d08aaeaf | ||
|
|
459f06e758 | ||
|
|
89b25e418b | ||
|
|
43f72afbad | ||
|
|
017c634c53 | ||
|
|
f2b36c4b29 | ||
|
|
19947efd74 | ||
|
|
106d34d82c | ||
|
|
61e0b3250b |
@@ -23,7 +23,7 @@ http://www.httrack.com/
|
||||
|
||||
## Compile trunk release
|
||||
```sh
|
||||
git clone https://github.com/xroche/httrack.git --recurse
|
||||
git clone https://github.com/xroche/httrack.git --recurse-submodules
|
||||
cd httrack
|
||||
./configure --prefix=$HOME/usr && make -j8 && make install
|
||||
```
|
||||
|
||||
@@ -118,11 +118,11 @@ The command-line version
|
||||
<br>
|
||||
<br>
|
||||
<li>Add the URLs, separated by a blank space</li>
|
||||
<br><small><tt>httrack www.someweb.com/foo/</tt></small>
|
||||
<br><small><tt>httrack www.example.com/foo/</tt></small>
|
||||
<br>
|
||||
<br>
|
||||
<li>If you need, add some options (see the <a href="options.html">option list</a>)</li>
|
||||
<br><small><tt>httrack www.someweb.com/foo/ -O "/webs" -N4 -P proxy.myhost.com:3128</tt></small>
|
||||
<br><small><tt>httrack www.example.com/foo/ -O "/webs" -N4 -P proxy.myhost.com:3128</tt></small>
|
||||
<br>
|
||||
<br>
|
||||
<li>Launch the command line, and wait until the mirror is finishing</li>
|
||||
|
||||
@@ -303,43 +303,43 @@ Okay, let me explain how to precisely control the capture process.<br>
|
||||
Let's take an example:<br>
|
||||
<br>
|
||||
Imagine you want to capture the following site:<br>
|
||||
<tt>www.someweb.com/gallery/flowers/</tt><br>
|
||||
<tt>www.example.com/gallery/flowers/</tt><br>
|
||||
<br>
|
||||
HTTrack, by default, will capture all links encountered in <tt>www.someweb.com/gallery/flowers/</tt> or in lower directories, like
|
||||
<tt>www.someweb.com/gallery/flowers/roses/</tt>.<br>
|
||||
HTTrack, by default, will capture all links encountered in <tt>www.example.com/gallery/flowers/</tt> or in lower directories, like
|
||||
<tt>www.example.com/gallery/flowers/roses/</tt>.<br>
|
||||
It will not follow links to other websites, because this behaviour might cause to capture the Web entirely!<br>
|
||||
It will not follow links located in higher directories, too (for example, <tt>www.someweb.com/gallery/flowers/</tt> itself) because this
|
||||
It will not follow links located in higher directories, too (for example, <tt>www.example.com/gallery/flowers/</tt> itself) because this
|
||||
might cause to capture too much data.<br>
|
||||
<br>
|
||||
This is the <b><u>default behaviour</b></u> of HTTrack, BUT, of course, if you want, you can tell HTTrack to capture other directorie(s), website(s)!..
|
||||
<br>
|
||||
In our example, we might want also to capture all links in <tt>www.someweb.com/gallery/trees/</tt>, and in <tt>www.someweb.com/photos/</tt><br>
|
||||
In our example, we might want also to capture all links in <tt>www.example.com/gallery/trees/</tt>, and in <tt>www.example.com/photos/</tt><br>
|
||||
<br>
|
||||
This can easily done by using filters: go to the Option panel, select the 'Scan rules' tab, and enter this line:
|
||||
(you can leave a blank space between each rules, instead of entering a carriage return)<br>
|
||||
<tt>+www.someweb.com/gallery/trees/*<br>
|
||||
+www.someweb.com/photos/*</tt><br>
|
||||
<tt>+www.example.com/gallery/trees/*<br>
|
||||
+www.example.com/photos/*</tt><br>
|
||||
<br>
|
||||
This means "accept all links begining with <tt>www.someweb.com/gallery/trees/</tt> and <tt>www.someweb.com/photos/</tt>"
|
||||
This means "accept all links begining with <tt>www.example.com/gallery/trees/</tt> and <tt>www.example.com/photos/</tt>"
|
||||
- the <tt>+</tt> means "accept" and the final <tt>*</tt> means "any character will match after the previous ones".
|
||||
Remember the <tt>*.doc</tt> or <tt>*.zip</tt> encountered when you want to select all files from a certain type on your computer:
|
||||
it is almost the same here, except the begining "+"<br>
|
||||
<br>
|
||||
Now, we might want to exclude all links in <tt>www.someweb.com/gallery/trees/hugetrees/</tt>, because with the previous filter,
|
||||
Now, we might want to exclude all links in <tt>www.example.com/gallery/trees/hugetrees/</tt>, because with the previous filter,
|
||||
we accepted too many files. Here again, you can add a filter rule to refuse these links. Modify the previous filters to:<br>
|
||||
<tt>+www.someweb.com/gallery/trees/*<br>
|
||||
+www.someweb.com/photos/*<br>
|
||||
-www.someweb.com/gallery/trees/hugetrees/*</tt><br>
|
||||
<tt>+www.example.com/gallery/trees/*<br>
|
||||
+www.example.com/photos/*<br>
|
||||
-www.example.com/gallery/trees/hugetrees/*</tt><br>
|
||||
<br>
|
||||
You have noticed the <tt>-</tt> in the begining of the third rule: this means "refuse links matching the rule"
|
||||
; and the rule is "any files begining with <tt>www.someweb.com/gallery/trees/hugetrees/</tt><br>
|
||||
; and the rule is "any files begining with <tt>www.example.com/gallery/trees/hugetrees/</tt><br>
|
||||
|
||||
Voila! With these three rules, you have precisely defined what you wanted to capture.<br>
|
||||
<br>
|
||||
A more complex example?<br>
|
||||
<br>
|
||||
Imagine that you want to accept all jpg files (files with .jpg type) that have "blue" in the name and located in www.someweb.com<br>
|
||||
<tt>+www.someweb.com/*blue*.jpg</tt><br>
|
||||
Imagine that you want to accept all jpg files (files with .jpg type) that have "blue" in the name and located in www.example.com<br>
|
||||
<tt>+www.example.com/*blue*.jpg</tt><br>
|
||||
<br>
|
||||
More detailed information can be found <a href="filters.html">here</a>!<br>
|
||||
<br>
|
||||
@@ -440,7 +440,7 @@ This will cause a performance loss, but will increase the compatibility with som
|
||||
|
||||
<a NAME="QT1">Q: <strong>Only the first page is caught. What's wrong?</a></strong></br>
|
||||
A: <em>First, check the <tt>hts-log.txt</tt> file (and/or <tt>hts-err.txt</tt> error log file) - this can give you precious information.<br>
|
||||
The problem can be a website that redirects you to another site (for example, <tt>www.someweb.com</tt> to <tt>public.someweb.com</tt>) :
|
||||
The problem can be a website that redirects you to another site (for example, <tt>www.example.com</tt> to <tt>public.example.com</tt>) :
|
||||
in this case, use filters to accept this site<br>
|
||||
This can be, also, a problem in the HTTrack options (link depth too low, for example)</em>
|
||||
|
||||
@@ -485,10 +485,10 @@ You may also want to capture files that are forbidden by default by the <a href=
|
||||
In these cases, HTTrack does not capture these links automatically, you have to tell it to do so.
|
||||
<br><br>
|
||||
<ul><li>Either use the <a href="filters.html">filters</a>.<br>
|
||||
Example: You are downloading <tt>http://www.someweb.com/foo/</tt> and can not get .jpg images located
|
||||
in <tt>http://www.someweb.com/bar/</tt> (for example, http://www.someweb.com/bar/blue.jpg)<br>
|
||||
Then, add the filter rule <tt>+www.someweb.com/bar/*.jpg</tt> to accept all .jpg files from this location<br>
|
||||
You can, also, accept all files from the /bar folder with <tt>+www.someweb.com/bar/*</tt>, or only html files with <tt>+www.someweb.com/bar/*.html</tt> and so on..<br><br>
|
||||
Example: You are downloading <tt>http://www.example.com/foo/</tt> and can not get .jpg images located
|
||||
in <tt>http://www.example.com/bar/</tt> (for example, http://www.example.com/bar/blue.jpg)<br>
|
||||
Then, add the filter rule <tt>+www.example.com/bar/*.jpg</tt> to accept all .jpg files from this location<br>
|
||||
You can, also, accept all files from the /bar folder with <tt>+www.example.com/bar/*</tt>, or only html files with <tt>+www.example.com/bar/*.html</tt> and so on..<br><br>
|
||||
</li><li>
|
||||
If the problems are related to robots.txt rules, that do not let you access some folders (check in the logs if you are not sure),
|
||||
you may want to disable the default robots.txt rules in the options. (but only disable this option with great care,
|
||||
@@ -509,8 +509,8 @@ and rescan the website as described before. HTTrack will be obliged to recatch t
|
||||
<a NAME="Q1bb">Q: <strong>FTP links are not caught! What's happening?</strong><br>
|
||||
A: <em>FTP files might be seen as external links, especially if they are located in outside domain. You have either to accept all external links (See the links options, -n option) or
|
||||
only specific files (see <a href="filters.html">filters</a> section). <br>
|
||||
Example: You are downloading <tt>http://www.someweb.com/foo/</tt> and can not get ftp://ftp.someweb.com files<br>
|
||||
Then, add the filter rule <tt>+ftp.someweb.com/*</tt> to accept all files from this (ftp) location<br>
|
||||
Example: You are downloading <tt>http://www.example.com/foo/</tt> and can not get ftp://ftp.example.com files<br>
|
||||
Then, add the filter rule <tt>+ftp.example.com/*</tt> to accept all files from this (ftp) location<br>
|
||||
</em>
|
||||
<br>
|
||||
|
||||
@@ -551,10 +551,10 @@ Note: In some rare cases, duplicate data files can be found when the website red
|
||||
|
||||
<a NAME="Q1b2">Q: <strong>I'm downloading too many files! What can I do?</strong><br>
|
||||
A: <em>This is often the case when you use too large a filter, for example <tt>+*.html</tt>, which asks the
|
||||
engine to catch all .html pages (even ones on other sites!). In this case, try to use more specific filters, like <tt>+www.someweb.com/specificfolder/*.html</tt><br>
|
||||
If you still have too many files, use filters to avoid somes files. For example, if you have too many files from www.someweb.com/big/,
|
||||
use <tt>-www.someweb.com/big/*</tt> to avoid all files from this folder. Remember that the default behaviour of the engine, when
|
||||
mirroring http://www.someweb.com/big/index.html, is to catch everything in http://www.someweb.com/big/. Filters are your friends,
|
||||
engine to catch all .html pages (even ones on other sites!). In this case, try to use more specific filters, like <tt>+www.example.com/specificfolder/*.html</tt><br>
|
||||
If you still have too many files, use filters to avoid somes files. For example, if you have too many files from www.example.com/big/,
|
||||
use <tt>-www.example.com/big/*</tt> to avoid all files from this folder. Remember that the default behaviour of the engine, when
|
||||
mirroring http://www.example.com/big/index.html, is to catch everything in http://www.example.com/big/. Filters are your friends,
|
||||
use them!
|
||||
</em>
|
||||
<br>
|
||||
@@ -562,7 +562,7 @@ use them!
|
||||
|
||||
<a NAME="Q1b22">Q: <strong>The engine turns crazy, getting thousands of files! What's going on?</strong><br>
|
||||
A: <em>This can happen if a loop occurs in some bogus website. For example, a page that refers to itself, with a timestamp
|
||||
in the query string (e.g. <tt>http://www.someweb.com/foo.asp?ts=2000/10/10,09:45:17:147</tt>).
|
||||
in the query string (e.g. <tt>http://www.example.com/foo.asp?ts=2000/10/10,09:45:17:147</tt>).
|
||||
These are really annoying, as it is VERY difficult to detect the loop (the timestamp might be a page number).
|
||||
To limit the problem: set a recurse level (for example to 6), or avoid the bogus pages (use the filters)
|
||||
</em>
|
||||
@@ -571,7 +571,7 @@ To limit the problem: set a recurse level (for example to 6), or avoid the bogus
|
||||
|
||||
<a NAME="Q1b3">Q: <strong>File are sometimes renamed (the type is changed)! Why?</strong><br>
|
||||
A: <em>By default, HTTrack tries to know the type of remote files. This is useful when links like
|
||||
<tt>http://www.someweb.com/foo.cgi?id=1</tt> can be either HTML pages, images or anything else.
|
||||
<tt>http://www.example.com/foo.cgi?id=1</tt> can be either HTML pages, images or anything else.
|
||||
Locally, foo.cgi will not be recognized as an html page, or as an image, by your browser. HTTrack has to rename the file
|
||||
as foo.html or foo.gif so that it can be viewed.<br>
|
||||
</em>
|
||||
@@ -730,8 +730,8 @@ but this is a smart bug..
|
||||
the domain, too. How to retrieve them?</strong><br>
|
||||
A: <em>If you just want to retrieve files that can be reached through links, just activate
|
||||
the 'get file near links' option. But if you want to retrieve html pages too, you can both
|
||||
use wildcards or explicit addresses ; e.g. add <tt>www.someweb.com/*</tt> to accept all
|
||||
files and pages from www.someweb.com.<br>
|
||||
use wildcards or explicit addresses ; e.g. add <tt>www.example.com/*</tt> to accept all
|
||||
files and pages from www.example.com.<br>
|
||||
<br>
|
||||
</em></a><a NAME="Q6">Q: <strong>I have forgotten some URLs of files during a long
|
||||
mirror.. Should I redo all?</strong><br>
|
||||
@@ -744,7 +744,7 @@ A: <em>You can use different methods. You can use the 'get files near a link' op
|
||||
files are in a foreign domain. You can use, too, a filter adress: adding <tt>+*.zip</tt>
|
||||
in the URL list (or in the filter list) will accept all ZIP files, even if these files are
|
||||
outside the address. <br>
|
||||
Example : <tt>httrack www.someweb.com/someaddress.html +*.zip</tt> will allow
|
||||
Example : <tt>httrack www.example.com/someaddress.html +*.zip</tt> will allow
|
||||
you to retrieve all zip files that are linked on the site.</em><br>
|
||||
<br>
|
||||
</a><a NAME="Q8">Q: <strong>There are ZIP files in a page, but I don't want to transfer
|
||||
@@ -771,7 +771,7 @@ them on filters!</strong><br>
|
||||
A: <em>By default, HTTrack retrieves all types of files on authorized links. To avoid
|
||||
that, define filters like </a><a NAME="Q7"><tt>-* +<website>/*.html
|
||||
+<website>/*.htm +<website>/ +*.<type wanted></tt></a><a NAME="Q10"><br>
|
||||
Example: <tt>httrack www.someweb.com/index.html -* +www.someweb.com/*.htm* +www.someweb.com/*.gif +www.someweb.com/*.jpg</tt><br>
|
||||
Example: <tt>httrack www.example.com/index.html -* +www.example.com/*.htm* +www.example.com/*.gif +www.example.com/*.jpg</tt><br>
|
||||
<br>
|
||||
</em><a NAME="Q10">Q: <strong>When I use filters, I get too many files!</strong><br>
|
||||
A: <em>You might use too large a filter, for example <tt>*.html</tt> will get ALL html
|
||||
@@ -779,13 +779,13 @@ files identified. If you want to get all files on an address, use <tt>www.<ad
|
||||
If you want to get ONLY files defined by your filters, use something like <tt>-* +www.foo.com/*</tt>, because
|
||||
<tt>+www.foo.com/*</tt> will only accept selected links without forbidding other ones!<br>
|
||||
There are lots of possibilities using filters.<br>
|
||||
Example:<tt>httrack www.someweb.com +*.someweb.com/*.htm*</tt><br>
|
||||
Example:<tt>httrack www.example.com +*.example.com/*.htm*</tt><br>
|
||||
<br>
|
||||
</em></a><a NAME="Q11">Q: <strong>When I use filters, I can't access another domain, but I
|
||||
have filtered it!</strong><br>
|
||||
A: <em>You may have done a mistake declaring filters, for example <tt>+www.someweb.com/*
|
||||
-*someweb* </tt></em>will not work, because -*someweb* has an upper priority (because it has
|
||||
been declared after +www.someweb.com)<br>
|
||||
A: <em>You may have done a mistake declaring filters, for example <tt>+www.example.com/*
|
||||
-*example* </tt></em>will not work, because -*example* has an upper priority (because it has
|
||||
been declared after +www.example.com)<br>
|
||||
<br>
|
||||
</a><a NAME="Q12">Q: <strong>Must I add a '+' or '-' in the filter list when I want
|
||||
to use filters?</strong><br>
|
||||
@@ -800,7 +800,7 @@ filter list) and accept only html files and the file(s) you want to retrieve (BU
|
||||
forget to add <tt>+<website>*.html</tt> in the filter list, or pages will not be
|
||||
scanned! Add the name of files you want with a <tt>*/</tt> before ; i.e. if you want to
|
||||
retrieve file.zip, add <tt>*/file.zip</tt>)<br>
|
||||
Example:<tt>httrack www.someweb.com +www.someweb.com/*.htm* +thefileiwant.zip</tt><br>
|
||||
Example:<tt>httrack www.example.com +www.example.com/*.htm* +thefileiwant.zip</tt><br>
|
||||
<br>
|
||||
</em>
|
||||
|
||||
@@ -828,7 +828,7 @@ A: <em>Yes. See the URL capture abilities (--catchurl for command-line release,
|
||||
A: <em>Yes. See the shell system command option (-V option for command-line release)</em>
|
||||
|
||||
<br><br><a NAME="QM6">Q: <strong>Can I use username/password authentication on a site?</strong></a><br>
|
||||
A: <em>Yes. Use user:password@your_url (example: <tt>http://foo:bar@www.someweb.com/private/mybox.html</tt>)</em>
|
||||
A: <em>Yes. Use user:password@your_url (example: <tt>http://foo:bar@www.example.com/private/mybox.html</tt>)</em>
|
||||
|
||||
<br><br><a NAME="QM7">Q: <strong>Can I use username/password authentication for a proxy?</strong></a><br>
|
||||
A: <em>Yes. Use user:password@your_proxy_name as your proxy name (example: <tt>smith:foo@proxy.mycorp.com</tt>)</em>
|
||||
|
||||
@@ -181,17 +181,17 @@ used for some time.
|
||||
|
||||
<p align=justify> The rest of this manual is dedicated to detailing what
|
||||
you find in the help message and providing examples - lots and lots of
|
||||
examples... Here is what you get (page by page - use <enter> to move to
|
||||
examples... Here is what you get (page by page - use <enter> to move to
|
||||
the next page in the real program) if you type 'httrack --help':
|
||||
|
||||
<pre>
|
||||
>httrack --help
|
||||
HTTrack version 3.03BETAo4 (compiled Jul 1 2001)
|
||||
usage: ./httrack <URLs [-option] [+<FILTERs>] [-<FILTERs>]
|
||||
usage: ./httrack <URLs> [-option] [+<FILTERs>] [-<FILTERs>]
|
||||
with options listed below: (* is the default value)
|
||||
|
||||
General options:
|
||||
O path for mirror/logfiles+cache (-O path_mirror[,path_cache_and_logfiles]) (--path <param>)
|
||||
O path for mirror/logfiles+cache (-O path_mirror[,path_cache_and_logfiles]) (--path <param>)
|
||||
%O top path if no path defined (-O path_mirror[,path_cache_and_logfiles])
|
||||
|
||||
Action options:
|
||||
@@ -202,7 +202,7 @@ Action options:
|
||||
Y mirror ALL links located in the first level pages (mirror links) (--mirrorlinks)
|
||||
|
||||
Proxy options:
|
||||
P proxy use (-P proxy:port or -P user:pass@proxy:port) (--proxy <param>)
|
||||
P proxy use (-P proxy:port or -P user:pass@proxy:port) (--proxy <param>)
|
||||
%f *use proxy for ftp (f0 don't use) (--httpproxy-ftp[=N])
|
||||
|
||||
Limits options:
|
||||
@@ -227,7 +227,7 @@ Links options:
|
||||
%P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use) (--extended-parsing[=N])
|
||||
n get non-html files 'near' an html file (ex: an image located outside) (--near)
|
||||
t test all URLs (even forbidden ones) (--test)
|
||||
%L <file add all URL located in this text file (one URL per line) (--list <param>)
|
||||
%L <file> add all URL located in this text file (one URL per line) (--list <param>)
|
||||
|
||||
Build options:
|
||||
NN structure type (0 *original structure, 1+: see below) (--structure[=N])
|
||||
@@ -248,12 +248,12 @@ Spider options:
|
||||
%h force HTTP/1.0 requests (reduce update features, only for old servers or proxies) (--http-10)
|
||||
%B tolerant requests (accept bogus responses on some servers, but not standard!) (--tolerant)
|
||||
%s update hacks: various hacks to limit re-transfers when updating (identical size, bogus response..) (--updatehack)
|
||||
%A assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume <param>)
|
||||
%A assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume <param>)
|
||||
|
||||
Browser ID:
|
||||
F user-agent field (-F "user-agent name") (--user-agent <param>)
|
||||
%F footer string in Html code (-%F "Mirrored [from host %s [file %s [at %s]]]" (--footer <param>)
|
||||
%l preferred language (-%l "fr, en, jp, *" (--language <param>)
|
||||
F user-agent field (-F "user-agent name") (--user-agent <param>)
|
||||
%F footer string in Html code (-%F "Mirrored [from host %s [file %s [at %s]]]" (--footer <param>)
|
||||
%l preferred language (-%l "fr, en, jp, *" (--language <param>)
|
||||
|
||||
Log, index, cache
|
||||
C create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before) (--cache[=N])
|
||||
@@ -303,8 +303,8 @@ Guru options: (do NOT use)
|
||||
#! Execute a shell command (-#! "echo hello")
|
||||
|
||||
Command-line specific options:
|
||||
V execute system command after each files ($0 is the filename: -V "rm \$0") (--userdef-cmd <param>)
|
||||
%U run the engine with another id when called as root (-%U smith) (--user <param>)
|
||||
V execute system command after each files ($0 is the filename: -V "rm \$0") (--userdef-cmd <param>)
|
||||
%U run the engine with another id when called as root (-%U smith) (--user <param>)
|
||||
|
||||
Details: Option N
|
||||
N0 Site-structure (default)
|
||||
@@ -332,7 +332,7 @@ Details: User-defined option N
|
||||
%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) (--http-10)
|
||||
%h Host name (ex: www.example.com) (--http-10)
|
||||
%M URL MD5 (128 bits, 32 ascii bytes)
|
||||
%Q query string MD5 (128 bits, 32 ascii bytes)
|
||||
%q small query string MD5 (16 bits, 4 ascii bytes) (--include-query-string)
|
||||
@@ -340,14 +340,14 @@ Details: User-defined option N
|
||||
%[param] param variable in query string
|
||||
|
||||
Shortcuts:
|
||||
--mirror <URLs *make a mirror of site(s) (default)
|
||||
--get <URLs get the files indicated, do not seek other URLs (-qg)
|
||||
--list <text file add all URL located in this text file (-%L)
|
||||
--mirrorlinks <URLs mirror all links in 1st level pages (-Y)
|
||||
--testlinks <URLs test links in pages (-r1p0C0I0t)
|
||||
--spider <URLs spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
|
||||
--testsite <URLs identical to --spider
|
||||
--skeleton <URLs make a mirror, but gets only html files (-p1)
|
||||
--mirror <URLs> *make a mirror of site(s) (default)
|
||||
--get <URLs> get the files indicated, do not seek other URLs (-qg)
|
||||
--list <text file> add all URL located in this text file (-%L)
|
||||
--mirrorlinks <URLs> mirror all links in 1st level pages (-Y)
|
||||
--testlinks <URLs> test links in pages (-r1p0C0I0t)
|
||||
--spider <URLs> spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
|
||||
--testsite <URLs> identical to --spider
|
||||
--skeleton <URLs> make a mirror, but gets only html files (-p1)
|
||||
--update update a mirror, without confirmation (-iC2)
|
||||
--continue continue a mirror, without confirmation (-iC1)
|
||||
|
||||
@@ -356,17 +356,17 @@ Shortcuts:
|
||||
|
||||
--http10 force http/1.0 requests (-%h)
|
||||
|
||||
example: httrack www.someweb.com/bob/
|
||||
means: mirror site www.someweb.com/bob/ and only this site
|
||||
example: httrack www.example.com/bob/
|
||||
means: mirror site www.example.com/bob/ and only this site
|
||||
|
||||
example: httrack www.someweb.com/bob/ www.anothertest.com/mike/ +*.com/*.jpg
|
||||
example: httrack www.example.com/bob/ www.anothertest.com/mike/ +*.com/*.jpg
|
||||
means: mirror the two sites together (with shared links) and accept any .jpg files on .com sites
|
||||
|
||||
example: httrack www.someweb.com/bob/bobby.html +* -r6
|
||||
example: httrack www.example.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
|
||||
|
||||
example: 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
|
||||
example: httrack www.example.com/bob/bobby.html --spider -P proxy.myhost.com:8080
|
||||
runs the spider on www.example.com/bob/bobby.html using a proxy
|
||||
|
||||
example: httrack --update
|
||||
updates a mirror in the current folder
|
||||
@@ -387,13 +387,13 @@ with examples... I will be here a while...
|
||||
<hr>
|
||||
<h2> Syntax </h2>
|
||||
|
||||
<pre><b><i>httrack <URLs> [-option] [+<FILTERs>] [-<FILTERs>] </i></b></pre>
|
||||
<pre><b><i>httrack <URLs> [-option] [+<FILTERs>] [-<FILTERs>] </i></b></pre>
|
||||
|
||||
<p align=justify> The syntax of httrack is quite simple. You specify
|
||||
the URLs you wish to start the process from (<URLS>), any options you
|
||||
the URLs you wish to start the process from (<URLS>), any options you
|
||||
might want to add ([-option], any filters specifying places you should
|
||||
([+<FILTERs>]) and should not ([-<FILTERs>]) go, and end the command
|
||||
line by pressing <enter>. Httrack then goes off and does your bidding.
|
||||
([+<FILTERs>]) and should not ([-<FILTERs>]) go, and end the command
|
||||
line by pressing <enter>. Httrack then goes off and does your bidding.
|
||||
For example:
|
||||
|
||||
<pre><b><i>
|
||||
@@ -425,7 +425,7 @@ site. Specifically, the defauls are:
|
||||
pN priority mode: (* p3) *3 save all files
|
||||
D *can only go down into subdirs
|
||||
a *stay on the same address
|
||||
--mirror <URLs> *make a mirror of site(s) (default)
|
||||
--mirror <URLs> *make a mirror of site(s) (default)
|
||||
</pre>
|
||||
|
||||
<p align=justify> Here's what all of that means:
|
||||
@@ -542,7 +542,7 @@ subdirectories of the starting directory to be investigated.
|
||||
search started are to be collected. Other sites they point to are not
|
||||
to be imaged.
|
||||
|
||||
<pre><b><i> --mirror <URLs> *make a mirror of site(s) (default) </i></b></pre>
|
||||
<pre><b><i> --mirror <URLs> *make a mirror of site(s) (default) </i></b></pre>
|
||||
|
||||
<p align=justify> This indicates that the program should try to make a
|
||||
copy of the site as well as it can.
|
||||
@@ -921,7 +921,7 @@ Links options:
|
||||
%P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use)
|
||||
n get non-html files 'near' an html file (ex: an image located outside)
|
||||
t test all URLs (even forbidden ones)
|
||||
%L <file> add all URL located in this text file (one URL per line)
|
||||
%L <file> add all URL located in this text file (one URL per line)
|
||||
</i></b></pre>
|
||||
|
||||
<p align=justify> The links options allow you to control what links are
|
||||
@@ -1183,7 +1183,7 @@ Spider options:
|
||||
%h force HTTP/1.0 requests (reduce update features, only for old servers or proxies)
|
||||
%B tolerant requests (accept bogus responses on some servers, but not standard!)
|
||||
%s update hacks: various hacks to limit re-transfers when updating
|
||||
%A assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume <param>)
|
||||
%A assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume <param>)
|
||||
</i></b></pre>
|
||||
|
||||
<p align=justify> By default, cookies are universally accepted and
|
||||
@@ -1387,7 +1387,7 @@ web servers leave footprints in the browser.
|
||||
Browser ID:
|
||||
F user-agent field (-F "user-agent name")
|
||||
%F footer string in Html code (-%F "Mirrored [from host %s [file %s [at %s]]]"
|
||||
%l preferred language (-%l "fr, en, jp, *" (--language <param>)
|
||||
%l preferred language (-%l "fr, en, jp, *" (--language <param>)
|
||||
</i></b></pre>
|
||||
|
||||
<p align=justify> The user-agent field is used by browsers to determine
|
||||
@@ -1799,7 +1799,7 @@ based authentication)
|
||||
|
||||
<pre><b><i>
|
||||
Command-line specific options:
|
||||
V execute system command after each files ($0 is the filename: -V "rm \$0") (--userdef-cmd <param>)
|
||||
V execute system command after each files ($0 is the filename: -V "rm \$0") (--userdef-cmd <param>)
|
||||
</i></b></pre>
|
||||
|
||||
<p align=justify> This option is very nice for a wide array of actions
|
||||
@@ -1811,7 +1811,7 @@ httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -V "/bin/echo \$0"
|
||||
</i></b></pre>
|
||||
|
||||
<pre>
|
||||
%U run the engine with another id when called as root (-%U smith) (--user <param>)
|
||||
%U run the engine with another id when called as root (-%U smith) (--user <param>)
|
||||
</pre>
|
||||
|
||||
<p align=justify> Change the UID of the owner when running as r00t
|
||||
@@ -1856,14 +1856,14 @@ of other options that are commonly used.
|
||||
|
||||
<pre><b><i>
|
||||
Shortcuts:
|
||||
--mirror <URLs> *make a mirror of site(s) (default)
|
||||
--get <URLs> get the files indicated, do not seek other URLs (-qg)
|
||||
--list <text file> add all URL located in this text file (-%L)
|
||||
--mirrorlinks <URLs> mirror all links in 1st level pages (-Y)
|
||||
--testlinks <URLs> test links in pages (-r1p0C0I0t)
|
||||
--spider <URLs> spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
|
||||
--testsite <URLs> identical to --spider
|
||||
--skeleton <URLs> make a mirror, but gets only html files (-p1)
|
||||
--mirror <URLs> *make a mirror of site(s) (default)
|
||||
--get <URLs> get the files indicated, do not seek other URLs (-qg)
|
||||
--list <text file> add all URL located in this text file (-%L)
|
||||
--mirrorlinks <URLs> mirror all links in 1st level pages (-Y)
|
||||
--testlinks <URLs> test links in pages (-r1p0C0I0t)
|
||||
--spider <URLs> spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
|
||||
--testsite <URLs> identical to --spider
|
||||
--skeleton <URLs> make a mirror, but gets only html files (-p1)
|
||||
--update update a mirror, without confirmation (-iC2)
|
||||
--continue continue a mirror, without confirmation (-iC1)
|
||||
--catchurl create a temporary proxy to capture an URL or a form post URL
|
||||
@@ -2019,15 +2019,15 @@ are in reverse priority order. Here's an example:
|
||||
<td>no characters must be present after</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <b> <filter>*[< NN]</b></td>
|
||||
<td> <b> <filter>*[< NN]</b></td>
|
||||
<td> size less than NN Kbytes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <b> <filter>*[> PP]</b></td>
|
||||
<td> <b> <filter>*[> PP]</b></td>
|
||||
<td> size more than PP Kbytes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <b> <filter>*[< NN > PP]</b></td>
|
||||
<td> <b> <filter>*[< NN > PP]</b></td>
|
||||
<td> size less than NN Kbytes and more than PP Kbytes</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -2054,8 +2054,8 @@ generated automatically using the interface)
|
||||
<td>This will accept all zip files in .com addresses</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>-*someweb*/*.tar*</b></td>
|
||||
<td>This will refuse all tar (or tar.gz etc.) files in hosts containing someweb</td>
|
||||
<td><b>-*example*/*.tar*</b></td>
|
||||
<td>This will refuse all tar (or tar.gz etc.) files in hosts containing example</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>+*/*somepage*</b></td>
|
||||
|
||||
@@ -109,8 +109,8 @@ See also: The <a href="faq.html#VF1">FAQ</a><br>
|
||||
|
||||
<i>You have to know that once you have defined
|
||||
starts links, the default mode is to mirror these links - i.e. if one of your start page is
|
||||
www.someweb.com/test/index.html, all links starting with www.someweb.com/test/ will be
|
||||
accepted. But links directly in www.someweb.com/.. will not be accepted, however, because
|
||||
www.example.com/test/index.html, all links starting with www.example.com/test/ will be
|
||||
accepted. But links directly in www.example.com/.. will not be accepted, however, because
|
||||
they are in a higher strcuture. This prevent HTTrack from mirroring the whole site. (All
|
||||
files in structure levels equal or lower than the primary links will be retrieved.)<br>
|
||||
</i>
|
||||
@@ -278,8 +278,8 @@ See also: The <a href="faq.html#VF1">FAQ</a><br>
|
||||
<td>This will refuse/accept all zip files in .com addresses</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><tt>*someweb*/*.tar*</tt></td>
|
||||
<td>This will refuse/accept all tar (or tar.gz etc.) files in hosts containing someweb</td>
|
||||
<td nowrap><tt>*example*/*.tar*</tt></td>
|
||||
<td>This will refuse/accept all tar (or tar.gz etc.) files in hosts containing example</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><tt>*/*somepage*</tt></td>
|
||||
@@ -289,13 +289,13 @@ See also: The <a href="faq.html#VF1">FAQ</a><br>
|
||||
<td nowrap><tt>*.html</tt></td>
|
||||
<td>This will refuse/accept all html files. <br>
|
||||
Warning! With this filter you will accept ALL html files, even those in other addresses.
|
||||
(causing a global (!) web mirror..) Use www.someweb.com/*.html to accept all html files from
|
||||
(causing a global (!) web mirror..) Use www.example.com/*.html to accept all html files from
|
||||
a web.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><tt>*.html*[]</tt></td>
|
||||
<td>Identical to <tt>*.html</tt>, but the link must not have any supplemental characters
|
||||
at the end (links with parameters, like <tt>www.someweb.com/index.html?page=10</tt>, will be
|
||||
at the end (links with parameters, like <tt>www.example.com/index.html?page=10</tt>, will be
|
||||
refused)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -123,12 +123,12 @@ mirrored site, and resume interrupted downloads.</p>
|
||||
|
||||
|
||||
<p style="margin-left:11%; margin-top: 1em"><b>httrack
|
||||
www.someweb.com/bob/</b></p>
|
||||
www.example.com/bob/</b></p>
|
||||
|
||||
<p style="margin-left:22%;">mirror site
|
||||
www.someweb.com/bob/ and only this site</p>
|
||||
www.example.com/bob/ and only this site</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>httrack www.someweb.com/bob/
|
||||
<p style="margin-left:11%;"><b>httrack www.example.com/bob/
|
||||
www.anothertest.com/mike/ +*.com/*.jpg <br>
|
||||
-mime:application/*</b></p>
|
||||
|
||||
@@ -137,18 +137,18 @@ www.anothertest.com/mike/ +*.com/*.jpg <br>
|
||||
sites</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>httrack
|
||||
www.someweb.com/bob/bobby.html +* -r6</b></p>
|
||||
www.example.com/bob/bobby.html +* -r6</b></p>
|
||||
|
||||
<p style="margin-left:22%;">means get all files starting
|
||||
from bobby.html, with 6 link-depth, and possibility of going
|
||||
everywhere on the web</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>httrack
|
||||
www.someweb.com/bob/bobby.html --spider -P <br>
|
||||
www.example.com/bob/bobby.html --spider -P <br>
|
||||
proxy.myhost.com:8080</b></p>
|
||||
|
||||
<p style="margin-left:22%;">runs the spider on
|
||||
www.someweb.com/bob/bobby.html using a proxy</p>
|
||||
www.example.com/bob/bobby.html using a proxy</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>httrack --update</b></p>
|
||||
|
||||
@@ -1877,7 +1877,7 @@ User-defined option N</b> <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>
|
||||
%h Host name (ex: www.example.com) <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>
|
||||
|
||||
@@ -131,16 +131,16 @@ This is the default primary scanning option, the engine does not go out of domai
|
||||
|
||||
d stay on the same principal domain
|
||||
This option lets the engine go on all sites that exist on the same principal domain.
|
||||
Example: a link located at www.someweb.com that goes to members.someweb.com will be followed.
|
||||
Example: a link located at www.example.com that goes to members.example.com will be followed.
|
||||
|
||||
l stay on the same location (.com, etc.)
|
||||
This option lets the engine go on all sites that exist on the same location.
|
||||
Example: a link located at www.someweb.com that goes to www.anyotherweb.com will be followed.
|
||||
Example: a link located at www.example.com that goes to www.anyotherweb.com will be followed.
|
||||
Warning: this is a potentially dangerous option, limit the recurse depth with r option.
|
||||
|
||||
e go everywhere on the web
|
||||
This option lets the engine go on any sites.
|
||||
Example: a link located at www.someweb.com that goes to www.anyotherweb.org will be followed.
|
||||
Example: a link located at www.example.com that goes to www.anyotherweb.org will be followed.
|
||||
Warning: this is a potentially dangerous option, limit the recurse depth with r option.
|
||||
|
||||
n get non-html files 'near' an html file (ex: an image located outside)
|
||||
|
||||
@@ -117,7 +117,7 @@ h4 { margin: 0; font-weight: bold; font-size: 1.18em; }
|
||||
<li>HTML Footer</li>
|
||||
<br><small>Enter here the optionnal text that will be included as a comment in each HTML file to make archiving easier
|
||||
<br>The string entered is generally an HTML comment (<tt><!-- HTML comment --></tt>) with optionnal %s, which will be transformed into a specific string information:
|
||||
<br>%s #1 : host name (for example, www.someweb.com)
|
||||
<br>%s #1 : host name (for example, www.example.com)
|
||||
<br>%s #2 : file name (for example, /index.html)
|
||||
<br>%s #3 : date of the mirror
|
||||
<br><b>Example</b>: <tt><!-- Page mirrored from %s, file %s. Archive date: %s --></tt>
|
||||
|
||||
@@ -7,7 +7,7 @@ uk
|
||||
LANGUAGE_AUTHOR
|
||||
Andrij Shevchuk (http://programy.com.ua, http://vic-info.com.ua) \r\n
|
||||
LANGUAGE_CHARSET
|
||||
ISO-8859-5
|
||||
windows-1251
|
||||
LANGUAGE_WINDOWSID
|
||||
Ukrainian
|
||||
OK
|
||||
|
||||
@@ -13,3 +13,9 @@ regen-man: makeman.sh $(top_builddir)/src/httrack$(EXEEXT)
|
||||
README='$(top_srcdir)/README' $(SHELL) $(srcdir)/makeman.sh \
|
||||
'$(top_builddir)/src/httrack$(EXEEXT)' > $(srcdir)/httrack.1
|
||||
.PHONY: regen-man
|
||||
|
||||
# Render html/httrack.man.html from httrack.1. Needs the groff html device
|
||||
# (Debian: full "groff" package, not "groff-base"). Run by hand: make -C man regen-man-html
|
||||
regen-man-html: httrack.1
|
||||
groff -t -man -Thtml $(srcdir)/httrack.1 > $(top_srcdir)/html/httrack.man.html
|
||||
.PHONY: regen-man-html
|
||||
|
||||
@@ -551,6 +551,12 @@ regen-man: makeman.sh $(top_builddir)/src/httrack$(EXEEXT)
|
||||
'$(top_builddir)/src/httrack$(EXEEXT)' > $(srcdir)/httrack.1
|
||||
.PHONY: regen-man
|
||||
|
||||
# Render html/httrack.man.html from httrack.1. Needs the groff html device
|
||||
# (Debian: full "groff" package, not "groff-base"). Run by hand: make -C man regen-man-html
|
||||
regen-man-html: httrack.1
|
||||
groff -t -man -Thtml $(srcdir)/httrack.1 > $(top_srcdir)/html/httrack.man.html
|
||||
.PHONY: regen-man-html
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.\" groff -man -Tascii httrack.1
|
||||
.\"
|
||||
.\" This file is generated by man/makeman.sh; do not edit by hand.
|
||||
.TH httrack 1 "07 June 2026" "httrack website copier"
|
||||
.TH httrack 1 "13 June 2026" "httrack website copier"
|
||||
.SH NAME
|
||||
httrack \- offline browser : copy websites to a local directory
|
||||
.SH SYNOPSIS
|
||||
@@ -98,15 +98,15 @@ httrack \- offline browser : copy websites to a local directory
|
||||
allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer. HTTrack arranges the original site's relative link-structure. Simply open a page of the "mirrored" website in your browser, and you can browse the site from link to link, as if you were viewing it online. HTTrack can also update an existing mirrored site, and resume interrupted downloads.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
.B httrack www.someweb.com/bob/
|
||||
mirror site www.someweb.com/bob/ and only this site
|
||||
.B httrack www.example.com/bob/
|
||||
mirror site www.example.com/bob/ and only this site
|
||||
.TP
|
||||
.B httrack www.someweb.com/bob/ www.anothertest.com/mike/ +*.com/*.jpg \-mime:application/*
|
||||
.B httrack www.example.com/bob/ www.anothertest.com/mike/ +*.com/*.jpg \-mime:application/*
|
||||
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
|
||||
.B httrack www.example.com/bob/bobby.html +* \-r6
|
||||
.TP
|
||||
.B httrack www.someweb.com/bob/bobby.html \-\-spider \-P proxy.myhost.com:8080
|
||||
.B httrack www.example.com/bob/bobby.html \-\-spider \-P proxy.myhost.com:8080
|
||||
.TP
|
||||
.B httrack \-\-update
|
||||
.TP
|
||||
@@ -411,7 +411,7 @@ File type (ex: gif)
|
||||
.IP \-%p
|
||||
Path [without ending /] (ex: /someimages)
|
||||
.IP \-%h
|
||||
Host name (ex: www.someweb.com)
|
||||
Host name (ex: www.example.com)
|
||||
.IP \-%M
|
||||
URL MD5 (128 bits, 32 ascii bytes)
|
||||
.IP \-%Q
|
||||
|
||||
@@ -2899,7 +2899,9 @@ static int hts_main_internal(int argc, char **argv, httrackp * opt) {
|
||||
}
|
||||
|
||||
{
|
||||
char n_lock[256];
|
||||
/* Sized to the concat-buffer capacity so it can always hold the lock-file
|
||||
path produced by fconcat(), even with a long log path (issue #183). */
|
||||
char n_lock[OPT_GET_BUFF_SIZE(opt)];
|
||||
|
||||
// on peut pas avoir un affichage ET un fichier log
|
||||
// ca sera pour la version 2
|
||||
|
||||
@@ -712,7 +712,7 @@ void help(const char *app, int more) {
|
||||
infomsg(" '%N' Name of file, including file type (ex: image.gif)");
|
||||
infomsg(" '%t' File type (ex: gif)");
|
||||
infomsg(" '%p' Path [without ending /] (ex: /someimages)");
|
||||
infomsg(" '%h' Host name (ex: www.someweb.com)");
|
||||
infomsg(" '%h' Host name (ex: www.example.com)");
|
||||
infomsg(" '%M' URL MD5 (128 bits, 32 ascii bytes)");
|
||||
infomsg(" '%Q' query string MD5 (128 bits, 32 ascii bytes)");
|
||||
infomsg(" '%k' full query string");
|
||||
@@ -767,21 +767,21 @@ void help(const char *app, int more) {
|
||||
infomsg("Details: Option %W: External callbacks prototypes");
|
||||
infomsg("see htsdefines.h");
|
||||
infomsg("");
|
||||
infomsg("example: httrack www.someweb.com/bob/");
|
||||
infomsg("means: mirror site www.someweb.com/bob/ and only this site");
|
||||
infomsg("example: httrack www.example.com/bob/");
|
||||
infomsg("means: mirror site www.example.com/bob/ and only this site");
|
||||
infomsg("");
|
||||
infomsg
|
||||
("example: httrack www.someweb.com/bob/ www.anothertest.com/mike/ +*.com/*.jpg -mime:application/*");
|
||||
("example: httrack www.example.com/bob/ www.anothertest.com/mike/ +*.com/*.jpg -mime:application/*");
|
||||
infomsg
|
||||
("means: mirror the two sites together (with shared links) and accept any .jpg files on .com sites");
|
||||
infomsg("");
|
||||
infomsg("example: httrack www.someweb.com/bob/bobby.html +* -r6");
|
||||
infomsg("example: httrack www.example.com/bob/bobby.html +* -r6");
|
||||
infomsg
|
||||
("means get all files starting from bobby.html, with 6 link-depth, and possibility of going everywhere on the web");
|
||||
infomsg("");
|
||||
infomsg
|
||||
("example: httrack www.someweb.com/bob/bobby.html --spider -P proxy.myhost.com:8080");
|
||||
infomsg("runs the spider on www.someweb.com/bob/bobby.html using a proxy");
|
||||
("example: httrack www.example.com/bob/bobby.html --spider -P proxy.myhost.com:8080");
|
||||
infomsg("runs the spider on www.example.com/bob/bobby.html using a proxy");
|
||||
infomsg("");
|
||||
infomsg("example: httrack --update");
|
||||
infomsg("updates a mirror in the current folder");
|
||||
|
||||
@@ -895,9 +895,9 @@ int http_sendhead(httrackp * opt, t_cookie * cookie, int mode,
|
||||
|
||||
// possibilité non documentée: >post: et >postfile:
|
||||
// si présence d'un tag >post: alors executer un POST
|
||||
// exemple: http://www.someweb.com/test.cgi?foo>post:posteddata=10&foo=5
|
||||
// exemple: http://www.example.com/test.cgi?foo>post:posteddata=10&foo=5
|
||||
// si présence d'un tag >postfile: alors envoyer en tête brut contenu dans le fichier en question
|
||||
// exemple: http://www.someweb.com/test.cgi?foo>postfile:post0.txt
|
||||
// exemple: http://www.example.com/test.cgi?foo>postfile:post0.txt
|
||||
search_tag = strstr(fil, POSTTOK ":");
|
||||
if (!search_tag) {
|
||||
search_tag = strstr(fil, POSTTOK "file:");
|
||||
|
||||
@@ -274,6 +274,28 @@ Please visit our Website: http://www.httrack.com
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* Percent-encode the angle brackets of a string so it is safe to embed inside
|
||||
an HTML comment (the default footer) or any other HTML context. A URL holding
|
||||
"-->" would otherwise close the footer comment and inject markup (issue #165).
|
||||
Raw '<' and '>' are not valid URL characters, so encoding them is harmless. */
|
||||
static const char *html_inline_safe(const char *src, char *dst, size_t size) {
|
||||
size_t i, j;
|
||||
|
||||
for(i = 0, j = 0; src[i] != '\0' && j + 4 < size; i++) {
|
||||
const char c = src[i];
|
||||
|
||||
if (c == '<' || c == '>') {
|
||||
dst[j++] = '%';
|
||||
dst[j++] = '3';
|
||||
dst[j++] = (c == '<') ? 'C' : 'E';
|
||||
} else {
|
||||
dst[j++] = c;
|
||||
}
|
||||
}
|
||||
dst[j] = '\0';
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* Main parser */
|
||||
int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
char catbuff[CATBUFF_SIZE];
|
||||
@@ -719,13 +741,16 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
|
||||
if (StringNotEmpty(opt->footer)) {
|
||||
char BIGSTK tempo[1024 + HTS_URLMAXSIZE * 2];
|
||||
char gmttime[256];
|
||||
char BIGSTK safe_adr[HTS_URLMAXSIZE * 3 + 4];
|
||||
char BIGSTK safe_fil[HTS_URLMAXSIZE * 3 + 4];
|
||||
|
||||
tempo[0] = '\0';
|
||||
time_gmt_rfc822(gmttime);
|
||||
strcatbuff(tempo, eol);
|
||||
hts_template_format_str(tempo + strlen(tempo), sizeof(tempo) - strlen(tempo),
|
||||
StringBuff(opt->footer),
|
||||
jump_identification_const(urladr()), urlfil(), gmttime,
|
||||
html_inline_safe(jump_identification_const(urladr()), safe_adr, sizeof(safe_adr)),
|
||||
html_inline_safe(urlfil(), safe_fil, sizeof(safe_fil)), gmttime,
|
||||
HTTRACK_VERSIONID, /* EOF */ NULL);
|
||||
strcatbuff(tempo, eol);
|
||||
//fwrite(tempo,1,strlen(tempo),fp);
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# minimalistic charset test
|
||||
test "$(httrack -O /dev/null -#3 "iso-8859-1" "café")" == "café" || exit 1
|
||||
# charset -> UTF-8 conversion (hts_convertStringToUTF8).
|
||||
# -#3 <charset> <string> prints the string re-decoded from <charset> as UTF-8.
|
||||
conv() {
|
||||
test "$(httrack -O /dev/null -#3 "$1" "$2")" == "$3" || exit 1
|
||||
}
|
||||
# crash probe: malformed input must exit cleanly, not abort.
|
||||
runs() {
|
||||
httrack -O /dev/null -#3 "$1" "$2" >/dev/null 2>&1 || exit 1
|
||||
}
|
||||
|
||||
# the source bytes below are UTF-8 (this file is UTF-8); "café" is 0x63 61 66 C3 A9.
|
||||
|
||||
# already UTF-8: identity
|
||||
conv 'utf-8' 'café' 'café'
|
||||
|
||||
# bytes reinterpreted as latin-1: each input byte becomes one codepoint
|
||||
conv 'iso-8859-1' 'café' 'café'
|
||||
|
||||
# windows-1252 is NOT latin-1: 0x80 is the euro sign, not U+0080. This is the
|
||||
# case that actually exercises the cp1252 table (the 0x80-0x9F range).
|
||||
conv 'windows-1252' $'\x80' '€'
|
||||
|
||||
# pure ASCII is charset-invariant
|
||||
conv 'us-ascii' 'hello' 'hello'
|
||||
|
||||
# unknown charset: ASCII passes through unchanged, but non-ASCII input cannot be
|
||||
# decoded and yields empty output (an error is printed to stderr).
|
||||
conv 'no-such-charset-xyz' 'abc' 'abc'
|
||||
test "$(httrack -O /dev/null -#3 'no-such-charset-xyz' 'café' 2>/dev/null)" == "" || exit 1
|
||||
|
||||
# malformed UTF-8 (lone continuation byte, truncated lead byte) must not crash
|
||||
runs 'utf-8' $'\x80'
|
||||
runs 'utf-8' $'\xc3'
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# basic entities handling (with boggy entities handling)
|
||||
test "$(httrack -O /dev/null -#6 "&foo; thé&café&#e9;もののけ姫")" == "&foo; thé&café&#e9;もののけ姫" || exit 1
|
||||
# HTML entity unescaping (hts_unescapeEntitiesWithCharset).
|
||||
# -#6 <string> prints the string with entities decoded (UTF-8 output).
|
||||
ent() {
|
||||
test "$(httrack -O /dev/null -#6 "$1")" == "$2" || exit 1
|
||||
}
|
||||
# crash probe: malformed input must exit cleanly, not abort.
|
||||
runs() {
|
||||
httrack -O /dev/null -#6 "$1" >/dev/null 2>&1 || exit 1
|
||||
}
|
||||
|
||||
# named entities
|
||||
ent '&' '&'
|
||||
ent '<>' '<>'
|
||||
ent 'é' 'é'
|
||||
|
||||
# numeric: decimal and hex
|
||||
ent 'AB' 'AB'
|
||||
ent 'A' 'A'
|
||||
ent 'é' 'é'
|
||||
|
||||
# malformed numeric reference (decimal 'e9' has no digits) is left verbatim
|
||||
ent '&#e9;' '&#e9;'
|
||||
|
||||
# U+0000 is not emitted; the reference is left verbatim
|
||||
ent '�' '�'
|
||||
|
||||
# unknown entity is left verbatim
|
||||
ent '&unknownentity;' '&unknownentity;'
|
||||
|
||||
# no entities: pass-through
|
||||
ent 'plain text' 'plain text'
|
||||
|
||||
# decoding is a single pass: &amp; -> & (not &)
|
||||
ent '&amp;' '&'
|
||||
|
||||
# KNOWN BUG: (U+00A0) decodes to a plain space (0x20), not C2 A0. The
|
||||
# engine forces 160 -> 32 in htsencoding.c (FIXME hack). Locked here; if that
|
||||
# hack is ever removed, update this to expect the C2 A0 byte.
|
||||
ent ' ' ' '
|
||||
|
||||
# overflowing numeric reference must not crash (value far above U+10FFFF)
|
||||
runs '�'
|
||||
|
||||
# original compound case. NOTE: the space after '&foo;' is the known bug
|
||||
# above (U+00A0 -> 0x20), not a real space in the source.
|
||||
ent '&foo; thé&café&#e9;もののけ姫' '&foo; thé&café&#e9;もののけ姫'
|
||||
|
||||
71
tests/01_engine-filter.test
Executable file
71
tests/01_engine-filter.test
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# wildcard filter engine (strjoker), the core of +/- include/exclude rules.
|
||||
# -#0 <filter> <string> prints "<string> does match <filter>" or "... does NOT match ...".
|
||||
|
||||
match() {
|
||||
test "$(httrack -O /dev/null -#0 "$1" "$2")" == "$2 does match $1" || exit 1
|
||||
}
|
||||
nomatch() {
|
||||
test "$(httrack -O /dev/null -#0 "$1" "$2")" == "$2 does NOT match $1" || exit 1
|
||||
}
|
||||
|
||||
# bare star matches everything
|
||||
match '*' 'anything/at/all'
|
||||
|
||||
# prefix / suffix
|
||||
match 'foo*' 'foobar'
|
||||
nomatch 'foo*' 'xfoobar'
|
||||
match '*.gif' 'a/b/c.gif'
|
||||
|
||||
# extension match is case-insensitive
|
||||
match '*.GIF' 'a.gif'
|
||||
|
||||
# character classes
|
||||
match '*[A-Z].txt' 'B.txt'
|
||||
nomatch '*[A-Z].txt' 'b.txt'
|
||||
match '*[0-9]' '5'
|
||||
nomatch '*[0-9]' 'x'
|
||||
|
||||
# comma-separated class: both ranges are active, the comma is not matched
|
||||
# literally and a char in neither range fails
|
||||
match '*[A-Z,0-9]' 'Q'
|
||||
match '*[A-Z,0-9]' '3'
|
||||
nomatch '*[A-Z,0-9]' 'a'
|
||||
|
||||
# named groups: [file] stops at '/', [path] spans it
|
||||
match '*[file].html' 'foo.html'
|
||||
nomatch '*[file].html' 'foo/bar.html'
|
||||
match '*[path]x' 'a/b/x'
|
||||
|
||||
# *[] means "nothing more after the star"
|
||||
nomatch '*[]' 'abc'
|
||||
|
||||
# multiple stars
|
||||
match '*foo*bar' 'foozbar'
|
||||
|
||||
# '?' is the query-string marker, not a single-char wildcard
|
||||
nomatch 'a?c' 'abc'
|
||||
|
||||
# backslash escapes a metacharacter inside a class so it is matched literally.
|
||||
# Quirk: the decoder also adds the backslash itself to the set, so '\X' matches
|
||||
# both X and '\'. These assertions pin that behavior.
|
||||
match '*[\*]' '*'
|
||||
match '*[\*]' "\\"
|
||||
nomatch '*[\*]' 'a'
|
||||
match '*[\\]' "\\"
|
||||
nomatch '*[\\]' 'a'
|
||||
match '*[\[]' '['
|
||||
match '*[\[]' "\\"
|
||||
nomatch '*[\[]' 'a'
|
||||
|
||||
# A literal ']' cannot be a class member: the class parser stops at the first
|
||||
# ']', escaped or not. So '*[\[\]]' does NOT mean "the [ or ] character" as the
|
||||
# filter guide claims (GitHub #148); it parses as the class {'[','\'} followed
|
||||
# by a trailing literal ']'. These assertions document the current (buggy)
|
||||
# behavior so any future matcher fix is a deliberate, visible change.
|
||||
nomatch '*[\[\]]' '[' # not matched, despite the docs
|
||||
match '*[\[\]]' ']' # only via the empty class-match + trailing ']'
|
||||
match '*[\[\]]' '[]' # one of {'[','\'} then the trailing ']'
|
||||
nomatch '*[\[\]]' '[]x'
|
||||
@@ -1,10 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# IDNA routine
|
||||
test "$(httrack -O /dev/null -#4 "www.café.com")" == "www.xn--caf-dma.com" || exit 1
|
||||
test "$(httrack -O /dev/null -#4 "www.もののけ姫-the-movie.com")" == "www.xn---the-movie-g63irla2z8297c.com" || exit 1
|
||||
# IDNA / punycode encode (-#4) and decode (-#5). This code has a CVE history,
|
||||
# so the edge cases below cover passthrough, round-trips, and malformed input.
|
||||
|
||||
# reverse IDNA
|
||||
test "$(httrack -O /dev/null -#5 "www.xn--caf-dma.com")" == "www.café.com" || exit 1
|
||||
test "$(httrack -O /dev/null -#5 "www.xn---the-movie-g63irla2z8297c.com")" == "www.もののけ姫-the-movie.com" || exit 1
|
||||
enc() { test "$(httrack -O /dev/null -#4 "$1")" == "$2" || exit 1; }
|
||||
dec() { test "$(httrack -O /dev/null -#5 "$1")" == "$2" || exit 1; }
|
||||
# crash probe: malformed ACE input must exit cleanly, not abort.
|
||||
runs() { httrack -O /dev/null -#5 "$1" >/dev/null 2>&1 || exit 1; }
|
||||
|
||||
# encode
|
||||
enc 'www.café.com' 'www.xn--caf-dma.com'
|
||||
enc 'www.もののけ姫-the-movie.com' 'www.xn---the-movie-g63irla2z8297c.com'
|
||||
enc 'münchen.de' 'xn--mnchen-3ya.de'
|
||||
|
||||
# decode (reverse of the above)
|
||||
dec 'www.xn--caf-dma.com' 'www.café.com'
|
||||
dec 'www.xn---the-movie-g63irla2z8297c.com' 'www.もののけ姫-the-movie.com'
|
||||
dec 'xn--mnchen-3ya.de' 'münchen.de'
|
||||
|
||||
# pure-ASCII hostnames are unchanged either way
|
||||
enc 'plain.example.com' 'plain.example.com'
|
||||
dec 'plain.example.com' 'plain.example.com'
|
||||
enc 'a.b.c.example.org' 'a.b.c.example.org'
|
||||
|
||||
# an all-ASCII label (even one starting with the xn-- prefix) is passed through
|
||||
# by the encoder untouched, since there is nothing to encode
|
||||
enc 'xn--already-encoded.com' 'xn--already-encoded.com'
|
||||
|
||||
# an empty punycode payload decodes back to the bare xn-- label
|
||||
dec 'xn--' 'xn--'
|
||||
|
||||
# malformed ACE payloads (invalid base-36, garbage) must not crash
|
||||
runs 'xn--!!!'
|
||||
runs 'xn--already-encoded.com'
|
||||
|
||||
27
tests/01_engine-mime.test
Executable file
27
tests/01_engine-mime.test
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# MIME type guessing from extension (get_httptype / give_mimext).
|
||||
# -#2 <path> prints "<path> is '<mime>'" then "and its local type is '.<ext>'".
|
||||
|
||||
mime() {
|
||||
test "$(httrack -O /dev/null -#2 "$1" | head -1)" == "$1 is '$2'" || exit 1
|
||||
}
|
||||
unknown() {
|
||||
test "$(httrack -O /dev/null -#2 "$1" | head -1)" == "$1 is of an unknown MIME type" || exit 1
|
||||
}
|
||||
|
||||
mime '/a/b.html' 'text/html'
|
||||
mime '/a/b.htm' 'text/html'
|
||||
mime '/x.css' 'text/css'
|
||||
mime '/x.js' 'application/x-javascript'
|
||||
mime '/x.png' 'image/png'
|
||||
mime '/x.jpg' 'image/jpeg'
|
||||
mime '/x.gif' 'image/gif'
|
||||
mime '/x.txt' 'text/plain'
|
||||
mime '/x.xml' 'application/xml'
|
||||
mime '/x.pdf' 'application/pdf'
|
||||
|
||||
# no extension, or one not in the table
|
||||
unknown '/noext'
|
||||
unknown '/x.unknownext'
|
||||
@@ -1,9 +1,26 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# simplify engine
|
||||
test "$(httrack -O /dev/null -#1 ./foo/bar/)" == "simplified=foo/bar/" || exit 1
|
||||
test "$(httrack -O /dev/null -#1 ./foo/bar)" == "simplified=foo/bar" || exit 1
|
||||
test "$(httrack -O /dev/null -#1 ./foo/./bar)" == "simplified=foo/bar" || exit 1
|
||||
test "$(httrack -O /dev/null -#1 ./foo/bar/.././tmp/foobar)" == "simplified=foo/tmp/foobar" || exit 1
|
||||
test "$(httrack -O /dev/null -#1 ./foo/bar/.././tmp/foobar/../foobaz)" == "simplified=foo/tmp/foobaz" || exit 1
|
||||
# path simplify engine (fil_simplifie): collapses ./ and ../ segments.
|
||||
simp() {
|
||||
test "$(httrack -O /dev/null -#1 "$1")" == "simplified=$2" || exit 1
|
||||
}
|
||||
|
||||
simp './foo/bar/' 'foo/bar/'
|
||||
simp './foo/bar' 'foo/bar'
|
||||
simp './foo/./bar' 'foo/bar'
|
||||
simp './foo/bar/.././tmp/foobar' 'foo/tmp/foobar'
|
||||
simp './foo/bar/.././tmp/foobar/../foobaz' 'foo/tmp/foobaz'
|
||||
|
||||
# single '..' collapses one segment
|
||||
simp './a/../b' 'b'
|
||||
simp './a/b/../../c' 'c'
|
||||
|
||||
# repeated './' is squeezed
|
||||
simp './a/./././b' 'a/b'
|
||||
|
||||
# leading '..' that would go above the root is discarded, per RFC 3986 §5.2.4
|
||||
simp './a/../../b' 'b'
|
||||
|
||||
# empty segments ('//') are not dot-segments and are preserved, per RFC 3986
|
||||
simp 'a//b' 'a//b'
|
||||
|
||||
@@ -9,6 +9,6 @@ TESTS_ENVIRONMENT += HTTPS_SUPPORT=$(HTTPS_SUPPORT)
|
||||
TESTS_ENVIRONMENT += top_srcdir=$(top_srcdir)
|
||||
|
||||
TEST_EXTENSIONS = .test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-simplify.test 02_manpage-regen.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-longurl.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-filter.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-mime.test 01_engine-simplify.test 02_manpage-regen.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-longurl.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
|
||||
CLEANFILES = check-network_sh.cache
|
||||
|
||||
@@ -472,7 +472,7 @@ TESTS_ENVIRONMENT = PATH=$(top_builddir)/src$(PATH_SEPARATOR)$$PATH \
|
||||
ONLINE_UNIT_TESTS=$(ONLINE_UNIT_TESTS) \
|
||||
HTTPS_SUPPORT=$(HTTPS_SUPPORT) top_srcdir=$(top_srcdir)
|
||||
TEST_EXTENSIONS = .test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-simplify.test 02_manpage-regen.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-longurl.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
TESTS = 00_runnable.test 01_engine-charset.test 01_engine-entities.test 01_engine-filter.test 01_engine-hashtable.test 01_engine-idna.test 01_engine-mime.test 01_engine-simplify.test 02_manpage-regen.test 10_crawl-simple.test 11_crawl-cookies.test 11_crawl-idna.test 11_crawl-international.test 11_crawl-longurl.test 11_crawl-parsing.test 12_crawl_https.test
|
||||
CLEANFILES = check-network_sh.cache
|
||||
all: all-am
|
||||
|
||||
|
||||
Reference in New Issue
Block a user