Coverage Report

Created: 2026-12-01 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/httrack/src/htslib.h
Line
Count
Source
1
/* ------------------------------------------------------------ */
2
/*
3
HTTrack Website Copier, Offline Browser for Windows and Unix
4
Copyright (C) 1998 Xavier Roche and other contributors
5
6
SPDX-License-Identifier: GPL-3.0-or-later
7
8
This program is free software: you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation, either version 3 of the License, or
11
(at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21
Ethical use: we kindly ask that you NOT use this software to harvest email
22
addresses or to collect any other private information about people. Doing so
23
would dishonor our work and waste the many hours we have spent on it.
24
25
Please visit our Website: http://www.httrack.com
26
*/
27
28
/* ------------------------------------------------------------ */
29
/* File: Subroutines .h                                         */
30
/* Author: Xavier Roche                                         */
31
/* ------------------------------------------------------------ */
32
33
// Fichier librairie .h
34
35
#ifndef HTS_DEFH
36
#define HTS_DEFH
37
38
#include "httrack-library.h"
39
#include "htsfetch.h"
40
41
/* Forward definitions */
42
#ifndef HTS_DEF_FWSTRUCT_htsrequest
43
#define HTS_DEF_FWSTRUCT_htsrequest
44
typedef struct htsrequest htsrequest;
45
#endif
46
#ifndef HTS_DEF_FWSTRUCT_htsblk
47
#define HTS_DEF_FWSTRUCT_htsblk
48
typedef struct htsblk htsblk;
49
#endif
50
#ifndef HTS_DEF_FWSTRUCT_t_dnscache
51
#define HTS_DEF_FWSTRUCT_t_dnscache
52
typedef struct t_dnscache t_dnscache;
53
#endif
54
#ifndef HTS_DEF_FWSTRUCT_lien_adrfil
55
#define HTS_DEF_FWSTRUCT_lien_adrfil
56
typedef struct lien_adrfil lien_adrfil;
57
#endif
58
#ifndef HTS_DEF_FWSTRUCT_lien_adrfilsave
59
#define HTS_DEF_FWSTRUCT_lien_adrfilsave
60
typedef struct lien_adrfilsave lien_adrfilsave;
61
#endif
62
63
/* définitions globales */
64
#include "htsglobal.h"
65
#include "htsdate.h"
66
#include "htsurlport.h"
67
#include "htsbuf.h"
68
#include "htsmono.h"
69
70
/* basic net definitions */
71
#include "htsbase.h"
72
#include "htsbasenet.h"
73
#include "htsnet.h"
74
#include "htsdefines.h"
75
76
#include <limits.h>
77
#ifndef _WIN32
78
#include <signal.h>
79
#include <time.h>
80
#if defined(THREADS)
81
#include <pthread.h>
82
#endif
83
#endif
84
85
/* readdir() */
86
#ifndef _WIN32
87
#include <sys/types.h>
88
#include <dirent.h>
89
#endif
90
91
/* cookies et auth */
92
#include "htsbauth.h"
93
94
// Attention, définition existante également dans le shell
95
// (à modifier avec celle-ci)
96
0
#define POSTTOK "?>post"
97
98
/* Is this Location free of the >post: tokens? A redirect naming one makes the
99
   engine send a local file back to whoever chose the value, so every place
100
   that fills a location has to refuse it, the cache and a resume ref
101
   included. */
102
HTS_CHECK_RESULT hts_boolean hts_location_is_safe(const char *location);
103
104
#include "htsopt.h"
105
106
/* Engine helpers libhttrack does not export. */
107
108
/** Load a plugin shared library and run its hts_plug(opt, argv) entry point. On
109
    success the handle is recorded in opt and unloaded by hts_free_opt().
110
    @return 1 if loaded and hts_plug succeeded; 0 if loaded but hts_plug was
111
    missing or refused; -1 if the library could not be loaded. */
112
HTS_CHECK_RESULT int plug_wrapper(httrackp *opt, const char *moduleName,
113
                                  const char *argv);
114
115
/** va_list form of hts_log_print(). @p opt may be NULL (only the callback
116
   runs). Preserves errno. @p format must be non-NULL. */
117
void hts_log_vprint(httrackp *opt, int type,
118
                    HTS_FORMAT_STRING const char *format, va_list args)
119
    HTS_PRINTF_FUN(3, 0);
120
121
/** Human-readable build/feature string plus the names of plugged modules. The
122
    result is written into and aliases a 2048-byte scratch buffer inside opt: it
123
    is valid until that buffer is next used, and must not be freed. opt must be
124
    non-NULL. */
125
const char *hts_get_version_info(httrackp *opt);
126
127
/** Return the function pointer registered under @p name in opt as a uintptr_t,
128
   or 0 if none or unknown. */
129
uintptr_t htswrap_read(httrackp *opt, const char *name);
130
131
/** Read the percent-decoded `category=` value from a winprofile.ini file. The
132
    result is heap-allocated and owned by the caller (free with freet()), or
133
    NULL when the file is missing or has no category line. The bytes are not
134
    converted. They are UTF-8 if the file declares Charset=UTF-8, else the
135
    legacy encoding (the ANSI codepage on Windows). */
136
HTS_OWNED char *hts_getcategory(const char *filename);
137
138
/** Open a capture socket on 127.0.0.1, port *port (0 picks a free port). No
139
    other host can reach it, because the request it captures carries the
140
    browser's cookies for the target site. Writes the bound port back to *port
141
    and its dotted address into @p adr of @p adr_size bytes (left empty if the
142
    address does not fit), and returns the listening socket. Returns
143
    INVALID_SOCKET on failure. */
144
T_SOC catch_url_init(int *port, char *adr, size_t adr_size);
145
146
/** Whether the directory containing @p path exists. The basename is stripped
147
    first, so passing a file path tests its parent directory. @return 1 if it is
148
    a directory, 0 otherwise. */
149
HTS_CHECK_RESULT hts_boolean dir_exists(const char *path);
150
151
/** Return the static reason-phrase string for @p statuscode, or NULL if
152
   unknown. The pointer is a string literal; do not free it. */
153
const char *infostatuscode_const(int statuscode);
154
155
/** Like jump_identification() and also strip a leading "www." or "www-4."-style
156
    host prefix, returning a pointer into the input to the normalized host. */
157
const char *jump_normalized_const(const char *);
158
159
/** Return a pointer (into the input) to the ":port" part of a URL's authority,
160
    or NULL if there is no explicit port. A ':' in the path, query or fragment
161
    is never returned. Handles bracketed IPv6 literals. */
162
char *jump_toport(char *);
163
164
const char *jump_toport_const(const char *);
165
166
/** Canonicalize a URL path into @p dest: collapse duplicate '/' and sort the
167
    query-string arguments, so "?b=2&a=1" and "?a=1&b=2" compare equal. Returns
168
    @p dest, a caller buffer of at least strlen(source)+1 bytes (the output is
169
    never longer than the input). */
170
char *fil_normalized(const char *source, char *dest);
171
172
/** Percent-escape only spaces (' ' becomes "%20"); copy everything else
173
 * verbatim. */
174
size_t escape_spc_url(const char *const src, char *const dest,
175
                      const size_t size);
176
177
/** Percent-escape @p src as a URI: the control and high bytes, plus space,
178
    '*', '\'', '"', '&' and '!'. Every other byte is kept as it is, '/' and the
179
    other reserved characters included. */
180
size_t escape_uri(const char *const src, char *const dest, const size_t size);
181
182
/** Percent-escape as escape_uri() does, plus the reserved, delimiter and
183
    unwise characters other than '/'. */
184
size_t escape_uri_utf(const char *const src, char *const dest,
185
                      const size_t size);
186
187
/** Percent-escape the C0 control bytes of @p src (0x00-0x1f) and copy every
188
    other byte verbatim, so bytes >= 0x7f keep the UTF-8 they carry. */
189
size_t escape_control_url(const char *const src, hts_buf dest);
190
191
/** Append-variant of escape_spc_url(): escapes @p src after the existing
192
    NUL-terminated content of @p dest. Returns the bytes appended (excluding the
193
    NUL). */
194
size_t append_escape_spc_url(const char *const src, hts_buf dest);
195
196
/** Append-variant of escape_in_url(). See append_escape_spc_url(). */
197
size_t append_escape_in_url(const char *const src, hts_buf dest);
198
199
/** Append-variant of escape_check_url(). See append_escape_spc_url(). */
200
size_t append_escape_check_url(const char *const src, hts_buf dest);
201
202
/** In-place variant of escape_spc_url(): escapes the NUL-terminated string in
203
    @p dest back into @p dest. */
204
size_t inplace_escape_spc_url(char *const dest, const size_t size);
205
206
/** In-place variant of escape_in_url(). See inplace_escape_spc_url(). */
207
size_t inplace_escape_in_url(char *const dest, const size_t size);
208
209
/** In-place variant of escape_uri(). See inplace_escape_spc_url(). */
210
size_t inplace_escape_uri(char *const dest, const size_t size);
211
212
/** In-place variant of escape_uri_utf(). See inplace_escape_spc_url(). */
213
size_t inplace_escape_uri_utf(char *const dest, const size_t size);
214
215
/** Same escaping as escape_check_url() but returns @p dest instead of the byte
216
    count. */
217
char *escape_check_url_addr(const char *const src, hts_buf dest);
218
219
/** Build one opaque MIME/MHTML content-id token in @p dest from @p adr and
220
    @p fil: escape_in_url() escaping with '-' for '%', so two URLs never share
221
    a token. */
222
size_t make_content_id(const char *const adr, const char *const fil,
223
                       hts_buf dest);
224
225
/** Strip all control characters (byte value < 32) from @p s in place. */
226
void escape_remove_control(char *const s);
227
228
/** HTML-escape for text output: rewrite '&' to "&amp;" and pass every other
229
   byte through unchanged. */
230
size_t escape_for_html_print(const char *const s, char *const dest,
231
                             const size_t size);
232
233
/** Like escape_for_html_print() but also convert every high byte (>= 128) to a
234
    numeric entity "&#xNN;". */
235
size_t escape_for_html_print_full(const char *const s, char *const dest,
236
                                  const size_t size);
237
238
/** Classify @p fil by its extension: 0 unknown, 1 known non-HTML, 2 known HTML.
239
    Consults the built-in table then user --assume rules. 0 for a NULL @p fil.
240
 */
241
int is_knowntype(httrackp *opt, const char *fil);
242
243
/** Like is_knowntype() but consults only the user --assume rules: 0 no rule,
244
    1 non-HTML, 2 HTML. */
245
int is_userknowntype(httrackp *opt, const char *fil);
246
247
/** Is @p ext, an extension such as "asp" or "php" (not a full filename), a
248
    known dynamic-page type? */
249
hts_boolean is_dyntype(hts_span ext);
250
251
/** 1 if MIME type @p st must not be reclassified or renamed (hypertext types
252
   and a built-in keep-list of commonly mislabeled types), else 0. */
253
HTS_CHECK_RESULT hts_boolean may_unknown(httrackp *opt, const char *st);
254
255
/** Copy @p a into @p dst, converting every '\\' to '/' on all platforms. */
256
char *fslash(hts_buf dst, const char *a);
257
258
/** Write @p dir then @p name into @p b, with one '/' between them unless
259
    either is empty or has one there. NULL reads as "", as in concat(). FALSE,
260
    with @p b emptied, unless it all fits, so a part is never dropped. */
261
HTS_CHECK_RESULT hts_boolean hts_path_join(hts_buf b, const char *dir,
262
                                           const char *name);
263
264
/** hts_path_join(), then '/' to the platform separator, as fconcat(). */
265
HTS_CHECK_RESULT hts_boolean hts_fpath_join(hts_buf b, const char *dir,
266
                                            const char *name);
267
268
0
#define READ_ERROR (-1)
269
0
#define READ_EOF (-2)
270
#define READ_TIMEOUT (-3)
271
0
#define READ_INTERNAL_ERROR (-4)
272
273
/* concat */
274
275
0
HTS_STATIC HTS_RING char *getHtsOptBuff_(httrackp *opt) {
276
0
  opt->state.concat.index = (opt->state.concat.index + 1) % 16;
277
0
  return opt->state.concat.buff[opt->state.concat.index];
278
0
}
Unexecuted instantiation: htssitemap.c:getHtsOptBuff_
Unexecuted instantiation: htscodec.c:getHtsOptBuff_
Unexecuted instantiation: htstools.c:getHtsOptBuff_
Unexecuted instantiation: htslib.c:getHtsOptBuff_
Unexecuted instantiation: htsbase.c:getHtsOptBuff_
Unexecuted instantiation: htsmime.c:getHtsOptBuff_
Unexecuted instantiation: htsbauth.c:getHtsOptBuff_
Unexecuted instantiation: htspsl.c:getHtsOptBuff_
Unexecuted instantiation: htsbundle.c:getHtsOptBuff_
Unexecuted instantiation: htssecret.c:getHtsOptBuff_
Unexecuted instantiation: htscore.c:getHtsOptBuff_
Unexecuted instantiation: htshash.c:getHtsOptBuff_
Unexecuted instantiation: htsmhtml.c:getHtsOptBuff_
Unexecuted instantiation: htsusercmd.c:getHtsOptBuff_
Unexecuted instantiation: htschanges.c:getHtsOptBuff_
Unexecuted instantiation: htscache.c:getHtsOptBuff_
Unexecuted instantiation: htsback.c:getHtsOptBuff_
Unexecuted instantiation: htsftp.c:getHtsOptBuff_
Unexecuted instantiation: htscrashtest.c:getHtsOptBuff_
Unexecuted instantiation: htsdns.c:getHtsOptBuff_
Unexecuted instantiation: htsname.c:getHtsOptBuff_
Unexecuted instantiation: htsmirror.c:getHtsOptBuff_
Unexecuted instantiation: htsparse.c:getHtsOptBuff_
Unexecuted instantiation: htssinglefile.c:getHtsOptBuff_
Unexecuted instantiation: htswizard.c:getHtsOptBuff_
Unexecuted instantiation: htsfilters.c:getHtsOptBuff_
Unexecuted instantiation: htsrobots.c:getHtsOptBuff_
Unexecuted instantiation: htsindex.c:getHtsOptBuff_
Unexecuted instantiation: htslines.c:getHtsOptBuff_
Unexecuted instantiation: htsfetch.c:getHtsOptBuff_
Unexecuted instantiation: htswarc.c:getHtsOptBuff_
Unexecuted instantiation: htscoremain.c:getHtsOptBuff_
Unexecuted instantiation: htsalias.c:getHtsOptBuff_
Unexecuted instantiation: htshelp.c:getHtsOptBuff_
Unexecuted instantiation: htscatchurl.c:getHtsOptBuff_
Unexecuted instantiation: htscookiefile.c:getHtsOptBuff_
Unexecuted instantiation: htsproxy.c:getHtsOptBuff_
Unexecuted instantiation: htszlib.c:getHtsOptBuff_
Unexecuted instantiation: htsconcat.c:getHtsOptBuff_
Unexecuted instantiation: htsmodules.c:getHtsOptBuff_
Unexecuted instantiation: htsescape.c:getHtsOptBuff_
Unexecuted instantiation: htssniff.c:getHtsOptBuff_
Unexecuted instantiation: htsselftest.c:getHtsOptBuff_
Unexecuted instantiation: htsback_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsselftest_util.c:getHtsOptBuff_
Unexecuted instantiation: htsbase_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htscache_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsckd_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htscharset_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htscmdline_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htscookie_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsdns_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsfetch_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htspsl_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsindex_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsbundle_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsfilters_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsheader_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsio_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htslib_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htswrap.c:getHtsOptBuff_
Unexecuted instantiation: htslines_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsmime_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsname_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsnet_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsopt_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htsparse_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htstools_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htswarc_selftest.c:getHtsOptBuff_
Unexecuted instantiation: htswizard_selftest.c:getHtsOptBuff_
279
280
0
#define OPT_GET_BUFF(OPT)      ( getHtsOptBuff_(OPT) )
281
0
#define OPT_GET_BUFF_SIZE(OPT) (sizeof((OPT)->state.concat.buff[0]))
282
#define OPT_GET_HTS_BUF(OPT)                                                   \
283
0
  hts_buf_at(OPT_GET_BUFF(OPT), OPT_GET_BUFF_SIZE(OPT))
284
285
// cache pour le dns, pour éviter de faire des gethostbyname sans arrêt
286
#ifndef HTS_DEF_FWSTRUCT_t_dnscache
287
#define HTS_DEF_FWSTRUCT_t_dnscache
288
typedef struct t_dnscache t_dnscache;
289
#endif
290
// One DNS cache record, stored as a coucal value keyed by hostname.
291
struct t_dnscache {
292
  // resolved addresses, in resolver (RFC 6724) order; host_count==0 means the
293
  // name does not resolve (negative cache). host_count<=HTS_MAXADDRNUM.
294
  int host_count;
295
  size_t host_length[HTS_MAXADDRNUM]; // sockaddr length of each (16 or 28)
296
  char host_addr[HTS_MAXADDRNUM][HTS_MAXADDRLEN];
297
  // mtime_local() past which a negative record must be resolved again, and
298
  // when it was stored; both 0 on a positive one, which never expires
299
  TStamp expiry;
300
  TStamp stored;
301
  int failures; // consecutive failed resolves, which lengthen the next wait
302
  int preferred; // index of the address a fallback last connected to
303
  int gai_code;  // getaddrinfo()'s code behind a negative record
304
};
305
306
/* Break t down as UTC into the caller's buffer, HTS_FALSE if that failed.
307
   gmtime()'s static is shared, and both the engine and ProxyTrack convert on
308
   worker threads. */
309
static HTS_INLINE HTS_UNUSED hts_boolean hts_gmtime(time_t t,
310
0
                                                    struct tm *tmbuf) {
311
#ifdef _WIN32
312
  /* Microsoft's gmtime_s takes the destination first, unlike C11 Annex K. */
313
  return gmtime_s(tmbuf, &t) == 0 ? HTS_TRUE : HTS_FALSE;
314
#else
315
0
  return gmtime_r(&t, tmbuf) != NULL ? HTS_TRUE : HTS_FALSE;
316
0
#endif
317
0
}
Unexecuted instantiation: htssitemap.c:hts_gmtime
Unexecuted instantiation: htscodec.c:hts_gmtime
Unexecuted instantiation: htstools.c:hts_gmtime
Unexecuted instantiation: htslib.c:hts_gmtime
Unexecuted instantiation: htsbase.c:hts_gmtime
Unexecuted instantiation: htsmime.c:hts_gmtime
Unexecuted instantiation: htsbauth.c:hts_gmtime
Unexecuted instantiation: htspsl.c:hts_gmtime
Unexecuted instantiation: htsbundle.c:hts_gmtime
Unexecuted instantiation: htssecret.c:hts_gmtime
Unexecuted instantiation: htscore.c:hts_gmtime
Unexecuted instantiation: htshash.c:hts_gmtime
Unexecuted instantiation: htsmhtml.c:hts_gmtime
Unexecuted instantiation: htsusercmd.c:hts_gmtime
Unexecuted instantiation: htschanges.c:hts_gmtime
Unexecuted instantiation: htscache.c:hts_gmtime
Unexecuted instantiation: htsback.c:hts_gmtime
Unexecuted instantiation: htsftp.c:hts_gmtime
Unexecuted instantiation: htscrashtest.c:hts_gmtime
Unexecuted instantiation: htsdns.c:hts_gmtime
Unexecuted instantiation: htsname.c:hts_gmtime
Unexecuted instantiation: htsmirror.c:hts_gmtime
Unexecuted instantiation: htsparse.c:hts_gmtime
Unexecuted instantiation: htssinglefile.c:hts_gmtime
Unexecuted instantiation: htswizard.c:hts_gmtime
Unexecuted instantiation: htsfilters.c:hts_gmtime
Unexecuted instantiation: htsrobots.c:hts_gmtime
Unexecuted instantiation: htsindex.c:hts_gmtime
Unexecuted instantiation: htslines.c:hts_gmtime
Unexecuted instantiation: htsfetch.c:hts_gmtime
Unexecuted instantiation: htswarc.c:hts_gmtime
Unexecuted instantiation: htscoremain.c:hts_gmtime
Unexecuted instantiation: htsalias.c:hts_gmtime
Unexecuted instantiation: htshelp.c:hts_gmtime
Unexecuted instantiation: htscatchurl.c:hts_gmtime
Unexecuted instantiation: htscookiefile.c:hts_gmtime
Unexecuted instantiation: htsproxy.c:hts_gmtime
Unexecuted instantiation: htszlib.c:hts_gmtime
Unexecuted instantiation: htsconcat.c:hts_gmtime
Unexecuted instantiation: htsmodules.c:hts_gmtime
Unexecuted instantiation: htsescape.c:hts_gmtime
Unexecuted instantiation: htssniff.c:hts_gmtime
Unexecuted instantiation: htsselftest.c:hts_gmtime
Unexecuted instantiation: htsback_selftest.c:hts_gmtime
Unexecuted instantiation: htsselftest_util.c:hts_gmtime
Unexecuted instantiation: htsbase_selftest.c:hts_gmtime
Unexecuted instantiation: htscache_selftest.c:hts_gmtime
Unexecuted instantiation: htsckd_selftest.c:hts_gmtime
Unexecuted instantiation: htscharset_selftest.c:hts_gmtime
Unexecuted instantiation: htscmdline_selftest.c:hts_gmtime
Unexecuted instantiation: htscookie_selftest.c:hts_gmtime
Unexecuted instantiation: htsdns_selftest.c:hts_gmtime
Unexecuted instantiation: htsfetch_selftest.c:hts_gmtime
Unexecuted instantiation: htspsl_selftest.c:hts_gmtime
Unexecuted instantiation: htsindex_selftest.c:hts_gmtime
Unexecuted instantiation: htsbundle_selftest.c:hts_gmtime
Unexecuted instantiation: htsfilters_selftest.c:hts_gmtime
Unexecuted instantiation: htsheader_selftest.c:hts_gmtime
Unexecuted instantiation: htsio_selftest.c:hts_gmtime
Unexecuted instantiation: htslib_selftest.c:hts_gmtime
Unexecuted instantiation: htswrap.c:hts_gmtime
Unexecuted instantiation: htslines_selftest.c:hts_gmtime
Unexecuted instantiation: htsmime_selftest.c:hts_gmtime
Unexecuted instantiation: htsname_selftest.c:hts_gmtime
Unexecuted instantiation: htsnet_selftest.c:hts_gmtime
Unexecuted instantiation: htsopt_selftest.c:hts_gmtime
Unexecuted instantiation: htsparse_selftest.c:hts_gmtime
Unexecuted instantiation: htstools_selftest.c:hts_gmtime
Unexecuted instantiation: htswarc_selftest.c:hts_gmtime
Unexecuted instantiation: htswizard_selftest.c:hts_gmtime
318
319
/* Break t down as local time into the caller's buffer, HTS_FALSE if that
320
   failed. localtime()'s static is shared, same rationale as hts_gmtime(). */
321
static HTS_INLINE HTS_UNUSED hts_boolean hts_localtime(time_t t,
322
0
                                                       struct tm *tmbuf) {
323
#ifdef _WIN32
324
  return localtime_s(tmbuf, &t) == 0 ? HTS_TRUE : HTS_FALSE;
325
#else
326
0
  return localtime_r(&t, tmbuf) != NULL ? HTS_TRUE : HTS_FALSE;
327
0
#endif
328
0
}
Unexecuted instantiation: htssitemap.c:hts_localtime
Unexecuted instantiation: htscodec.c:hts_localtime
Unexecuted instantiation: htstools.c:hts_localtime
Unexecuted instantiation: htslib.c:hts_localtime
Unexecuted instantiation: htsbase.c:hts_localtime
Unexecuted instantiation: htsmime.c:hts_localtime
Unexecuted instantiation: htsbauth.c:hts_localtime
Unexecuted instantiation: htspsl.c:hts_localtime
Unexecuted instantiation: htsbundle.c:hts_localtime
Unexecuted instantiation: htssecret.c:hts_localtime
Unexecuted instantiation: htscore.c:hts_localtime
Unexecuted instantiation: htshash.c:hts_localtime
Unexecuted instantiation: htsmhtml.c:hts_localtime
Unexecuted instantiation: htsusercmd.c:hts_localtime
Unexecuted instantiation: htschanges.c:hts_localtime
Unexecuted instantiation: htscache.c:hts_localtime
Unexecuted instantiation: htsback.c:hts_localtime
Unexecuted instantiation: htsftp.c:hts_localtime
Unexecuted instantiation: htscrashtest.c:hts_localtime
Unexecuted instantiation: htsdns.c:hts_localtime
Unexecuted instantiation: htsname.c:hts_localtime
Unexecuted instantiation: htsmirror.c:hts_localtime
Unexecuted instantiation: htsparse.c:hts_localtime
Unexecuted instantiation: htssinglefile.c:hts_localtime
Unexecuted instantiation: htswizard.c:hts_localtime
Unexecuted instantiation: htsfilters.c:hts_localtime
Unexecuted instantiation: htsrobots.c:hts_localtime
Unexecuted instantiation: htsindex.c:hts_localtime
Unexecuted instantiation: htslines.c:hts_localtime
Unexecuted instantiation: htsfetch.c:hts_localtime
Unexecuted instantiation: htswarc.c:hts_localtime
Unexecuted instantiation: htscoremain.c:hts_localtime
Unexecuted instantiation: htsalias.c:hts_localtime
Unexecuted instantiation: htshelp.c:hts_localtime
Unexecuted instantiation: htscatchurl.c:hts_localtime
Unexecuted instantiation: htscookiefile.c:hts_localtime
Unexecuted instantiation: htsproxy.c:hts_localtime
Unexecuted instantiation: htszlib.c:hts_localtime
Unexecuted instantiation: htsconcat.c:hts_localtime
Unexecuted instantiation: htsmodules.c:hts_localtime
Unexecuted instantiation: htsescape.c:hts_localtime
Unexecuted instantiation: htssniff.c:hts_localtime
Unexecuted instantiation: htsselftest.c:hts_localtime
Unexecuted instantiation: htsback_selftest.c:hts_localtime
Unexecuted instantiation: htsselftest_util.c:hts_localtime
Unexecuted instantiation: htsbase_selftest.c:hts_localtime
Unexecuted instantiation: htscache_selftest.c:hts_localtime
Unexecuted instantiation: htsckd_selftest.c:hts_localtime
Unexecuted instantiation: htscharset_selftest.c:hts_localtime
Unexecuted instantiation: htscmdline_selftest.c:hts_localtime
Unexecuted instantiation: htscookie_selftest.c:hts_localtime
Unexecuted instantiation: htsdns_selftest.c:hts_localtime
Unexecuted instantiation: htsfetch_selftest.c:hts_localtime
Unexecuted instantiation: htspsl_selftest.c:hts_localtime
Unexecuted instantiation: htsindex_selftest.c:hts_localtime
Unexecuted instantiation: htsbundle_selftest.c:hts_localtime
Unexecuted instantiation: htsfilters_selftest.c:hts_localtime
Unexecuted instantiation: htsheader_selftest.c:hts_localtime
Unexecuted instantiation: htsio_selftest.c:hts_localtime
Unexecuted instantiation: htslib_selftest.c:hts_localtime
Unexecuted instantiation: htswrap.c:hts_localtime
Unexecuted instantiation: htslines_selftest.c:hts_localtime
Unexecuted instantiation: htsmime_selftest.c:hts_localtime
Unexecuted instantiation: htsname_selftest.c:hts_localtime
Unexecuted instantiation: htsnet_selftest.c:hts_localtime
Unexecuted instantiation: htsopt_selftest.c:hts_localtime
Unexecuted instantiation: htsparse_selftest.c:hts_localtime
Unexecuted instantiation: htstools_selftest.c:hts_localtime
Unexecuted instantiation: htswarc_selftest.c:hts_localtime
Unexecuted instantiation: htswizard_selftest.c:hts_localtime
329
330
/* Capacity the hts_strerror() callers pass; a longer message is clipped. */
331
#define HTS_STRERROR_SIZE 128
332
333
/* 0 where the build found no reentrant form and kept plain strerror(). */
334
#if defined(_MSC_VER) || defined(HAVE_STRERROR_R)
335
#define HTS_STRERROR_REENTRANT 1
336
#else
337
#define HTS_STRERROR_REENTRANT 0
338
#endif
339
340
/* Write the message for errno value err into buf, and return buf.p. strerror()
341
   answers with a buffer the caller does not own: glibc reuses a per-thread one
342
   and frees it at thread exit, and POSIX allows one shared static. */
343
const char *hts_strerror(int err, hts_buf buf);
344
345
/* A modification time at the finest resolution this build can read. Compare it
346
   only against another value hts_file_mtime() produced, because the epoch is
347
   the platform's. */
348
typedef struct hts_filetime_t {
349
  int64_t sec;  /* not a time_t: Windows counts from 1601, so never print it */
350
  int32_t nsec; /* 0 where neither the build nor the filesystem is finer */
351
  /* S_ISREG, except on Windows, where every non-directory counts as one. */
352
  hts_boolean is_plain_file;
353
} hts_filetime_t;
354
355
/* Read FILE's modification time into WHEN. False if it can not be read, and
356
   WHEN is then untouched. */
357
HTS_CHECK_RESULT hts_boolean hts_file_mtime(const char *file,
358
                                            hts_filetime_t *when);
359
360
/* Move FILE's modification time SECONDS back, keeping the fraction, which the
361
   utimes fallback rounds down to the microsecond. False if the stamp could not
362
   be read or written, and FILE then keeps the time it had. */
363
HTS_CHECK_RESULT hts_boolean hts_file_backdate(const char *file, int seconds);
364
365
/* Library internal definictions */
366
#ifdef HTS_INTERNAL_BYTECODE
367
368
/* Is path certainly missing? Any doubt answers HTS_FALSE. Utf-8; trailing
369
   separators are ignored. */
370
HTS_CHECK_RESULT hts_boolean hts_path_absent(const char *path);
371
372
/* Record a loaded module in opt->libHandles, copying its name. HTS_FALSE when
373
   out of memory, and opt->libHandles is then unchanged. */
374
HTS_CHECK_RESULT hts_boolean hts_libhandles_add(httrackp *opt, void *handle,
375
                                                const char *moduleName);
376
377
/** An opt that hts_log_vprint drops every message for. Never dereferenced. */
378
extern char hts_log_quiet_tag;
379
0
#define HTS_LOG_QUIET ((httrackp *) (void *) &hts_log_quiet_tag)
380
381
// initialize an htsblk structure
382
void hts_init_htsblk(htsblk * r);
383
384
/* How many seconds should we wait, given a Retry-After value? -1 when it names
385
   no usable delay. `now` dates the HTTP-date form, and the caller caps. */
386
HTS_CHECK_RESULT int hts_parse_retry_after(const char *value, time_t now);
387
388
/* Read the HTTP date S as Unix seconds, with a two-digit year up to PIVOT in
389
   20xx (see convert_time_rfc822_pivot). -1 when S is not a date. */
390
int64_t hts_parse_date(const char *s, int pivot);
391
392
// attach specific project log to hachtable logger
393
void hts_set_hash_handler(coucal hashtable, httrackp *opt);
394
395
/* Add to, read and reset the received-byte total, which FTP workers update
396
   from their thread. A lock guards it, as a 64-bit atomic needs libatomic.
397
   hts_stat_recv_publish() copies it to HTS_STAT on the crawl thread. */
398
void hts_stat_recv_add(LLint bytes);
399
LLint hts_stat_recv_get(void);
400
void hts_stat_recv_set(LLint bytes);
401
LLint hts_stat_recv_publish(void);
402
403
LLint check_downloadable_bytes(int rate);
404
405
/* Client hints a Chromium browser sends by default (Sec-CH-UA*). */
406
typedef struct hts_client_hints {
407
  char ua[128];       /**< Sec-CH-UA brand list */
408
  char platform[16];  /**< Sec-CH-UA-Platform value, quoted */
409
  hts_boolean mobile; /**< Sec-CH-UA-Mobile is ?1 */
410
} hts_client_hints;
411
412
/* Fill ch with the hints the browser named by user_agent sends. Returns
413
   HTS_FALSE when that browser sends none: anything but Chrome or Edge from
414
   M108. */
415
HTS_CHECK_RESULT hts_boolean hts_client_hints_of(const char *user_agent,
416
                                                 hts_client_hints *ch);
417
418
/* Return the browser family whose request headers user_agent names: Chrome
419
   and Edge as hts_client_hints_of() tells them, or Firefox. */
420
hts_browser_family hts_browser_family_of(const char *user_agent);
421
422
/* Return http_header_slot_count() slot numbers: the order in which family
423
   sends the reorderable headers of a request to dest. */
424
const unsigned char *http_header_order(hts_browser_family family, int dest);
425
426
/* Return the header name of slot, or NULL past the last one. */
427
const char *http_header_slot_name(int slot);
428
int http_header_slot_count(void);
429
430
// fonctions principales
431
/* Start a non-blocking connect to adr (or to retour's proxy) for a GET, or open
432
   a file:// target. retour must not be NULL; it gets the socket and any error.
433
 */
434
T_SOC http_xfopen(httrackp *opt, const char *adr, const char *fil,
435
                  htsblk *retour);
436
HTS_CHECK_RESULT int http_sendhead(httrackp *opt, t_cookie *cookie, int mode,
437
                                   const char *xsend, const char *adr,
438
                                   const char *fil, const char *referer_adr,
439
                                   const char *referer_fil,
440
                                   const hts_fetch_meta *fetch, htsblk *retour);
441
/* Build the request "Cookie:" header line for stored cookies matching
442
   adr/path into dst (NUL-terminated), wrapping the logic http_sendhead()
443
   uses. adr may carry its scheme, and only "https://" gets Secure cookies. A
444
   port in adr is ignored (see cookie_host). Returns cookies emitted. */
445
int http_cookie_header(t_cookie *cookie, const char *adr, const char *path,
446
                       hts_buf dst);
447
448
/* True if the raw CRLF-separated header block, a request one we build or a
449
   response one we received, starts a line with `field_name`, given without the
450
   trailing colon (which is tolerated), ignoring case and blanks before the
451
   colon. headers must be NUL-terminated. */
452
hts_boolean http_headers_have_field(const char *headers,
453
                                    const char *field_name);
454
455
/* True when the response stored no body and no status excuses it: a redirect to
456
   follow, or the 412/416 whose stale resume partial the parser re-gets. */
457
HTS_CHECK_RESULT hts_boolean hts_body_missing_unexpectedly(const htsblk *r);
458
459
/* Return the body of R as a span, empty when it has none or a negative size.
460
   Its pointer stays R->adr, so it may be NULL. */
461
hts_span hts_blk_body(const htsblk *r);
462
463
/* Returns the warning to print for a -%X line, or NULL when it goes out as
464
   typed. headers is the block so far. */
465
HTS_CHECK_RESULT const char *http_custom_header_warning(const char *headers,
466
                                                        const char *line);
467
468
/* Why a bundle header line is refused, or NULL when allowed. headers is the
469
   block so far. */
470
HTS_CHECK_RESULT const char *http_bundle_header_refusal(const char *headers,
471
                                                        const char *line);
472
473
/* Append the custom header block to dst, dropping any line whose field dst
474
   carries, a malformed or framing line, an earlier copy of Host, Cookie or
475
   Authorization, and a leading folded line. Field names ignore case and blanks
476
   before the colon. A line that does not fit is left out. */
477
void http_append_custom_headers(hts_buf dst, const char *headers);
478
479
/* Append the raw remainder of a >postfile: body into buffer at write position
480
   pos, and return the new position. Clips to the room left, and always leaves
481
   a NUL at the position returned: the request block is read back with strlen()
482
   by the WARC stash, the sendhead callback and sendc(). A NUL inside the file
483
   ends the request there. */
484
size_t http_postfile_body(hts_buf buffer, size_t pos, FILE *fp);
485
486
/* Switch soc between blocking and non-blocking mode; false on failure, with
487
   errno (WSAGetLastError() on Windows) set. */
488
HTS_CHECK_RESULT hts_boolean socket_set_nonblocking(T_SOC soc,
489
                                                    hts_boolean nonblocking);
490
/* Pending-connect result for a non-blocking socket reported ready by select():
491
   0 = connected, >0 = the connect errno (refused, unreachable, ...), -1 if the
492
   probe itself failed. A failed connect is reported ready as well (writable on
493
   posix, exception set on winsock), so this is how success is told from failure
494
   without blocking. */
495
HTS_CHECK_RESULT int connect_socket_error(T_SOC soc);
496
497
/* Start a non-blocking connect to iadr; port -1 takes it from iadr or the
498
   scheme default. */
499
T_SOC newhttp(httrackp *opt, const char *iadr, htsblk *retour, int port);
500
/* Like newhttp(), but connect to resolved address addr_index (0-based, or -1
501
   for the one hts_dns_set_preferred() last picked) and set *addr_count, if
502
   non-NULL, to the address count. */
503
T_SOC newhttp_addr(httrackp *opt, const char *iadr, htsblk *retour, int port,
504
                   int addr_index, int *addr_count);
505
/* Like newhttp_addr(), but try up to tries addresses from addr_index on (all
506
   of them for -1), skipping one -%b cannot bind for or whose connect fails at
507
   once. On success, *skipped (if non-NULL) gets how many were skipped. */
508
T_SOC newhttp_addrs(httrackp *opt, const char *iadr, htsblk *retour, int port,
509
                    int addr_index, int tries, int *addr_count, int *skipped);
510
/* Clips the formatted failure reason into r->msg, which also round-trips
511
   through the cache as X-StatusMessage. Leaves r->statuscode to the caller. */
512
#define htsblk_failf(R, ...)                                                   \
513
0
  slprintfbuff_clip((R)->msg, sizeof((R)->msg), __VA_ARGS__)
514
515
HTS_INLINE void deletehttp(htsblk * r);
516
HTS_INLINE int deleteaddr(htsblk * r);
517
HTS_INLINE void deletesoc(T_SOC soc);
518
/* Return 1 once soc is readable (writable) within timeout seconds, 0 otherwise.
519
   check_readinput polls r->soc without waiting. */
520
int check_readinput(htsblk * r);
521
int check_readinput_t(T_SOC soc, int timeout);
522
int check_writeinput_t(T_SOC soc, int timeout);
523
524
/* TRUE if S holds no byte below ' '. A control byte in a value the
525
   client puts on a protocol line (an FTP command, a CONNECT authority, a
526
   SOCKS5 host) smuggles a line or a field of its own. */
527
HTS_CHECK_RESULT hts_boolean hts_span_is_control_free(hts_span s);
528
529
/* Same over a NUL-terminated string. */
530
HTS_CHECK_RESULT hts_boolean hts_is_control_free(const char *str);
531
532
/* TRUE if HOST is an IPv4 literal: digits and dots, at least one dot. Such a
533
   host has no domain structure to reverse or to widen into. */
534
HTS_CHECK_RESULT hts_boolean hts_host_is_ipv4(hts_span host);
535
536
/* Base-64 "user:pass" of the userinfo in a URL or proxy name, for a Basic
537
   Authorization header, into OUT (at least 1100 bytes). Returns 1 when filled,
538
   0 when there is no userinfo, -1 when it is too long (765 bytes max, as a
539
   clipped credential would authenticate as somebody else). */
540
HTS_CHECK_RESULT int hts_basic_auth_value(httrackp *opt, const char *url,
541
                                          hts_buf out);
542
543
/* Copy the bare host name of a URL address into out for the TLS SNI
544
   extension: no scheme, userinfo or port. FALSE with out emptied when there is
545
   no DNS name to send (IP literal, empty, or too long), as RFC 6066 forbids
546
   literals. */
547
HTS_CHECK_RESULT hts_boolean hts_sni_hostname(const char *url_adr, hts_buf out);
548
549
#if HTS_USEOPENSSL
550
/* Make ssl's handshake fail unless the server's chain verifies against the
551
   system CA store and its certificate names url_adr's host (--check-cert).
552
   FALSE when the checks could not be armed: the caller must not connect. */
553
HTS_CHECK_RESULT hts_boolean hts_ssl_check_cert(SSL *ssl, const char *url_adr);
554
#endif
555
556
/* TRUE if HOST is an IPv4 or IPv6 address literal. */
557
hts_boolean hts_host_is_address(hts_span host);
558
559
/* TRUE if this -P proxy name (which keeps its scheme) is a SOCKS5 proxy. */
560
HTS_CHECK_RESULT hts_boolean hts_proxy_is_socks(const char *name);
561
562
/* TRUE if this -P proxy name is a "connect://" CONNECT-only proxy (#564). */
563
HTS_CHECK_RESULT hts_boolean hts_proxy_is_connect(const char *name);
564
565
void treathead(t_cookie * cookie, const char *adr, const char *fil, htsblk * retour,
566
               char *rcvd);
567
/* Run treathead, logging any refused cookie through opt, which may be NULL. */
568
void treathead_opt(httrackp *opt, t_cookie *cookie, const char *adr,
569
                   const char *fil, htsblk *retour, char *rcvd);
570
void treatfirstline(htsblk * retour, const char *rcvd);
571
572
/* Does Content-Length value s, a list such as "42, 42", agree with itself and
573
   with *seen, the length an earlier field gave (-1 if none)? Stores the length
574
   in *seen, or -2 for a signed or oversized one. Text that is no number is
575
   skipped. */
576
HTS_CHECK_RESULT hts_boolean hts_content_length_agrees(const char *s,
577
                                                       LLint *seen);
578
579
/* The status code of an "HTTP/x.y NNN reason" line, or -1. */
580
HTS_CHECK_RESULT int hts_status_line_code(const char *line);
581
582
// sous-fonctions
583
/* Buffer http_xfread1() fills in its line modes, and so the ceiling on any
584
   blank-line-terminated block it reads: a header section or a chunk trailer
585
   section. Overrunning it fails the transfer. */
586
0
#define HTS_LINE_BLOCK_SIZE 8192
587
/* http_xfread1() read modes: a positive bufl reads at most that many raw bytes,
588
   anything else reads CR-stripped lines into the HTS_LINE_BLOCK_SIZE buffer. */
589
0
#define HTS_XFREAD_LINE_BLOCK 0 /* lines up to a blank one (header/trailer) */
590
0
#define HTS_XFREAD_LINE (-1)    /* one line, stopping at the first LF */
591
LLint http_xfread1(htsblk * r, int bufl);
592
/* Self-test hook: read the line modes bytewise, as on an MPTCP socket where
593
   peeking is unsafe. */
594
void hts_peek_force_off(hts_boolean off);
595
/* Self-test hook: how many line-mode calls took the bytewise path? */
596
int hts_xfread_bytewise_count(void);
597
/* Does an in-memory body of this size fit? r->adr is indexed with an int
598
   downstream and its allocations add a trailing NUL, so every producer of
599
   r->size must refuse where http_xfread1() does. */
600
HTS_CHECK_RESULT hts_boolean hts_inmem_size_fits(LLint size);
601
602
/* How did a resolve end? */
603
typedef enum hts_dns_status {
604
  HTS_DNS_OK = 0,
605
  HTS_DNS_NONAME,   /* the resolver says the name does not exist */
606
  HTS_DNS_TEMPFAIL, /* the resolver could not answer, so ask again later */
607
  HTS_DNS_TIMEOUT,  /* the wait ran out before the resolver answered */
608
  HTS_DNS_CANCELLED /* the cancel flag was raised before it answered */
609
} hts_dns_status;
610
611
/* The caller owns this answer to a resolve. */
612
typedef struct hts_dns_result {
613
  int count; /* addr[0..count-1], in resolver order; 0 unless status is OK */
614
  SOCaddr addr[HTS_MAXADDRNUM];
615
  hts_dns_status status;
616
  int gai_code;       /* getaddrinfo()'s code behind a failure, else 0 */
617
  hts_boolean cached; /* answered by the DNS cache, negatively or not */
618
} hts_dns_result;
619
620
/* Static English text for res's outcome ("no error" when it resolved), safe
621
   to keep and share. */
622
const char *hts_dns_strerror(const hts_dns_result *res);
623
/* Log prefixes for hts_dns_strerror(): with the longest text, both fit in
624
   htsblk.msg. */
625
0
#define HTS_DNS_FAIL_PREFIX "Unable to get server's address: "
626
0
#define HTS_DNS_BIND_PREFIX "Unable to bind the local address: "
627
628
/* Cached resolver: fill res with iadr's addresses and return res->status.
629
   Resolves once per host; later calls read the DNS cache. Must hold no lock
630
   (brackets opt->state.lock itself, never across the resolve). A miss resolves
631
   on a worker thread bounded by timeout seconds (<= 0: unbounded) and cut short
632
   as soon as *cancel, if given, is raised; neither outcome is cached. */
633
hts_dns_status hts_dns_resolve(httrackp *opt, const char *iadr, int timeout,
634
                               const volatile hts_boolean *cancel,
635
                               hts_dns_result *res);
636
/* hts_dns_resolve() bounded by opt->timeout and cut by a mirror stop, copying
637
   up to max addresses into out. Returns the address count, 0 on failure. */
638
int hts_dns_resolve_all(httrackp *opt, const char *iadr, SOCaddr *out, int max);
639
/* A resolve running on a worker thread, so the crawl need not wait for it. */
640
typedef struct dns_resolve_job hts_dns_job;
641
/* hts_dns_poll() result while the worker has not answered: a count, not an
642
   hts_dns_status. */
643
0
#define HTS_DNS_PENDING (-2)
644
/* Does the DNS cache answer for iadr now, positively or not? */
645
hts_boolean hts_dns_cached(httrackp *opt, const char *iadr);
646
/* Start resolving iadr's host, returning one reference to the job, or NULL
647
   when no worker could start. Must hold no lock. */
648
hts_dns_job *hts_dns_start(httrackp *opt, const char *iadr);
649
/* Is job resolving iadr's host? */
650
hts_boolean hts_dns_job_is(const hts_dns_job *job, const char *iadr);
651
/* Take one more reference to job. */
652
hts_dns_job *hts_dns_job_ref(hts_dns_job *job);
653
/* Drop one reference; the worker holds its own. */
654
void hts_dns_job_release(hts_dns_job *job);
655
/* HTS_DNS_PENDING while job runs. Then the address count, stored in the DNS
656
   cache, and the answer in *res if given; -1 if the worker ended without an
657
   answer. Must hold no lock. */
658
int hts_dns_poll(httrackp *opt, hts_dns_job *job, hts_dns_result *res);
659
/* Returns the index of addr in list[0..count-1], port included, or -1. */
660
HTS_CHECK_RESULT int hts_dns_addr_index(const SOCaddr *list, int count,
661
                                        const SOCaddr *addr);
662
/* Index in iadr's cached list of the address to try first, 0 by default. */
663
int hts_dns_preferred(httrackp *opt, const char *iadr);
664
/* Make addr, if it is in iadr's cached list, the one new connects try first.
665
   The caller must not hold opt->state.lock. */
666
void hts_dns_set_preferred(httrackp *opt, const char *iadr,
667
                           const SOCaddr *addr);
668
/* Uncached and unbounded: first address of hostname into *addr, or NULL. */
669
SOCaddr *hts_dns_resolve_nocache(const char *const hostname,
670
                                 SOCaddr *const addr);
671
672
/* How long a name that did not resolve stays negative-cached, and the ceiling
673
   the wait doubles up to. */
674
0
#define HTS_DNS_NEGATIVE_TTL_MS 60000
675
0
#define HTS_DNS_NEGATIVE_TTL_MAX_MS 900000
676
/* Wait before asking again, after this many consecutive failures (>= 1). */
677
int hts_dns_negative_wait_ms(int failures);
678
/* Test-only: shorten the first wait so a self-test need not wait a minute. */
679
void hts_dns_set_negative_ttl_ms(int ms);
680
/* Consecutive failed resolves recorded for host, 0 if it is not cached or
681
   resolves. Test-only: nothing in the engine reads it back. */
682
int hts_dns_negative_failures(httrackp *opt, const char *host);
683
/* Test-only: move one cached negative record's stamps by ms, so a self-test
684
   outlasts a wait (positive) or steps behind them (negative), no sleeps. */
685
void hts_dns_test_move_clock(httrackp *opt, const char *host, TStamp ms);
686
687
// outils divers
688
HTS_INLINE TStamp time_local(void);
689
690
/* Writes duration t in seconds as long text, clipped to the buffer size. */
691
void sec2str(hts_buf s, TStamp t);
692
693
/* The current time as an RFC 822 date, GMT or local, clipped to the buffer
694
   size. */
695
void time_gmt_rfc822(hts_buf s);
696
void time_local_rfc822(hts_buf s);
697
698
/* Current UTC time as "YYYY-MM-DDThh:mm:ssZ". */
699
void hts_now_iso8601(char out[32]);
700
701
/* Set file mtime from an RFC 822 date; -1 if the date or the write fails. */
702
HTS_CHECK_RESULT int set_filetime_rfc822(const char *file, const char *date);
703
/* set_filetime_rfc822(), logging a failure at debug level. */
704
void hts_stamp_filetime(httrackp *opt, const char *file, const char *date);
705
/* File mtime as a UTC time_t, or (time_t) -1 if it can not be read. */
706
time_t get_filetime(const char *file);
707
/* Writes file mtime as an RFC 822 GMT date into DATE, or returns 0. */
708
HTS_CHECK_RESULT int get_filetime_rfc822(const char *file, hts_buf date);
709
/* Writes A as an RFC 822 GMT date, clipped to size bytes. */
710
HTS_INLINE void time_rfc822(hts_buf s, struct tm *A);
711
712
HTS_INLINE HTS_CHECK_RESULT int sendc(htsblk *r, const char *s);
713
/* Returns the advance past the line's terminator. */
714
int binput(const char *buff, hts_buf s);
715
/* Read one line from a buffer up to "end", consuming it whole even when it
716
   does not fit S. HTS_TRUE means it was cut: the value is not what was
717
   written, so drop it rather than parse a prefix of it. The advance is reported
718
   through *offset. */
719
HTS_CHECK_RESULT hts_boolean binput_line(const char *buff, const char *end,
720
                                         hts_buf s, int *offset);
721
/* Does treathead() read the header that "line" starts with? Keep in step. */
722
HTS_CHECK_RESULT hts_boolean hts_header_is_read(const char *line);
723
HTS_CHECK_RESULT const char *strstrcase(const char *s, const char *o);
724
HTS_CHECK_RESULT int ident_url_absolute(const char *url, lien_adrfil *adrfil);
725
/* Collapse "./" and "../" segments of @p f in place. An empty path becomes
726
   "./", so @p f needs at least 3 bytes. */
727
void fil_simplifie(char *f);
728
/* Count each byte value of S into map[256]. */
729
void map_characters(hts_span s, unsigned int *map);
730
/* Do control bytes other than space, ESC and NUL exceed 1% of SIZE (and 10)? */
731
hts_boolean map_looks_binary(const unsigned int *map, size_t size);
732
HTS_CHECK_RESULT int ishtml(httrackp *opt, const char *urlfil);
733
/* Return 1 if EXT is an HTML extension such as "htm", else -1. */
734
int ishtml_ext(hts_span ext);
735
736
/* Write fil's --assume type into s; too long a value is clipped, not fatal.
737
   True if a rule matched, s then holding its value, which "--assume cgi="
738
   leaves empty. */
739
HTS_CHECK_RESULT hts_boolean get_userhttptype(httrackp *opt, hts_buf s,
740
                                              const char *fil);
741
int give_mimext(hts_buf s, const char *st);
742
743
int may_unknown2(httrackp * opt, const char *mime, const char *filename);
744
745
const char *strrchr_limit(const char *s, char c, const char *limit);
746
/* Returns the end of the authority at s, which must be past the scheme: its
747
   first '/', '?', '#' or '\'. */
748
const char *hts_authority_end(const char *s);
749
750
/* Spans into one adr or URL string. An absent part has a NULL p, a present
751
   but empty one ("h:" has an empty port) a non-NULL p and a zero len. */
752
typedef struct hts_url_view {
753
  hts_span scheme;   /* without ':'; absent when the input has no scheme */
754
  hts_span userinfo; /* before the authority's last '@' */
755
  hts_span host;     /* always present, brackets kept for IPv6 */
756
  hts_span port;     /* without ':' */
757
  hts_span path;     /* always present, from the authority's end */
758
  hts_span query;    /* without '?' */
759
  hts_span fragment; /* without '#' */
760
} hts_url_view;
761
762
/* Split URL, NULs included, into *V without copying. Input with
763
   no scheme starts at its authority, as an adr does. The scheme is an engine
764
   one ("//" optional) or any other before "://". The authority ends at '/',
765
   '?', '#' or '\'. Syntax only: return FALSE, *V still filled, on
766
   - an unclosed '[', or bytes after ']' that are not ":port" (no port then);
767
   - a port with a non-digit or above 65535. */
768
hts_boolean hts_url_view_parse(hts_span url, hts_url_view *v);
769
770
char *jump_protocol(char *source);
771
const char *jump_protocol_const(const char *source);
772
773
/* Split a -P proxy argument "[scheme://][user:pass@]host[:port]" into the proxy
774
   host string (scheme and any user:pass kept, for later stripping and auth),
775
   written NUL-terminated into NAME (truncated to fit), and the port in *port.
776
   The port defaults by scheme: 1080 for socks5/socks5h, else 8080. */
777
void hts_parse_proxy(const char *arg, hts_buf name, int *port);
778
/* RFC 2045 caps a base64 line at 76 characters, which encode 57 input bytes. */
779
0
#define HTS_BASE64_LINE_BYTES 57
780
/* Base-64 IN into OUT, with a CRLF every 76 output bytes when CRLF is set. */
781
void code64(hts_span in, hts_buf out, hts_boolean crlf);
782
783
char *convtolower(hts_buf catbuff, const char *a);
784
int multipleStringMatch(const char *s, const char *match);
785
786
/* Writes a header block to fp, each line after prefix, with the value of a
787
   field that carries a login replaced by the fprint_redacted() marker, and
788
   each secret opt knows as ***. opt may be NULL. */
789
void fprintfio(FILE *fp, const char *buff, const char *prefix, httrackp *opt);
790
/* line up to its CR or LF as fprintfio() shows it, written into dst, clipped:
791
   for one write, which keeps the line whole on a merged stdout and stderr.
792
   Returns dst.p. */
793
const char *hts_header_shown(httrackp *opt, const char *line, hts_buf dst);
794
795
/* The backstop behind the per-site masking: opt keeps the first
796
   HTS_SECRET_MAX passwords and tokens it sees, each up to HTS_SECRET_MAXLEN
797
   bytes, and the log writers print each as ***. A URL password is hidden only
798
   as a login, before an '@', so a password such as "index" leaves index.html
799
   alone. A header token of HTS_SECRET_TOKEN bytes or more is hidden anywhere.
800
 */
801
0
#define HTS_SECRET_MAX 64
802
0
#define HTS_SECRET_MAXLEN 1024
803
0
#define HTS_SECRET_TOKEN 8
804
805
typedef enum hts_secret_kind {
806
  HTS_SECRET_LOGIN, /* a URL password */
807
  HTS_SECRET_HEADER /* a header token, kept only from HTS_SECRET_TOKEN bytes */
808
} hts_secret_kind;
809
810
/* Allocates and frees the set of opt->secrets. */
811
void hts_secret_init(httrackp *opt);
812
void hts_secret_free(httrackp *opt);
813
814
/* Adds s to the set of opt. Thread-safe. Once the set is full, or for a
815
   secret over HTS_SECRET_MAXLEN bytes, logs one warning and adds nothing. */
816
void hts_secret_add(httrackp *opt, hts_span s, hts_secret_kind kind);
817
818
/* Adds the password of the login of url, in any scheme or none, raw and
819
   unescaped. A user alone is not added. url may be NULL. */
820
void hts_secret_add_login(httrackp *opt, const char *url);
821
822
/* Adds the values of the Authorization, Proxy-Authorization and Cookie lines
823
   of a -%X header block, which may be NULL. */
824
void hts_secret_add_headers(httrackp *opt, const char *headers);
825
826
/* fprintf() to fp, with each secret of opt as ***. */
827
void hts_secret_fprintf(httrackp *opt, FILE *fp,
828
                        HTS_FORMAT_STRING const char *format, ...)
829
    HTS_PRINTF_FUN(3, 4);
830
831
/* vfprintf() to fp, with each secret of opt as ***. */
832
void secret_vfprintf(httrackp *opt, FILE *fp,
833
                     HTS_FORMAT_STRING const char *format, va_list args)
834
    HTS_PRINTF_FUN(3, 0);
835
836
/* Skip adr's blanks and scheme, then its login. */
837
const char *login_start(const char *adr);
838
const char *login_end(const char *adr);
839
/* Copies url, a URL a user typed, to dst with each '?', '#'
840
   and '\' before the last '@' preceding the first '/' written as %XX, so its
841
   login reads as it always has. Returns HTS_FALSE when dst was too small. */
842
hts_boolean hts_escape_typed_login(const char *url, hts_buf dst);
843
844
/* Is the name opening LINE one of the NULL-terminated NAMES, in any case? */
845
hts_boolean header_name_in(const char *line, const char *const *names);
846
847
/* What hts_mask_passwords() reads: */
848
typedef enum {
849
  HTS_MASK_LIST, /* blank-separated start URLs and filters */
850
  HTS_MASK_ADDR  /* one start URL, or a -P value */
851
} hts_mask_mode;
852
853
/* Returns a copy of s, allocated with malloct, in which the password, or the
854
   user alone, of every start URL or proxy address in s is *** . The rest stays
855
   byte for byte. NULL when out of memory. */
856
HTS_OWNED char *hts_mask_passwords(const char *s, hts_mask_mode mode);
857
858
/* Log calls never print an address raw: pass adr_nologin() or url_nologin(),
859
   which test 660 checks. */
860
861
/* Returns adr with its login masked as user:*** or ***, for log lines: adr
862
   itself when it has no login, else a copy clipped to BUF. */
863
const char *adr_nologin_r(hts_buf buf, const char *adr);
864
865
/* Same as adr_nologin_r(), but only a URL with a scheme or "//" has a login.
866
   Any "scheme://" counts, not only the ones the engine fetches. */
867
const char *url_nologin_r(hts_buf buf, const char *url);
868
869
/* adr_nologin_r() and url_nologin_r() into a rotating buffer of opt, which
870
   they take only when there is a login. A NULL opt drops the login, and a
871
   NULL adr returns "". */
872
HTS_RING const char *adr_nologin(httrackp *opt, const char *adr);
873
HTS_RING const char *url_nologin(httrackp *opt, const char *url);
874
875
/* Writes the marker that stands for a hidden secret of len bytes. */
876
void fprint_redacted(FILE *fp, size_t len);
877
878
/* A write to a socket whose peer is gone raises SIGPIPE, and the default
879
   action kills the process. The library must not install a handler, because
880
   the process belongs to whoever embedded us. Three steps leave the host's
881
   signals alone, and each covers what the others cannot:
882
     - HTS_MSG_NOSIGNAL on every send() we issue. Absent on macOS, and
883
       defined but ignored on GNU/Hurd, where the signal still arrives.
884
     - SO_NOSIGPIPE on every socket we write to. Absent on Linux, and the only
885
       one that reaches OpenSSL, which writes with write(2).
886
     - the mask below, around every write the other two may not cover. */
887
#ifdef MSG_NOSIGNAL
888
0
#define HTS_MSG_NOSIGNAL MSG_NOSIGNAL
889
#else
890
#define HTS_MSG_NOSIGNAL 0
891
#endif
892
893
void socket_set_nosigpipe(T_SOC soc);
894
895
/* Multipath TCP (RFC 8684). On Linux it is a protocol on an ordinary stream
896
   socket; on macOS it is an AF_MULTIPATH socket connected with connectx().
897
   configure decides this, and a build without it, such as MSVC, has none. */
898
#if !defined(HTS_INET_MPTCP) || defined(_WIN32)
899
#undef HTS_INET_MPTCP
900
#define HTS_INET_MPTCP 0
901
#endif
902
903
/* Create a stream socket for an outgoing connection, with SIGPIPE disarmed.
904
   Uses Multipath TCP when `opt` asks for it and the system has it, and plain
905
   TCP otherwise. Pass `will_bind` when the caller pins a source address, which
906
   rules Multipath TCP out. Returns INVALID_SOCKET on failure. */
907
T_SOC hts_socket_client(int family, const httrackp *opt, hts_boolean will_bind);
908
909
/* Can this build, on this system, open a Multipath TCP socket at all? */
910
hts_boolean hts_mptcp_available(void);
911
912
/* Can this build tell a negotiated connection from a fallen-back one? */
913
hts_boolean hts_mptcp_reports(void);
914
915
/* Connect a socket hts_socket_client() returned. macOS reaches Multipath TCP
916
   through connectx() rather than a protocol, so the connect differs there too.
917
   Returns 0, or -1 with errno set, exactly as connect() does. */
918
int hts_socket_connect(T_SOC soc, const struct sockaddr *addr, SOClen len,
919
                       const httrackp *opt);
920
921
/* Start a non-blocking connect to *server. Returns HTS_TRUE when it succeeded
922
   or is in progress, and sets *pending (if non-NULL) when it is in progress. */
923
hts_boolean hts_socket_connect_started(T_SOC soc, const SOCaddr *server,
924
                                       const httrackp *opt,
925
                                       hts_boolean *pending);
926
927
/* Did Multipath TCP survive this established connection's handshake? */
928
HTS_CHECK_RESULT hts_boolean hts_socket_is_mptcp(T_SOC soc);
929
930
/* Count an established connection as MPTCP or as fallen back to TCP. Counts
931
   nothing when this run did not ask for MPTCP, and covers the HTTP backend
932
   only, because an FTP socket is established on its own worker thread. */
933
void hts_mptcp_account(httrackp *opt, T_SOC soc);
934
935
/* Windows raises no SIGPIPE. Elsewhere this arm is Darwin, which has no
936
   sigtimedwait and does have SO_NOSIGPIPE, so the socket already covers it. */
937
#if defined(_WIN32) || !defined(HAVE_SIGTIMEDWAIT)
938
typedef struct {
939
  int unused;
940
} sigpipe_mask;
941
942
static HTS_INLINE HTS_UNUSED void sigpipe_hold(sigpipe_mask *m) { (void) m; }
943
944
static HTS_INLINE HTS_UNUSED void sigpipe_release(sigpipe_mask *m) { (void) m; }
945
#else
946
#if defined(THREADS)
947
0
#define HTS_SIGMASK(how, set, old) pthread_sigmask(how, set, old)
948
#else
949
#define HTS_SIGMASK(how, set, old) sigprocmask(how, set, old)
950
#endif
951
952
/* Thread mask only, so the host's handler and disposition are untouched. */
953
typedef struct {
954
  sigset_t mask;   /* what to put back */
955
  int held;        /* the mask above is ours to restore */
956
  int was_pending; /* the host had one queued already, so leave it alone */
957
} sigpipe_mask;
958
959
0
static HTS_INLINE HTS_UNUSED void sigpipe_hold(sigpipe_mask *m) {
960
0
  sigset_t block, pending;
961
962
0
  m->held = 0;
963
0
  m->was_pending =
964
0
      sigpending(&pending) == 0 && sigismember(&pending, SIGPIPE) == 1;
965
0
  if (sigemptyset(&block) == 0 && sigaddset(&block, SIGPIPE) == 0 &&
966
0
      HTS_SIGMASK(SIG_BLOCK, &block, &m->mask) == 0)
967
0
    m->held = 1;
968
0
}
Unexecuted instantiation: htssitemap.c:sigpipe_hold
Unexecuted instantiation: htscodec.c:sigpipe_hold
Unexecuted instantiation: htstools.c:sigpipe_hold
Unexecuted instantiation: htslib.c:sigpipe_hold
Unexecuted instantiation: htsbase.c:sigpipe_hold
Unexecuted instantiation: htsmime.c:sigpipe_hold
Unexecuted instantiation: htsbauth.c:sigpipe_hold
Unexecuted instantiation: htspsl.c:sigpipe_hold
Unexecuted instantiation: htsbundle.c:sigpipe_hold
Unexecuted instantiation: htssecret.c:sigpipe_hold
Unexecuted instantiation: htscore.c:sigpipe_hold
Unexecuted instantiation: htshash.c:sigpipe_hold
Unexecuted instantiation: htsmhtml.c:sigpipe_hold
Unexecuted instantiation: htsusercmd.c:sigpipe_hold
Unexecuted instantiation: htschanges.c:sigpipe_hold
Unexecuted instantiation: htscache.c:sigpipe_hold
Unexecuted instantiation: htsback.c:sigpipe_hold
Unexecuted instantiation: htsftp.c:sigpipe_hold
Unexecuted instantiation: htscrashtest.c:sigpipe_hold
Unexecuted instantiation: htsdns.c:sigpipe_hold
Unexecuted instantiation: htsname.c:sigpipe_hold
Unexecuted instantiation: htsmirror.c:sigpipe_hold
Unexecuted instantiation: htsparse.c:sigpipe_hold
Unexecuted instantiation: htssinglefile.c:sigpipe_hold
Unexecuted instantiation: htswizard.c:sigpipe_hold
Unexecuted instantiation: htsfilters.c:sigpipe_hold
Unexecuted instantiation: htsrobots.c:sigpipe_hold
Unexecuted instantiation: htsindex.c:sigpipe_hold
Unexecuted instantiation: htslines.c:sigpipe_hold
Unexecuted instantiation: htsfetch.c:sigpipe_hold
Unexecuted instantiation: htswarc.c:sigpipe_hold
Unexecuted instantiation: htscoremain.c:sigpipe_hold
Unexecuted instantiation: htsalias.c:sigpipe_hold
Unexecuted instantiation: htshelp.c:sigpipe_hold
Unexecuted instantiation: htscatchurl.c:sigpipe_hold
Unexecuted instantiation: htscookiefile.c:sigpipe_hold
Unexecuted instantiation: htsproxy.c:sigpipe_hold
Unexecuted instantiation: htszlib.c:sigpipe_hold
Unexecuted instantiation: htsconcat.c:sigpipe_hold
Unexecuted instantiation: htsmodules.c:sigpipe_hold
Unexecuted instantiation: htsescape.c:sigpipe_hold
Unexecuted instantiation: htssniff.c:sigpipe_hold
Unexecuted instantiation: htsselftest.c:sigpipe_hold
Unexecuted instantiation: htsback_selftest.c:sigpipe_hold
Unexecuted instantiation: htsselftest_util.c:sigpipe_hold
Unexecuted instantiation: htsbase_selftest.c:sigpipe_hold
Unexecuted instantiation: htscache_selftest.c:sigpipe_hold
Unexecuted instantiation: htsckd_selftest.c:sigpipe_hold
Unexecuted instantiation: htscharset_selftest.c:sigpipe_hold
Unexecuted instantiation: htscmdline_selftest.c:sigpipe_hold
Unexecuted instantiation: htscookie_selftest.c:sigpipe_hold
Unexecuted instantiation: htsdns_selftest.c:sigpipe_hold
Unexecuted instantiation: htsfetch_selftest.c:sigpipe_hold
Unexecuted instantiation: htspsl_selftest.c:sigpipe_hold
Unexecuted instantiation: htsindex_selftest.c:sigpipe_hold
Unexecuted instantiation: htsbundle_selftest.c:sigpipe_hold
Unexecuted instantiation: htsfilters_selftest.c:sigpipe_hold
Unexecuted instantiation: htsheader_selftest.c:sigpipe_hold
Unexecuted instantiation: htsio_selftest.c:sigpipe_hold
Unexecuted instantiation: htslib_selftest.c:sigpipe_hold
Unexecuted instantiation: htswrap.c:sigpipe_hold
Unexecuted instantiation: htslines_selftest.c:sigpipe_hold
Unexecuted instantiation: htsmime_selftest.c:sigpipe_hold
Unexecuted instantiation: htsname_selftest.c:sigpipe_hold
Unexecuted instantiation: htsnet_selftest.c:sigpipe_hold
Unexecuted instantiation: htsopt_selftest.c:sigpipe_hold
Unexecuted instantiation: htsparse_selftest.c:sigpipe_hold
Unexecuted instantiation: htstools_selftest.c:sigpipe_hold
Unexecuted instantiation: htswarc_selftest.c:sigpipe_hold
Unexecuted instantiation: htswizard_selftest.c:sigpipe_hold
969
970
0
static HTS_INLINE HTS_UNUSED void sigpipe_release(sigpipe_mask *m) {
971
0
  sigset_t ours;
972
0
  struct timespec now = {0, 0};
973
974
0
  if (!m->held)
975
0
    return;
976
  /* Take back the one our own write queued, or nothing. sigtimedwait() with a
977
     zero timeout cannot block, where sigwait() hangs for good if another
978
     thread takes a process-directed SIGPIPE first. */
979
0
  if (!m->was_pending && sigemptyset(&ours) == 0 &&
980
0
      sigaddset(&ours, SIGPIPE) == 0)
981
0
    (void) sigtimedwait(&ours, NULL, &now);
982
0
  (void) HTS_SIGMASK(SIG_SETMASK, &m->mask, NULL);
983
0
}
Unexecuted instantiation: htssitemap.c:sigpipe_release
Unexecuted instantiation: htscodec.c:sigpipe_release
Unexecuted instantiation: htstools.c:sigpipe_release
Unexecuted instantiation: htslib.c:sigpipe_release
Unexecuted instantiation: htsbase.c:sigpipe_release
Unexecuted instantiation: htsmime.c:sigpipe_release
Unexecuted instantiation: htsbauth.c:sigpipe_release
Unexecuted instantiation: htspsl.c:sigpipe_release
Unexecuted instantiation: htsbundle.c:sigpipe_release
Unexecuted instantiation: htssecret.c:sigpipe_release
Unexecuted instantiation: htscore.c:sigpipe_release
Unexecuted instantiation: htshash.c:sigpipe_release
Unexecuted instantiation: htsmhtml.c:sigpipe_release
Unexecuted instantiation: htsusercmd.c:sigpipe_release
Unexecuted instantiation: htschanges.c:sigpipe_release
Unexecuted instantiation: htscache.c:sigpipe_release
Unexecuted instantiation: htsback.c:sigpipe_release
Unexecuted instantiation: htsftp.c:sigpipe_release
Unexecuted instantiation: htscrashtest.c:sigpipe_release
Unexecuted instantiation: htsdns.c:sigpipe_release
Unexecuted instantiation: htsname.c:sigpipe_release
Unexecuted instantiation: htsmirror.c:sigpipe_release
Unexecuted instantiation: htsparse.c:sigpipe_release
Unexecuted instantiation: htssinglefile.c:sigpipe_release
Unexecuted instantiation: htswizard.c:sigpipe_release
Unexecuted instantiation: htsfilters.c:sigpipe_release
Unexecuted instantiation: htsrobots.c:sigpipe_release
Unexecuted instantiation: htsindex.c:sigpipe_release
Unexecuted instantiation: htslines.c:sigpipe_release
Unexecuted instantiation: htsfetch.c:sigpipe_release
Unexecuted instantiation: htswarc.c:sigpipe_release
Unexecuted instantiation: htscoremain.c:sigpipe_release
Unexecuted instantiation: htsalias.c:sigpipe_release
Unexecuted instantiation: htshelp.c:sigpipe_release
Unexecuted instantiation: htscatchurl.c:sigpipe_release
Unexecuted instantiation: htscookiefile.c:sigpipe_release
Unexecuted instantiation: htsproxy.c:sigpipe_release
Unexecuted instantiation: htszlib.c:sigpipe_release
Unexecuted instantiation: htsconcat.c:sigpipe_release
Unexecuted instantiation: htsmodules.c:sigpipe_release
Unexecuted instantiation: htsescape.c:sigpipe_release
Unexecuted instantiation: htssniff.c:sigpipe_release
Unexecuted instantiation: htsselftest.c:sigpipe_release
Unexecuted instantiation: htsback_selftest.c:sigpipe_release
Unexecuted instantiation: htsselftest_util.c:sigpipe_release
Unexecuted instantiation: htsbase_selftest.c:sigpipe_release
Unexecuted instantiation: htscache_selftest.c:sigpipe_release
Unexecuted instantiation: htsckd_selftest.c:sigpipe_release
Unexecuted instantiation: htscharset_selftest.c:sigpipe_release
Unexecuted instantiation: htscmdline_selftest.c:sigpipe_release
Unexecuted instantiation: htscookie_selftest.c:sigpipe_release
Unexecuted instantiation: htsdns_selftest.c:sigpipe_release
Unexecuted instantiation: htsfetch_selftest.c:sigpipe_release
Unexecuted instantiation: htspsl_selftest.c:sigpipe_release
Unexecuted instantiation: htsindex_selftest.c:sigpipe_release
Unexecuted instantiation: htsbundle_selftest.c:sigpipe_release
Unexecuted instantiation: htsfilters_selftest.c:sigpipe_release
Unexecuted instantiation: htsheader_selftest.c:sigpipe_release
Unexecuted instantiation: htsio_selftest.c:sigpipe_release
Unexecuted instantiation: htslib_selftest.c:sigpipe_release
Unexecuted instantiation: htswrap.c:sigpipe_release
Unexecuted instantiation: htslines_selftest.c:sigpipe_release
Unexecuted instantiation: htsmime_selftest.c:sigpipe_release
Unexecuted instantiation: htsname_selftest.c:sigpipe_release
Unexecuted instantiation: htsnet_selftest.c:sigpipe_release
Unexecuted instantiation: htsopt_selftest.c:sigpipe_release
Unexecuted instantiation: htsparse_selftest.c:sigpipe_release
Unexecuted instantiation: htstools_selftest.c:sigpipe_release
Unexecuted instantiation: htswarc_selftest.c:sigpipe_release
Unexecuted instantiation: htswizard_selftest.c:sigpipe_release
984
#endif
985
986
/* A send() that cannot raise SIGPIPE. Linux honours the flag alone, but
987
   GNU/Hurd defines MSG_NOSIGNAL and still kills the process, which is how a
988
   library takes down whoever embedded it (#1689). A length past INT_MAX is
989
   clipped, which the caller sees as a short write. */
990
static HTS_INLINE HTS_UNUSED int hts_send_nosignal(T_SOC soc, const char *s,
991
0
                                                   size_t len) {
992
#ifdef __clang_analyzer__
993
  // the analyzer reads the INT_MAX clip as a huge send
994
  const int ilen = (int) len;
995
#else
996
0
  const int ilen = len > INT_MAX ? INT_MAX : (int) len;
997
0
#endif
998
0
#if defined(__linux__) && defined(MSG_NOSIGNAL)
999
0
  return (int) send(soc, s, ilen, HTS_MSG_NOSIGNAL);
1000
#else
1001
  sigpipe_mask m;
1002
  int n, err;
1003
1004
  sigpipe_hold(&m);
1005
  n = (int) send(soc, s, ilen, HTS_MSG_NOSIGNAL);
1006
  /* Save errno across the release, whose sigtimedwait() sets EAGAIN when
1007
     nothing was pending, which callers would read as a would-block. */
1008
  err = errno;
1009
  sigpipe_release(&m);
1010
  errno = err;
1011
  return n;
1012
#endif
1013
0
}
Unexecuted instantiation: htssitemap.c:hts_send_nosignal
Unexecuted instantiation: htscodec.c:hts_send_nosignal
Unexecuted instantiation: htstools.c:hts_send_nosignal
Unexecuted instantiation: htslib.c:hts_send_nosignal
Unexecuted instantiation: htsbase.c:hts_send_nosignal
Unexecuted instantiation: htsmime.c:hts_send_nosignal
Unexecuted instantiation: htsbauth.c:hts_send_nosignal
Unexecuted instantiation: htspsl.c:hts_send_nosignal
Unexecuted instantiation: htsbundle.c:hts_send_nosignal
Unexecuted instantiation: htssecret.c:hts_send_nosignal
Unexecuted instantiation: htscore.c:hts_send_nosignal
Unexecuted instantiation: htshash.c:hts_send_nosignal
Unexecuted instantiation: htsmhtml.c:hts_send_nosignal
Unexecuted instantiation: htsusercmd.c:hts_send_nosignal
Unexecuted instantiation: htschanges.c:hts_send_nosignal
Unexecuted instantiation: htscache.c:hts_send_nosignal
Unexecuted instantiation: htsback.c:hts_send_nosignal
Unexecuted instantiation: htsftp.c:hts_send_nosignal
Unexecuted instantiation: htscrashtest.c:hts_send_nosignal
Unexecuted instantiation: htsdns.c:hts_send_nosignal
Unexecuted instantiation: htsname.c:hts_send_nosignal
Unexecuted instantiation: htsmirror.c:hts_send_nosignal
Unexecuted instantiation: htsparse.c:hts_send_nosignal
Unexecuted instantiation: htssinglefile.c:hts_send_nosignal
Unexecuted instantiation: htswizard.c:hts_send_nosignal
Unexecuted instantiation: htsfilters.c:hts_send_nosignal
Unexecuted instantiation: htsrobots.c:hts_send_nosignal
Unexecuted instantiation: htsindex.c:hts_send_nosignal
Unexecuted instantiation: htslines.c:hts_send_nosignal
Unexecuted instantiation: htsfetch.c:hts_send_nosignal
Unexecuted instantiation: htswarc.c:hts_send_nosignal
Unexecuted instantiation: htscoremain.c:hts_send_nosignal
Unexecuted instantiation: htsalias.c:hts_send_nosignal
Unexecuted instantiation: htshelp.c:hts_send_nosignal
Unexecuted instantiation: htscatchurl.c:hts_send_nosignal
Unexecuted instantiation: htscookiefile.c:hts_send_nosignal
Unexecuted instantiation: htsproxy.c:hts_send_nosignal
Unexecuted instantiation: htszlib.c:hts_send_nosignal
Unexecuted instantiation: htsconcat.c:hts_send_nosignal
Unexecuted instantiation: htsmodules.c:hts_send_nosignal
Unexecuted instantiation: htsescape.c:hts_send_nosignal
Unexecuted instantiation: htssniff.c:hts_send_nosignal
Unexecuted instantiation: htsselftest.c:hts_send_nosignal
Unexecuted instantiation: htsback_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsselftest_util.c:hts_send_nosignal
Unexecuted instantiation: htsbase_selftest.c:hts_send_nosignal
Unexecuted instantiation: htscache_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsckd_selftest.c:hts_send_nosignal
Unexecuted instantiation: htscharset_selftest.c:hts_send_nosignal
Unexecuted instantiation: htscmdline_selftest.c:hts_send_nosignal
Unexecuted instantiation: htscookie_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsdns_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsfetch_selftest.c:hts_send_nosignal
Unexecuted instantiation: htspsl_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsindex_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsbundle_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsfilters_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsheader_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsio_selftest.c:hts_send_nosignal
Unexecuted instantiation: htslib_selftest.c:hts_send_nosignal
Unexecuted instantiation: htswrap.c:hts_send_nosignal
Unexecuted instantiation: htslines_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsmime_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsname_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsnet_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsopt_selftest.c:hts_send_nosignal
Unexecuted instantiation: htsparse_selftest.c:hts_send_nosignal
Unexecuted instantiation: htstools_selftest.c:hts_send_nosignal
Unexecuted instantiation: htswarc_selftest.c:hts_send_nosignal
Unexecuted instantiation: htswizard_selftest.c:hts_send_nosignal
1014
1015
HTS_CHECK_RESULT int fexist(const char *s);
1016
HTS_CHECK_RESULT int fexist_utf8(const char *s);
1017
1018
/* File size in bytes, -1 if absent or not a regular file. LLint, not off_t:
1019
   the latter is a 32-bit long on MSVC, truncating any file of 2GB or more. */
1020
HTS_CHECK_RESULT LLint fpsize(FILE *fp);
1021
HTS_CHECK_RESULT LLint fsize(const char *s);
1022
HTS_CHECK_RESULT LLint fsize_utf8(const char *s);
1023
1024
/* variables globales */
1025
extern int _DEBUG_HEAD;
1026
extern FILE *ioinfo;
1027
1028
// htsmodule.c definitions
1029
extern HTS_CHECK_RESULT void *openFunctionLib(const char *file_);
1030
extern HTS_CHECK_RESULT void *getFunctionPtr(void *handle, const char *fncname);
1031
extern void closeFunctionLib(void *handle);
1032
1033
int hts_set_callback(t_hts_htmlcheck_callbacks * callbacks,
1034
                     const char *name, void *function);
1035
void *hts_get_callback(t_hts_htmlcheck_callbacks * callbacks,
1036
                       const char *name);
1037
1038
0
#define CBSTRUCT(OPT) ((t_hts_htmlcheck_callbacks*) ((OPT)->callbacks_fun))
1039
0
#define GET_USERCALLBACK(OPT, NAME) ( CBSTRUCT(OPT)-> NAME .fun )
1040
0
#define GET_USERARG(OPT, NAME) ( CBSTRUCT(OPT)-> NAME .carg )
1041
/* True when a front end registered its own NAME callback */
1042
#define HAS_CALLBACK(OPT, NAME)                                                \
1043
0
  (CBSTRUCT(OPT) != NULL && CBSTRUCT(OPT)->NAME.fun != NULL &&                 \
1044
0
   CBSTRUCT(OPT)->NAME.fun != default_callbacks.NAME.fun)
1045
#define GET_CALLBACK(OPT, NAME)                                                \
1046
0
  (HAS_CALLBACK(OPT, NAME) ? (GET_USERCALLBACK(OPT, NAME))                     \
1047
0
                           : (default_callbacks.NAME.fun))
1048
1049
/* Predefined macros */
1050
0
#define RUN_CALLBACK_NOARG(OPT, NAME) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME))
1051
0
#define RUN_CALLBACK0(OPT, NAME) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT)
1052
0
#define RUN_CALLBACK1(OPT, NAME, ARG1) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1)
1053
0
#define RUN_CALLBACK2(OPT, NAME, ARG1, ARG2) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1, ARG2)
1054
0
#define RUN_CALLBACK3(OPT, NAME, ARG1, ARG2, ARG3) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1, ARG2, ARG3)
1055
0
#define RUN_CALLBACK4(OPT, NAME, ARG1, ARG2, ARG3, ARG4) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1, ARG2, ARG3, ARG4)
1056
0
#define RUN_CALLBACK5(OPT, NAME, ARG1, ARG2, ARG3, ARG4, ARG5) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1, ARG2, ARG3, ARG4, ARG5)
1057
0
#define RUN_CALLBACK6(OPT, NAME, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6)
1058
#define RUN_CALLBACK7(OPT, NAME, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7)     \
1059
0
  GET_CALLBACK(OPT, NAME)(GET_USERARG(OPT, NAME), OPT, ARG1, ARG2, ARG3, ARG4, \
1060
0
                          ARG5, ARG6, ARG7)
1061
1062
#endif // internals
1063
1064
#undef PATH_SEPARATOR
1065
#ifdef _WIN32
1066
#define PATH_SEPARATOR '\\'
1067
#else
1068
0
#define PATH_SEPARATOR '/'
1069
#endif
1070
1071
/* clang-format off */
1072
0
#define HTTP_IS_REDIRECT(code) ( \
1073
0
     (code) == HTTP_MOVED_PERMANENTLY \
1074
0
  || (code) == HTTP_FOUND               \
1075
0
  || (code) == HTTP_SEE_OTHER           \
1076
0
  || (code) == HTTP_TEMPORARY_REDIRECT  \
1077
0
  || (code) == HTTP_PERMANENT_REDIRECT  \
1078
0
  )
1079
0
#define HTTP_IS_NOTMODIFIED(code) ( \
1080
0
     (code) == HTTP_NOT_MODIFIED \
1081
0
  )
1082
0
#define HTTP_IS_OK(code) ( ( (code) / 100 ) == 2 )
1083
0
#define HTTP_IS_ERROR(code) ( !HTTP_IS_OK(code) && !HTTP_IS_REDIRECT(code) && !HTTP_IS_NOTMODIFIED(code) )
1084
1085
/* clang-format on */
1086
1087
/* Did a server answer? HTTP codes are positive, and HTTrack's own
1088
   (BackStatusCode) negative. Zero is neither: not set yet, for example
1089
   during an FTP transfer. */
1090
0
static HTS_INLINE HTS_UNUSED hts_boolean statuscode_is_http(int code) {
1091
0
  return code > 0;
1092
0
}
Unexecuted instantiation: htssitemap.c:statuscode_is_http
Unexecuted instantiation: htscodec.c:statuscode_is_http
Unexecuted instantiation: htstools.c:statuscode_is_http
Unexecuted instantiation: htslib.c:statuscode_is_http
Unexecuted instantiation: htsbase.c:statuscode_is_http
Unexecuted instantiation: htsmime.c:statuscode_is_http
Unexecuted instantiation: htsbauth.c:statuscode_is_http
Unexecuted instantiation: htspsl.c:statuscode_is_http
Unexecuted instantiation: htsbundle.c:statuscode_is_http
Unexecuted instantiation: htssecret.c:statuscode_is_http
Unexecuted instantiation: htscore.c:statuscode_is_http
Unexecuted instantiation: htshash.c:statuscode_is_http
Unexecuted instantiation: htsmhtml.c:statuscode_is_http
Unexecuted instantiation: htsusercmd.c:statuscode_is_http
Unexecuted instantiation: htschanges.c:statuscode_is_http
Unexecuted instantiation: htscache.c:statuscode_is_http
Unexecuted instantiation: htsback.c:statuscode_is_http
Unexecuted instantiation: htsftp.c:statuscode_is_http
Unexecuted instantiation: htscrashtest.c:statuscode_is_http
Unexecuted instantiation: htsdns.c:statuscode_is_http
Unexecuted instantiation: htsname.c:statuscode_is_http
Unexecuted instantiation: htsmirror.c:statuscode_is_http
Unexecuted instantiation: htsparse.c:statuscode_is_http
Unexecuted instantiation: htssinglefile.c:statuscode_is_http
Unexecuted instantiation: htswizard.c:statuscode_is_http
Unexecuted instantiation: htsfilters.c:statuscode_is_http
Unexecuted instantiation: htsrobots.c:statuscode_is_http
Unexecuted instantiation: htsindex.c:statuscode_is_http
Unexecuted instantiation: htslines.c:statuscode_is_http
Unexecuted instantiation: htsfetch.c:statuscode_is_http
Unexecuted instantiation: htswarc.c:statuscode_is_http
Unexecuted instantiation: htscoremain.c:statuscode_is_http
Unexecuted instantiation: htsalias.c:statuscode_is_http
Unexecuted instantiation: htshelp.c:statuscode_is_http
Unexecuted instantiation: htscatchurl.c:statuscode_is_http
Unexecuted instantiation: htscookiefile.c:statuscode_is_http
Unexecuted instantiation: htsproxy.c:statuscode_is_http
Unexecuted instantiation: htszlib.c:statuscode_is_http
Unexecuted instantiation: htsconcat.c:statuscode_is_http
Unexecuted instantiation: htsmodules.c:statuscode_is_http
Unexecuted instantiation: htsescape.c:statuscode_is_http
Unexecuted instantiation: htssniff.c:statuscode_is_http
Unexecuted instantiation: htsselftest.c:statuscode_is_http
Unexecuted instantiation: htsback_selftest.c:statuscode_is_http
Unexecuted instantiation: htsselftest_util.c:statuscode_is_http
Unexecuted instantiation: htsbase_selftest.c:statuscode_is_http
Unexecuted instantiation: htscache_selftest.c:statuscode_is_http
Unexecuted instantiation: htsckd_selftest.c:statuscode_is_http
Unexecuted instantiation: htscharset_selftest.c:statuscode_is_http
Unexecuted instantiation: htscmdline_selftest.c:statuscode_is_http
Unexecuted instantiation: htscookie_selftest.c:statuscode_is_http
Unexecuted instantiation: htsdns_selftest.c:statuscode_is_http
Unexecuted instantiation: htsfetch_selftest.c:statuscode_is_http
Unexecuted instantiation: htspsl_selftest.c:statuscode_is_http
Unexecuted instantiation: htsindex_selftest.c:statuscode_is_http
Unexecuted instantiation: htsbundle_selftest.c:statuscode_is_http
Unexecuted instantiation: htsfilters_selftest.c:statuscode_is_http
Unexecuted instantiation: htsheader_selftest.c:statuscode_is_http
Unexecuted instantiation: htsio_selftest.c:statuscode_is_http
Unexecuted instantiation: htslib_selftest.c:statuscode_is_http
Unexecuted instantiation: htswrap.c:statuscode_is_http
Unexecuted instantiation: htslines_selftest.c:statuscode_is_http
Unexecuted instantiation: htsmime_selftest.c:statuscode_is_http
Unexecuted instantiation: htsname_selftest.c:statuscode_is_http
Unexecuted instantiation: htsnet_selftest.c:statuscode_is_http
Unexecuted instantiation: htsopt_selftest.c:statuscode_is_http
Unexecuted instantiation: htsparse_selftest.c:statuscode_is_http
Unexecuted instantiation: htstools_selftest.c:statuscode_is_http
Unexecuted instantiation: htswarc_selftest.c:statuscode_is_http
Unexecuted instantiation: htswizard_selftest.c:statuscode_is_http
1093
1094
/* Is code one of HTTrack's own BackStatusCode values, not the server's? */
1095
0
static HTS_INLINE HTS_UNUSED hts_boolean statuscode_is_internal(int code) {
1096
0
  return code < 0;
1097
0
}
Unexecuted instantiation: htssitemap.c:statuscode_is_internal
Unexecuted instantiation: htscodec.c:statuscode_is_internal
Unexecuted instantiation: htstools.c:statuscode_is_internal
Unexecuted instantiation: htslib.c:statuscode_is_internal
Unexecuted instantiation: htsbase.c:statuscode_is_internal
Unexecuted instantiation: htsmime.c:statuscode_is_internal
Unexecuted instantiation: htsbauth.c:statuscode_is_internal
Unexecuted instantiation: htspsl.c:statuscode_is_internal
Unexecuted instantiation: htsbundle.c:statuscode_is_internal
Unexecuted instantiation: htssecret.c:statuscode_is_internal
Unexecuted instantiation: htscore.c:statuscode_is_internal
Unexecuted instantiation: htshash.c:statuscode_is_internal
Unexecuted instantiation: htsmhtml.c:statuscode_is_internal
Unexecuted instantiation: htsusercmd.c:statuscode_is_internal
Unexecuted instantiation: htschanges.c:statuscode_is_internal
Unexecuted instantiation: htscache.c:statuscode_is_internal
Unexecuted instantiation: htsback.c:statuscode_is_internal
Unexecuted instantiation: htsftp.c:statuscode_is_internal
Unexecuted instantiation: htscrashtest.c:statuscode_is_internal
Unexecuted instantiation: htsdns.c:statuscode_is_internal
Unexecuted instantiation: htsname.c:statuscode_is_internal
Unexecuted instantiation: htsmirror.c:statuscode_is_internal
Unexecuted instantiation: htsparse.c:statuscode_is_internal
Unexecuted instantiation: htssinglefile.c:statuscode_is_internal
Unexecuted instantiation: htswizard.c:statuscode_is_internal
Unexecuted instantiation: htsfilters.c:statuscode_is_internal
Unexecuted instantiation: htsrobots.c:statuscode_is_internal
Unexecuted instantiation: htsindex.c:statuscode_is_internal
Unexecuted instantiation: htslines.c:statuscode_is_internal
Unexecuted instantiation: htsfetch.c:statuscode_is_internal
Unexecuted instantiation: htswarc.c:statuscode_is_internal
Unexecuted instantiation: htscoremain.c:statuscode_is_internal
Unexecuted instantiation: htsalias.c:statuscode_is_internal
Unexecuted instantiation: htshelp.c:statuscode_is_internal
Unexecuted instantiation: htscatchurl.c:statuscode_is_internal
Unexecuted instantiation: htscookiefile.c:statuscode_is_internal
Unexecuted instantiation: htsproxy.c:statuscode_is_internal
Unexecuted instantiation: htszlib.c:statuscode_is_internal
Unexecuted instantiation: htsconcat.c:statuscode_is_internal
Unexecuted instantiation: htsmodules.c:statuscode_is_internal
Unexecuted instantiation: htsescape.c:statuscode_is_internal
Unexecuted instantiation: htssniff.c:statuscode_is_internal
Unexecuted instantiation: htsselftest.c:statuscode_is_internal
Unexecuted instantiation: htsback_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsselftest_util.c:statuscode_is_internal
Unexecuted instantiation: htsbase_selftest.c:statuscode_is_internal
Unexecuted instantiation: htscache_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsckd_selftest.c:statuscode_is_internal
Unexecuted instantiation: htscharset_selftest.c:statuscode_is_internal
Unexecuted instantiation: htscmdline_selftest.c:statuscode_is_internal
Unexecuted instantiation: htscookie_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsdns_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsfetch_selftest.c:statuscode_is_internal
Unexecuted instantiation: htspsl_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsindex_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsbundle_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsfilters_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsheader_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsio_selftest.c:statuscode_is_internal
Unexecuted instantiation: htslib_selftest.c:statuscode_is_internal
Unexecuted instantiation: htswrap.c:statuscode_is_internal
Unexecuted instantiation: htslines_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsmime_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsname_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsnet_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsopt_selftest.c:statuscode_is_internal
Unexecuted instantiation: htsparse_selftest.c:statuscode_is_internal
Unexecuted instantiation: htstools_selftest.c:statuscode_is_internal
Unexecuted instantiation: htswarc_selftest.c:statuscode_is_internal
Unexecuted instantiation: htswizard_selftest.c:statuscode_is_internal
1098
1099
/* Forces inlining of per-byte parser helpers, which gcc otherwise keeps out of
1100
   line (+0.4% instructions). */
1101
#if defined(__GNUC__)
1102
#define HTS_ALWAYS_INLINE inline __attribute__((always_inline))
1103
#elif defined(_MSC_VER)
1104
#define HTS_ALWAYS_INLINE __forceinline
1105
#else
1106
#define HTS_ALWAYS_INLINE inline
1107
#endif
1108
1109
/* Does c end a word: blank, line break or quote? */
1110
0
static HTS_ALWAYS_INLINE HTS_UNUSED hts_boolean is_space(int c) {
1111
0
  return c == ' ' || c == '"' || c == '\n' || c == '\r' || c == '\t' ||
1112
0
         c == '\f' || c == '\v' || c == '\'';
1113
0
}
Unexecuted instantiation: htssitemap.c:is_space
Unexecuted instantiation: htscodec.c:is_space
Unexecuted instantiation: htstools.c:is_space
Unexecuted instantiation: htslib.c:is_space
Unexecuted instantiation: htsbase.c:is_space
Unexecuted instantiation: htsmime.c:is_space
Unexecuted instantiation: htsbauth.c:is_space
Unexecuted instantiation: htspsl.c:is_space
Unexecuted instantiation: htsbundle.c:is_space
Unexecuted instantiation: htssecret.c:is_space
Unexecuted instantiation: htscore.c:is_space
Unexecuted instantiation: htshash.c:is_space
Unexecuted instantiation: htsmhtml.c:is_space
Unexecuted instantiation: htsusercmd.c:is_space
Unexecuted instantiation: htschanges.c:is_space
Unexecuted instantiation: htscache.c:is_space
Unexecuted instantiation: htsback.c:is_space
Unexecuted instantiation: htsftp.c:is_space
Unexecuted instantiation: htscrashtest.c:is_space
Unexecuted instantiation: htsdns.c:is_space
Unexecuted instantiation: htsname.c:is_space
Unexecuted instantiation: htsmirror.c:is_space
Unexecuted instantiation: htsparse.c:is_space
Unexecuted instantiation: htssinglefile.c:is_space
Unexecuted instantiation: htswizard.c:is_space
Unexecuted instantiation: htsfilters.c:is_space
Unexecuted instantiation: htsrobots.c:is_space
Unexecuted instantiation: htsindex.c:is_space
Unexecuted instantiation: htslines.c:is_space
Unexecuted instantiation: htsfetch.c:is_space
Unexecuted instantiation: htswarc.c:is_space
Unexecuted instantiation: htscoremain.c:is_space
Unexecuted instantiation: htsalias.c:is_space
Unexecuted instantiation: htshelp.c:is_space
Unexecuted instantiation: htscatchurl.c:is_space
Unexecuted instantiation: htscookiefile.c:is_space
Unexecuted instantiation: htsproxy.c:is_space
Unexecuted instantiation: htszlib.c:is_space
Unexecuted instantiation: htsconcat.c:is_space
Unexecuted instantiation: htsmodules.c:is_space
Unexecuted instantiation: htsescape.c:is_space
Unexecuted instantiation: htssniff.c:is_space
Unexecuted instantiation: htsselftest.c:is_space
Unexecuted instantiation: htsback_selftest.c:is_space
Unexecuted instantiation: htsselftest_util.c:is_space
Unexecuted instantiation: htsbase_selftest.c:is_space
Unexecuted instantiation: htscache_selftest.c:is_space
Unexecuted instantiation: htsckd_selftest.c:is_space
Unexecuted instantiation: htscharset_selftest.c:is_space
Unexecuted instantiation: htscmdline_selftest.c:is_space
Unexecuted instantiation: htscookie_selftest.c:is_space
Unexecuted instantiation: htsdns_selftest.c:is_space
Unexecuted instantiation: htsfetch_selftest.c:is_space
Unexecuted instantiation: htspsl_selftest.c:is_space
Unexecuted instantiation: htsindex_selftest.c:is_space
Unexecuted instantiation: htsbundle_selftest.c:is_space
Unexecuted instantiation: htsfilters_selftest.c:is_space
Unexecuted instantiation: htsheader_selftest.c:is_space
Unexecuted instantiation: htsio_selftest.c:is_space
Unexecuted instantiation: htslib_selftest.c:is_space
Unexecuted instantiation: htswrap.c:is_space
Unexecuted instantiation: htslines_selftest.c:is_space
Unexecuted instantiation: htsmime_selftest.c:is_space
Unexecuted instantiation: htsname_selftest.c:is_space
Unexecuted instantiation: htsnet_selftest.c:is_space
Unexecuted instantiation: htsopt_selftest.c:is_space
Unexecuted instantiation: htsparse_selftest.c:is_space
Unexecuted instantiation: htstools_selftest.c:is_space
Unexecuted instantiation: htswarc_selftest.c:is_space
Unexecuted instantiation: htswizard_selftest.c:is_space
1114
1115
0
#define is_realspace(c) hts_isspace(c)
1116
1117
/* Is c a space or a tab? */
1118
0
static HTS_ALWAYS_INLINE HTS_UNUSED hts_boolean is_taborspace(int c) {
1119
0
  return c == ' ' || c == '\t';
1120
0
}
Unexecuted instantiation: htssitemap.c:is_taborspace
Unexecuted instantiation: htscodec.c:is_taborspace
Unexecuted instantiation: htstools.c:is_taborspace
Unexecuted instantiation: htslib.c:is_taborspace
Unexecuted instantiation: htsbase.c:is_taborspace
Unexecuted instantiation: htsmime.c:is_taborspace
Unexecuted instantiation: htsbauth.c:is_taborspace
Unexecuted instantiation: htspsl.c:is_taborspace
Unexecuted instantiation: htsbundle.c:is_taborspace
Unexecuted instantiation: htssecret.c:is_taborspace
Unexecuted instantiation: htscore.c:is_taborspace
Unexecuted instantiation: htshash.c:is_taborspace
Unexecuted instantiation: htsmhtml.c:is_taborspace
Unexecuted instantiation: htsusercmd.c:is_taborspace
Unexecuted instantiation: htschanges.c:is_taborspace
Unexecuted instantiation: htscache.c:is_taborspace
Unexecuted instantiation: htsback.c:is_taborspace
Unexecuted instantiation: htsftp.c:is_taborspace
Unexecuted instantiation: htscrashtest.c:is_taborspace
Unexecuted instantiation: htsdns.c:is_taborspace
Unexecuted instantiation: htsname.c:is_taborspace
Unexecuted instantiation: htsmirror.c:is_taborspace
Unexecuted instantiation: htsparse.c:is_taborspace
Unexecuted instantiation: htssinglefile.c:is_taborspace
Unexecuted instantiation: htswizard.c:is_taborspace
Unexecuted instantiation: htsfilters.c:is_taborspace
Unexecuted instantiation: htsrobots.c:is_taborspace
Unexecuted instantiation: htsindex.c:is_taborspace
Unexecuted instantiation: htslines.c:is_taborspace
Unexecuted instantiation: htsfetch.c:is_taborspace
Unexecuted instantiation: htswarc.c:is_taborspace
Unexecuted instantiation: htscoremain.c:is_taborspace
Unexecuted instantiation: htsalias.c:is_taborspace
Unexecuted instantiation: htshelp.c:is_taborspace
Unexecuted instantiation: htscatchurl.c:is_taborspace
Unexecuted instantiation: htscookiefile.c:is_taborspace
Unexecuted instantiation: htsproxy.c:is_taborspace
Unexecuted instantiation: htszlib.c:is_taborspace
Unexecuted instantiation: htsconcat.c:is_taborspace
Unexecuted instantiation: htsmodules.c:is_taborspace
Unexecuted instantiation: htsescape.c:is_taborspace
Unexecuted instantiation: htssniff.c:is_taborspace
Unexecuted instantiation: htsselftest.c:is_taborspace
Unexecuted instantiation: htsback_selftest.c:is_taborspace
Unexecuted instantiation: htsselftest_util.c:is_taborspace
Unexecuted instantiation: htsbase_selftest.c:is_taborspace
Unexecuted instantiation: htscache_selftest.c:is_taborspace
Unexecuted instantiation: htsckd_selftest.c:is_taborspace
Unexecuted instantiation: htscharset_selftest.c:is_taborspace
Unexecuted instantiation: htscmdline_selftest.c:is_taborspace
Unexecuted instantiation: htscookie_selftest.c:is_taborspace
Unexecuted instantiation: htsdns_selftest.c:is_taborspace
Unexecuted instantiation: htsfetch_selftest.c:is_taborspace
Unexecuted instantiation: htspsl_selftest.c:is_taborspace
Unexecuted instantiation: htsindex_selftest.c:is_taborspace
Unexecuted instantiation: htsbundle_selftest.c:is_taborspace
Unexecuted instantiation: htsfilters_selftest.c:is_taborspace
Unexecuted instantiation: htsheader_selftest.c:is_taborspace
Unexecuted instantiation: htsio_selftest.c:is_taborspace
Unexecuted instantiation: htslib_selftest.c:is_taborspace
Unexecuted instantiation: htswrap.c:is_taborspace
Unexecuted instantiation: htslines_selftest.c:is_taborspace
Unexecuted instantiation: htsmime_selftest.c:is_taborspace
Unexecuted instantiation: htsname_selftest.c:is_taborspace
Unexecuted instantiation: htsnet_selftest.c:is_taborspace
Unexecuted instantiation: htsopt_selftest.c:is_taborspace
Unexecuted instantiation: htsparse_selftest.c:is_taborspace
Unexecuted instantiation: htstools_selftest.c:is_taborspace
Unexecuted instantiation: htswarc_selftest.c:is_taborspace
Unexecuted instantiation: htswizard_selftest.c:is_taborspace
1121
1122
/* Is c a line break or a tab? */
1123
0
static HTS_ALWAYS_INLINE HTS_UNUSED hts_boolean is_retorsep(int c) {
1124
0
  return c == '\n' || c == '\r' || c == '\t';
1125
0
}
Unexecuted instantiation: htssitemap.c:is_retorsep
Unexecuted instantiation: htscodec.c:is_retorsep
Unexecuted instantiation: htstools.c:is_retorsep
Unexecuted instantiation: htslib.c:is_retorsep
Unexecuted instantiation: htsbase.c:is_retorsep
Unexecuted instantiation: htsmime.c:is_retorsep
Unexecuted instantiation: htsbauth.c:is_retorsep
Unexecuted instantiation: htspsl.c:is_retorsep
Unexecuted instantiation: htsbundle.c:is_retorsep
Unexecuted instantiation: htssecret.c:is_retorsep
Unexecuted instantiation: htscore.c:is_retorsep
Unexecuted instantiation: htshash.c:is_retorsep
Unexecuted instantiation: htsmhtml.c:is_retorsep
Unexecuted instantiation: htsusercmd.c:is_retorsep
Unexecuted instantiation: htschanges.c:is_retorsep
Unexecuted instantiation: htscache.c:is_retorsep
Unexecuted instantiation: htsback.c:is_retorsep
Unexecuted instantiation: htsftp.c:is_retorsep
Unexecuted instantiation: htscrashtest.c:is_retorsep
Unexecuted instantiation: htsdns.c:is_retorsep
Unexecuted instantiation: htsname.c:is_retorsep
Unexecuted instantiation: htsmirror.c:is_retorsep
Unexecuted instantiation: htsparse.c:is_retorsep
Unexecuted instantiation: htssinglefile.c:is_retorsep
Unexecuted instantiation: htswizard.c:is_retorsep
Unexecuted instantiation: htsfilters.c:is_retorsep
Unexecuted instantiation: htsrobots.c:is_retorsep
Unexecuted instantiation: htsindex.c:is_retorsep
Unexecuted instantiation: htslines.c:is_retorsep
Unexecuted instantiation: htsfetch.c:is_retorsep
Unexecuted instantiation: htswarc.c:is_retorsep
Unexecuted instantiation: htscoremain.c:is_retorsep
Unexecuted instantiation: htsalias.c:is_retorsep
Unexecuted instantiation: htshelp.c:is_retorsep
Unexecuted instantiation: htscatchurl.c:is_retorsep
Unexecuted instantiation: htscookiefile.c:is_retorsep
Unexecuted instantiation: htsproxy.c:is_retorsep
Unexecuted instantiation: htszlib.c:is_retorsep
Unexecuted instantiation: htsconcat.c:is_retorsep
Unexecuted instantiation: htsmodules.c:is_retorsep
Unexecuted instantiation: htsescape.c:is_retorsep
Unexecuted instantiation: htssniff.c:is_retorsep
Unexecuted instantiation: htsselftest.c:is_retorsep
Unexecuted instantiation: htsback_selftest.c:is_retorsep
Unexecuted instantiation: htsselftest_util.c:is_retorsep
Unexecuted instantiation: htsbase_selftest.c:is_retorsep
Unexecuted instantiation: htscache_selftest.c:is_retorsep
Unexecuted instantiation: htsckd_selftest.c:is_retorsep
Unexecuted instantiation: htscharset_selftest.c:is_retorsep
Unexecuted instantiation: htscmdline_selftest.c:is_retorsep
Unexecuted instantiation: htscookie_selftest.c:is_retorsep
Unexecuted instantiation: htsdns_selftest.c:is_retorsep
Unexecuted instantiation: htsfetch_selftest.c:is_retorsep
Unexecuted instantiation: htspsl_selftest.c:is_retorsep
Unexecuted instantiation: htsindex_selftest.c:is_retorsep
Unexecuted instantiation: htsbundle_selftest.c:is_retorsep
Unexecuted instantiation: htsfilters_selftest.c:is_retorsep
Unexecuted instantiation: htsheader_selftest.c:is_retorsep
Unexecuted instantiation: htsio_selftest.c:is_retorsep
Unexecuted instantiation: htslib_selftest.c:is_retorsep
Unexecuted instantiation: htswrap.c:is_retorsep
Unexecuted instantiation: htslines_selftest.c:is_retorsep
Unexecuted instantiation: htsmime_selftest.c:is_retorsep
Unexecuted instantiation: htsname_selftest.c:is_retorsep
Unexecuted instantiation: htsnet_selftest.c:is_retorsep
Unexecuted instantiation: htsopt_selftest.c:is_retorsep
Unexecuted instantiation: htsparse_selftest.c:is_retorsep
Unexecuted instantiation: htstools_selftest.c:is_retorsep
Unexecuted instantiation: htswarc_selftest.c:is_retorsep
Unexecuted instantiation: htswizard_selftest.c:is_retorsep
1126
1127
/* MSVC ships these POSIX functions under other names. Kept out of the installed
1128
   headers: they would rewrite the same identifiers in a consumer's own code. */
1129
#ifdef _MSC_VER
1130
#define fseeko _fseeki64
1131
#define ftello _ftelli64
1132
#endif
1133
1134
// is this MIME an hypertext MIME (text/html), html/js-style or other script/text type?
1135
0
#define HTS_HYPERTEXT_DEFAULT_MIME "text/html"
1136
/* Cached when the server sent no Content-Type. Type tests treat it as html,
1137
   but wire_patches_ext() keeps the URL extension. */
1138
0
#define HTS_UNKNOWN_MIME "unknown/unknown"
1139
/* Map the no-declared-type sentinel back to a real type for any header or
1140
   record we EMIT or PERSIST, so "unknown/unknown" never reaches a consumer
1141
   (a served Content-Type, a ProxyTrack .arc record, ...). */
1142
0
static HTS_INLINE HTS_UNUSED const char *hts_effective_mime(const char *m) {
1143
0
  return hts_streq_ci(m, HTS_UNKNOWN_MIME) ? HTS_HYPERTEXT_DEFAULT_MIME : m;
1144
0
}
Unexecuted instantiation: htssitemap.c:hts_effective_mime
Unexecuted instantiation: htscodec.c:hts_effective_mime
Unexecuted instantiation: htstools.c:hts_effective_mime
Unexecuted instantiation: htslib.c:hts_effective_mime
Unexecuted instantiation: htsbase.c:hts_effective_mime
Unexecuted instantiation: htsmime.c:hts_effective_mime
Unexecuted instantiation: htsbauth.c:hts_effective_mime
Unexecuted instantiation: htspsl.c:hts_effective_mime
Unexecuted instantiation: htsbundle.c:hts_effective_mime
Unexecuted instantiation: htssecret.c:hts_effective_mime
Unexecuted instantiation: htscore.c:hts_effective_mime
Unexecuted instantiation: htshash.c:hts_effective_mime
Unexecuted instantiation: htsmhtml.c:hts_effective_mime
Unexecuted instantiation: htsusercmd.c:hts_effective_mime
Unexecuted instantiation: htschanges.c:hts_effective_mime
Unexecuted instantiation: htscache.c:hts_effective_mime
Unexecuted instantiation: htsback.c:hts_effective_mime
Unexecuted instantiation: htsftp.c:hts_effective_mime
Unexecuted instantiation: htscrashtest.c:hts_effective_mime
Unexecuted instantiation: htsdns.c:hts_effective_mime
Unexecuted instantiation: htsname.c:hts_effective_mime
Unexecuted instantiation: htsmirror.c:hts_effective_mime
Unexecuted instantiation: htsparse.c:hts_effective_mime
Unexecuted instantiation: htssinglefile.c:hts_effective_mime
Unexecuted instantiation: htswizard.c:hts_effective_mime
Unexecuted instantiation: htsfilters.c:hts_effective_mime
Unexecuted instantiation: htsrobots.c:hts_effective_mime
Unexecuted instantiation: htsindex.c:hts_effective_mime
Unexecuted instantiation: htslines.c:hts_effective_mime
Unexecuted instantiation: htsfetch.c:hts_effective_mime
Unexecuted instantiation: htswarc.c:hts_effective_mime
Unexecuted instantiation: htscoremain.c:hts_effective_mime
Unexecuted instantiation: htsalias.c:hts_effective_mime
Unexecuted instantiation: htshelp.c:hts_effective_mime
Unexecuted instantiation: htscatchurl.c:hts_effective_mime
Unexecuted instantiation: htscookiefile.c:hts_effective_mime
Unexecuted instantiation: htsproxy.c:hts_effective_mime
Unexecuted instantiation: htszlib.c:hts_effective_mime
Unexecuted instantiation: htsconcat.c:hts_effective_mime
Unexecuted instantiation: htsmodules.c:hts_effective_mime
Unexecuted instantiation: htsescape.c:hts_effective_mime
Unexecuted instantiation: htssniff.c:hts_effective_mime
Unexecuted instantiation: htsselftest.c:hts_effective_mime
Unexecuted instantiation: htsback_selftest.c:hts_effective_mime
Unexecuted instantiation: htsselftest_util.c:hts_effective_mime
Unexecuted instantiation: htsbase_selftest.c:hts_effective_mime
Unexecuted instantiation: htscache_selftest.c:hts_effective_mime
Unexecuted instantiation: htsckd_selftest.c:hts_effective_mime
Unexecuted instantiation: htscharset_selftest.c:hts_effective_mime
Unexecuted instantiation: htscmdline_selftest.c:hts_effective_mime
Unexecuted instantiation: htscookie_selftest.c:hts_effective_mime
Unexecuted instantiation: htsdns_selftest.c:hts_effective_mime
Unexecuted instantiation: htsfetch_selftest.c:hts_effective_mime
Unexecuted instantiation: htspsl_selftest.c:hts_effective_mime
Unexecuted instantiation: htsindex_selftest.c:hts_effective_mime
Unexecuted instantiation: htsbundle_selftest.c:hts_effective_mime
Unexecuted instantiation: htsfilters_selftest.c:hts_effective_mime
Unexecuted instantiation: htsheader_selftest.c:hts_effective_mime
Unexecuted instantiation: htsio_selftest.c:hts_effective_mime
Unexecuted instantiation: htslib_selftest.c:hts_effective_mime
Unexecuted instantiation: htswrap.c:hts_effective_mime
Unexecuted instantiation: htslines_selftest.c:hts_effective_mime
Unexecuted instantiation: htsmime_selftest.c:hts_effective_mime
Unexecuted instantiation: htsname_selftest.c:hts_effective_mime
Unexecuted instantiation: htsnet_selftest.c:hts_effective_mime
Unexecuted instantiation: htsopt_selftest.c:hts_effective_mime
Unexecuted instantiation: htsparse_selftest.c:hts_effective_mime
Unexecuted instantiation: htstools_selftest.c:hts_effective_mime
Unexecuted instantiation: htswarc_selftest.c:hts_effective_mime
Unexecuted instantiation: htswizard_selftest.c:hts_effective_mime
1145
1146
0
static HTS_INLINE HTS_UNUSED hts_boolean is_html_mime_type(const char *a) {
1147
0
  return hts_streq_ci(a, "text/html") ||
1148
0
         hts_streq_ci(a, "application/xhtml+xml") ||
1149
         /* no declared type: treat as html */
1150
0
         hts_streq_ci(a, HTS_UNKNOWN_MIME);
1151
0
}
Unexecuted instantiation: htssitemap.c:is_html_mime_type
Unexecuted instantiation: htscodec.c:is_html_mime_type
Unexecuted instantiation: htstools.c:is_html_mime_type
Unexecuted instantiation: htslib.c:is_html_mime_type
Unexecuted instantiation: htsbase.c:is_html_mime_type
Unexecuted instantiation: htsmime.c:is_html_mime_type
Unexecuted instantiation: htsbauth.c:is_html_mime_type
Unexecuted instantiation: htspsl.c:is_html_mime_type
Unexecuted instantiation: htsbundle.c:is_html_mime_type
Unexecuted instantiation: htssecret.c:is_html_mime_type
Unexecuted instantiation: htscore.c:is_html_mime_type
Unexecuted instantiation: htshash.c:is_html_mime_type
Unexecuted instantiation: htsmhtml.c:is_html_mime_type
Unexecuted instantiation: htsusercmd.c:is_html_mime_type
Unexecuted instantiation: htschanges.c:is_html_mime_type
Unexecuted instantiation: htscache.c:is_html_mime_type
Unexecuted instantiation: htsback.c:is_html_mime_type
Unexecuted instantiation: htsftp.c:is_html_mime_type
Unexecuted instantiation: htscrashtest.c:is_html_mime_type
Unexecuted instantiation: htsdns.c:is_html_mime_type
Unexecuted instantiation: htsname.c:is_html_mime_type
Unexecuted instantiation: htsmirror.c:is_html_mime_type
Unexecuted instantiation: htsparse.c:is_html_mime_type
Unexecuted instantiation: htssinglefile.c:is_html_mime_type
Unexecuted instantiation: htswizard.c:is_html_mime_type
Unexecuted instantiation: htsfilters.c:is_html_mime_type
Unexecuted instantiation: htsrobots.c:is_html_mime_type
Unexecuted instantiation: htsindex.c:is_html_mime_type
Unexecuted instantiation: htslines.c:is_html_mime_type
Unexecuted instantiation: htsfetch.c:is_html_mime_type
Unexecuted instantiation: htswarc.c:is_html_mime_type
Unexecuted instantiation: htscoremain.c:is_html_mime_type
Unexecuted instantiation: htsalias.c:is_html_mime_type
Unexecuted instantiation: htshelp.c:is_html_mime_type
Unexecuted instantiation: htscatchurl.c:is_html_mime_type
Unexecuted instantiation: htscookiefile.c:is_html_mime_type
Unexecuted instantiation: htsproxy.c:is_html_mime_type
Unexecuted instantiation: htszlib.c:is_html_mime_type
Unexecuted instantiation: htsconcat.c:is_html_mime_type
Unexecuted instantiation: htsmodules.c:is_html_mime_type
Unexecuted instantiation: htsescape.c:is_html_mime_type
Unexecuted instantiation: htssniff.c:is_html_mime_type
Unexecuted instantiation: htsselftest.c:is_html_mime_type
Unexecuted instantiation: htsback_selftest.c:is_html_mime_type
Unexecuted instantiation: htsselftest_util.c:is_html_mime_type
Unexecuted instantiation: htsbase_selftest.c:is_html_mime_type
Unexecuted instantiation: htscache_selftest.c:is_html_mime_type
Unexecuted instantiation: htsckd_selftest.c:is_html_mime_type
Unexecuted instantiation: htscharset_selftest.c:is_html_mime_type
Unexecuted instantiation: htscmdline_selftest.c:is_html_mime_type
Unexecuted instantiation: htscookie_selftest.c:is_html_mime_type
Unexecuted instantiation: htsdns_selftest.c:is_html_mime_type
Unexecuted instantiation: htsfetch_selftest.c:is_html_mime_type
Unexecuted instantiation: htspsl_selftest.c:is_html_mime_type
Unexecuted instantiation: htsindex_selftest.c:is_html_mime_type
Unexecuted instantiation: htsbundle_selftest.c:is_html_mime_type
Unexecuted instantiation: htsfilters_selftest.c:is_html_mime_type
Unexecuted instantiation: htsheader_selftest.c:is_html_mime_type
Unexecuted instantiation: htsio_selftest.c:is_html_mime_type
Unexecuted instantiation: htslib_selftest.c:is_html_mime_type
Unexecuted instantiation: htswrap.c:is_html_mime_type
Unexecuted instantiation: htslines_selftest.c:is_html_mime_type
Unexecuted instantiation: htsmime_selftest.c:is_html_mime_type
Unexecuted instantiation: htsname_selftest.c:is_html_mime_type
Unexecuted instantiation: htsnet_selftest.c:is_html_mime_type
Unexecuted instantiation: htsopt_selftest.c:is_html_mime_type
Unexecuted instantiation: htsparse_selftest.c:is_html_mime_type
Unexecuted instantiation: htstools_selftest.c:is_html_mime_type
Unexecuted instantiation: htswarc_selftest.c:is_html_mime_type
Unexecuted instantiation: htswizard_selftest.c:is_html_mime_type
1152
1153
/* Every JavaScript type we link-scan: IANA's text/javascript, which is what
1154
   servers send and what our own table emits for .mjs, plus the legacy
1155
   application spellings .js still maps to. */
1156
static HTS_INLINE HTS_UNUSED hts_boolean
1157
0
is_javascript_mime_type(const char *a) {
1158
0
  return hts_streq_ci(a, "text/javascript") ||
1159
0
         hts_streq_ci(a, "application/javascript") ||
1160
0
         hts_streq_ci(a, "application/x-javascript") ||
1161
0
         hts_streq_ci(a, "application/ecmascript");
1162
0
}
Unexecuted instantiation: htssitemap.c:is_javascript_mime_type
Unexecuted instantiation: htscodec.c:is_javascript_mime_type
Unexecuted instantiation: htstools.c:is_javascript_mime_type
Unexecuted instantiation: htslib.c:is_javascript_mime_type
Unexecuted instantiation: htsbase.c:is_javascript_mime_type
Unexecuted instantiation: htsmime.c:is_javascript_mime_type
Unexecuted instantiation: htsbauth.c:is_javascript_mime_type
Unexecuted instantiation: htspsl.c:is_javascript_mime_type
Unexecuted instantiation: htsbundle.c:is_javascript_mime_type
Unexecuted instantiation: htssecret.c:is_javascript_mime_type
Unexecuted instantiation: htscore.c:is_javascript_mime_type
Unexecuted instantiation: htshash.c:is_javascript_mime_type
Unexecuted instantiation: htsmhtml.c:is_javascript_mime_type
Unexecuted instantiation: htsusercmd.c:is_javascript_mime_type
Unexecuted instantiation: htschanges.c:is_javascript_mime_type
Unexecuted instantiation: htscache.c:is_javascript_mime_type
Unexecuted instantiation: htsback.c:is_javascript_mime_type
Unexecuted instantiation: htsftp.c:is_javascript_mime_type
Unexecuted instantiation: htscrashtest.c:is_javascript_mime_type
Unexecuted instantiation: htsdns.c:is_javascript_mime_type
Unexecuted instantiation: htsname.c:is_javascript_mime_type
Unexecuted instantiation: htsmirror.c:is_javascript_mime_type
Unexecuted instantiation: htsparse.c:is_javascript_mime_type
Unexecuted instantiation: htssinglefile.c:is_javascript_mime_type
Unexecuted instantiation: htswizard.c:is_javascript_mime_type
Unexecuted instantiation: htsfilters.c:is_javascript_mime_type
Unexecuted instantiation: htsrobots.c:is_javascript_mime_type
Unexecuted instantiation: htsindex.c:is_javascript_mime_type
Unexecuted instantiation: htslines.c:is_javascript_mime_type
Unexecuted instantiation: htsfetch.c:is_javascript_mime_type
Unexecuted instantiation: htswarc.c:is_javascript_mime_type
Unexecuted instantiation: htscoremain.c:is_javascript_mime_type
Unexecuted instantiation: htsalias.c:is_javascript_mime_type
Unexecuted instantiation: htshelp.c:is_javascript_mime_type
Unexecuted instantiation: htscatchurl.c:is_javascript_mime_type
Unexecuted instantiation: htscookiefile.c:is_javascript_mime_type
Unexecuted instantiation: htsproxy.c:is_javascript_mime_type
Unexecuted instantiation: htszlib.c:is_javascript_mime_type
Unexecuted instantiation: htsconcat.c:is_javascript_mime_type
Unexecuted instantiation: htsmodules.c:is_javascript_mime_type
Unexecuted instantiation: htsescape.c:is_javascript_mime_type
Unexecuted instantiation: htssniff.c:is_javascript_mime_type
Unexecuted instantiation: htsselftest.c:is_javascript_mime_type
Unexecuted instantiation: htsback_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsselftest_util.c:is_javascript_mime_type
Unexecuted instantiation: htsbase_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htscache_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsckd_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htscharset_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htscmdline_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htscookie_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsdns_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsfetch_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htspsl_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsindex_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsbundle_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsfilters_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsheader_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsio_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htslib_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htswrap.c:is_javascript_mime_type
Unexecuted instantiation: htslines_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsmime_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsname_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsnet_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsopt_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htsparse_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htstools_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htswarc_selftest.c:is_javascript_mime_type
Unexecuted instantiation: htswizard_selftest.c:is_javascript_mime_type
1163
1164
0
static HTS_INLINE HTS_UNUSED hts_boolean is_hypertext_mime__(const char *a) {
1165
0
  return is_html_mime_type(a) || is_javascript_mime_type(a) ||
1166
0
         hts_streq_ci(a, "text/css") || hts_streq_ci(a, "image/svg+xml") ||
1167
0
         hts_streq_ci(a, "image/svg-xml") ||
1168
0
         hts_streq_ci(a, "application/x-authorware-map") ||
1169
0
         hts_streq_ci(a, "application/rss+xml") ||
1170
0
         hts_streq_ci(a, "application/atom+xml");
1171
0
}
Unexecuted instantiation: htssitemap.c:is_hypertext_mime__
Unexecuted instantiation: htscodec.c:is_hypertext_mime__
Unexecuted instantiation: htstools.c:is_hypertext_mime__
Unexecuted instantiation: htslib.c:is_hypertext_mime__
Unexecuted instantiation: htsbase.c:is_hypertext_mime__
Unexecuted instantiation: htsmime.c:is_hypertext_mime__
Unexecuted instantiation: htsbauth.c:is_hypertext_mime__
Unexecuted instantiation: htspsl.c:is_hypertext_mime__
Unexecuted instantiation: htsbundle.c:is_hypertext_mime__
Unexecuted instantiation: htssecret.c:is_hypertext_mime__
Unexecuted instantiation: htscore.c:is_hypertext_mime__
Unexecuted instantiation: htshash.c:is_hypertext_mime__
Unexecuted instantiation: htsmhtml.c:is_hypertext_mime__
Unexecuted instantiation: htsusercmd.c:is_hypertext_mime__
Unexecuted instantiation: htschanges.c:is_hypertext_mime__
Unexecuted instantiation: htscache.c:is_hypertext_mime__
Unexecuted instantiation: htsback.c:is_hypertext_mime__
Unexecuted instantiation: htsftp.c:is_hypertext_mime__
Unexecuted instantiation: htscrashtest.c:is_hypertext_mime__
Unexecuted instantiation: htsdns.c:is_hypertext_mime__
Unexecuted instantiation: htsname.c:is_hypertext_mime__
Unexecuted instantiation: htsmirror.c:is_hypertext_mime__
Unexecuted instantiation: htsparse.c:is_hypertext_mime__
Unexecuted instantiation: htssinglefile.c:is_hypertext_mime__
Unexecuted instantiation: htswizard.c:is_hypertext_mime__
Unexecuted instantiation: htsfilters.c:is_hypertext_mime__
Unexecuted instantiation: htsrobots.c:is_hypertext_mime__
Unexecuted instantiation: htsindex.c:is_hypertext_mime__
Unexecuted instantiation: htslines.c:is_hypertext_mime__
Unexecuted instantiation: htsfetch.c:is_hypertext_mime__
Unexecuted instantiation: htswarc.c:is_hypertext_mime__
Unexecuted instantiation: htscoremain.c:is_hypertext_mime__
Unexecuted instantiation: htsalias.c:is_hypertext_mime__
Unexecuted instantiation: htshelp.c:is_hypertext_mime__
Unexecuted instantiation: htscatchurl.c:is_hypertext_mime__
Unexecuted instantiation: htscookiefile.c:is_hypertext_mime__
Unexecuted instantiation: htsproxy.c:is_hypertext_mime__
Unexecuted instantiation: htszlib.c:is_hypertext_mime__
Unexecuted instantiation: htsconcat.c:is_hypertext_mime__
Unexecuted instantiation: htsmodules.c:is_hypertext_mime__
Unexecuted instantiation: htsescape.c:is_hypertext_mime__
Unexecuted instantiation: htssniff.c:is_hypertext_mime__
Unexecuted instantiation: htsselftest.c:is_hypertext_mime__
Unexecuted instantiation: htsback_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsselftest_util.c:is_hypertext_mime__
Unexecuted instantiation: htsbase_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htscache_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsckd_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htscharset_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htscmdline_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htscookie_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsdns_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsfetch_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htspsl_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsindex_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsbundle_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsfilters_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsheader_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsio_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htslib_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htswrap.c:is_hypertext_mime__
Unexecuted instantiation: htslines_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsmime_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsname_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsnet_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsopt_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htsparse_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htstools_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htswarc_selftest.c:is_hypertext_mime__
Unexecuted instantiation: htswizard_selftest.c:is_hypertext_mime__
1172
1173
/* Every spelling servers use for an m3u playlist, HLS's included. */
1174
0
static HTS_INLINE HTS_UNUSED hts_boolean is_playlist_mime_type(const char *a) {
1175
0
  return hts_streq_ci(a, "audio/x-mpegurl") ||
1176
0
         hts_streq_ci(a, "audio/mpegurl") ||
1177
0
         hts_streq_ci(a, "application/x-mpegurl") ||
1178
0
         hts_streq_ci(a, "application/vnd.apple.mpegurl");
1179
0
}
Unexecuted instantiation: htssitemap.c:is_playlist_mime_type
Unexecuted instantiation: htscodec.c:is_playlist_mime_type
Unexecuted instantiation: htstools.c:is_playlist_mime_type
Unexecuted instantiation: htslib.c:is_playlist_mime_type
Unexecuted instantiation: htsbase.c:is_playlist_mime_type
Unexecuted instantiation: htsmime.c:is_playlist_mime_type
Unexecuted instantiation: htsbauth.c:is_playlist_mime_type
Unexecuted instantiation: htspsl.c:is_playlist_mime_type
Unexecuted instantiation: htsbundle.c:is_playlist_mime_type
Unexecuted instantiation: htssecret.c:is_playlist_mime_type
Unexecuted instantiation: htscore.c:is_playlist_mime_type
Unexecuted instantiation: htshash.c:is_playlist_mime_type
Unexecuted instantiation: htsmhtml.c:is_playlist_mime_type
Unexecuted instantiation: htsusercmd.c:is_playlist_mime_type
Unexecuted instantiation: htschanges.c:is_playlist_mime_type
Unexecuted instantiation: htscache.c:is_playlist_mime_type
Unexecuted instantiation: htsback.c:is_playlist_mime_type
Unexecuted instantiation: htsftp.c:is_playlist_mime_type
Unexecuted instantiation: htscrashtest.c:is_playlist_mime_type
Unexecuted instantiation: htsdns.c:is_playlist_mime_type
Unexecuted instantiation: htsname.c:is_playlist_mime_type
Unexecuted instantiation: htsmirror.c:is_playlist_mime_type
Unexecuted instantiation: htsparse.c:is_playlist_mime_type
Unexecuted instantiation: htssinglefile.c:is_playlist_mime_type
Unexecuted instantiation: htswizard.c:is_playlist_mime_type
Unexecuted instantiation: htsfilters.c:is_playlist_mime_type
Unexecuted instantiation: htsrobots.c:is_playlist_mime_type
Unexecuted instantiation: htsindex.c:is_playlist_mime_type
Unexecuted instantiation: htslines.c:is_playlist_mime_type
Unexecuted instantiation: htsfetch.c:is_playlist_mime_type
Unexecuted instantiation: htswarc.c:is_playlist_mime_type
Unexecuted instantiation: htscoremain.c:is_playlist_mime_type
Unexecuted instantiation: htsalias.c:is_playlist_mime_type
Unexecuted instantiation: htshelp.c:is_playlist_mime_type
Unexecuted instantiation: htscatchurl.c:is_playlist_mime_type
Unexecuted instantiation: htscookiefile.c:is_playlist_mime_type
Unexecuted instantiation: htsproxy.c:is_playlist_mime_type
Unexecuted instantiation: htszlib.c:is_playlist_mime_type
Unexecuted instantiation: htsconcat.c:is_playlist_mime_type
Unexecuted instantiation: htsmodules.c:is_playlist_mime_type
Unexecuted instantiation: htsescape.c:is_playlist_mime_type
Unexecuted instantiation: htssniff.c:is_playlist_mime_type
Unexecuted instantiation: htsselftest.c:is_playlist_mime_type
Unexecuted instantiation: htsback_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsselftest_util.c:is_playlist_mime_type
Unexecuted instantiation: htsbase_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htscache_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsckd_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htscharset_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htscmdline_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htscookie_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsdns_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsfetch_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htspsl_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsindex_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsbundle_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsfilters_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsheader_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsio_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htslib_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htswrap.c:is_playlist_mime_type
Unexecuted instantiation: htslines_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsmime_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsname_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsnet_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsopt_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htsparse_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htstools_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htswarc_selftest.c:is_playlist_mime_type
Unexecuted instantiation: htswizard_selftest.c:is_playlist_mime_type
1180
1181
/* TODO: text/xml and application/xml, once their content is checked. */
1182
static HTS_INLINE HTS_UNUSED hts_boolean
1183
0
may_be_hypertext_mime__(const char *a) {
1184
0
  return hts_streq_ci(a, "audio/x-pn-realaudio") || is_playlist_mime_type(a);
1185
0
}
Unexecuted instantiation: htssitemap.c:may_be_hypertext_mime__
Unexecuted instantiation: htscodec.c:may_be_hypertext_mime__
Unexecuted instantiation: htstools.c:may_be_hypertext_mime__
Unexecuted instantiation: htslib.c:may_be_hypertext_mime__
Unexecuted instantiation: htsbase.c:may_be_hypertext_mime__
Unexecuted instantiation: htsmime.c:may_be_hypertext_mime__
Unexecuted instantiation: htsbauth.c:may_be_hypertext_mime__
Unexecuted instantiation: htspsl.c:may_be_hypertext_mime__
Unexecuted instantiation: htsbundle.c:may_be_hypertext_mime__
Unexecuted instantiation: htssecret.c:may_be_hypertext_mime__
Unexecuted instantiation: htscore.c:may_be_hypertext_mime__
Unexecuted instantiation: htshash.c:may_be_hypertext_mime__
Unexecuted instantiation: htsmhtml.c:may_be_hypertext_mime__
Unexecuted instantiation: htsusercmd.c:may_be_hypertext_mime__
Unexecuted instantiation: htschanges.c:may_be_hypertext_mime__
Unexecuted instantiation: htscache.c:may_be_hypertext_mime__
Unexecuted instantiation: htsback.c:may_be_hypertext_mime__
Unexecuted instantiation: htsftp.c:may_be_hypertext_mime__
Unexecuted instantiation: htscrashtest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsdns.c:may_be_hypertext_mime__
Unexecuted instantiation: htsname.c:may_be_hypertext_mime__
Unexecuted instantiation: htsmirror.c:may_be_hypertext_mime__
Unexecuted instantiation: htsparse.c:may_be_hypertext_mime__
Unexecuted instantiation: htssinglefile.c:may_be_hypertext_mime__
Unexecuted instantiation: htswizard.c:may_be_hypertext_mime__
Unexecuted instantiation: htsfilters.c:may_be_hypertext_mime__
Unexecuted instantiation: htsrobots.c:may_be_hypertext_mime__
Unexecuted instantiation: htsindex.c:may_be_hypertext_mime__
Unexecuted instantiation: htslines.c:may_be_hypertext_mime__
Unexecuted instantiation: htsfetch.c:may_be_hypertext_mime__
Unexecuted instantiation: htswarc.c:may_be_hypertext_mime__
Unexecuted instantiation: htscoremain.c:may_be_hypertext_mime__
Unexecuted instantiation: htsalias.c:may_be_hypertext_mime__
Unexecuted instantiation: htshelp.c:may_be_hypertext_mime__
Unexecuted instantiation: htscatchurl.c:may_be_hypertext_mime__
Unexecuted instantiation: htscookiefile.c:may_be_hypertext_mime__
Unexecuted instantiation: htsproxy.c:may_be_hypertext_mime__
Unexecuted instantiation: htszlib.c:may_be_hypertext_mime__
Unexecuted instantiation: htsconcat.c:may_be_hypertext_mime__
Unexecuted instantiation: htsmodules.c:may_be_hypertext_mime__
Unexecuted instantiation: htsescape.c:may_be_hypertext_mime__
Unexecuted instantiation: htssniff.c:may_be_hypertext_mime__
Unexecuted instantiation: htsselftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsback_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsselftest_util.c:may_be_hypertext_mime__
Unexecuted instantiation: htsbase_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htscache_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsckd_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htscharset_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htscmdline_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htscookie_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsdns_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsfetch_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htspsl_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsindex_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsbundle_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsfilters_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsheader_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsio_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htslib_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htswrap.c:may_be_hypertext_mime__
Unexecuted instantiation: htslines_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsmime_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsname_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsnet_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsopt_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htsparse_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htstools_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htswarc_selftest.c:may_be_hypertext_mime__
Unexecuted instantiation: htswizard_selftest.c:may_be_hypertext_mime__
1186
1187
/* Library internal definictions */
1188
#ifdef HTS_INTERNAL_BYTECODE
1189
1190
// check if (mime, file) is hypertext
1191
HTS_STATIC int is_hypertext_mime(httrackp * opt, const char *mime,
1192
0
                                 const char *file) {
1193
0
  if (is_hypertext_mime__(mime))
1194
0
    return 1;
1195
0
  if (may_unknown(opt, mime)) {
1196
0
    char guessed[256];
1197
1198
0
    guessed[0] = '\0';
1199
0
    if (!guess_httptype_sized(opt, guessed, sizeof(guessed), file))
1200
0
      return 0;
1201
0
    return is_hypertext_mime__(guessed);
1202
0
  }
1203
0
  return 0;
1204
0
}
Unexecuted instantiation: htssitemap.c:is_hypertext_mime
Unexecuted instantiation: htscodec.c:is_hypertext_mime
Unexecuted instantiation: htstools.c:is_hypertext_mime
Unexecuted instantiation: htslib.c:is_hypertext_mime
Unexecuted instantiation: htsbase.c:is_hypertext_mime
Unexecuted instantiation: htsmime.c:is_hypertext_mime
Unexecuted instantiation: htsbauth.c:is_hypertext_mime
Unexecuted instantiation: htspsl.c:is_hypertext_mime
Unexecuted instantiation: htsbundle.c:is_hypertext_mime
Unexecuted instantiation: htssecret.c:is_hypertext_mime
Unexecuted instantiation: htscore.c:is_hypertext_mime
Unexecuted instantiation: htshash.c:is_hypertext_mime
Unexecuted instantiation: htsmhtml.c:is_hypertext_mime
Unexecuted instantiation: htsusercmd.c:is_hypertext_mime
Unexecuted instantiation: htschanges.c:is_hypertext_mime
Unexecuted instantiation: htscache.c:is_hypertext_mime
Unexecuted instantiation: htsback.c:is_hypertext_mime
Unexecuted instantiation: htsftp.c:is_hypertext_mime
Unexecuted instantiation: htscrashtest.c:is_hypertext_mime
Unexecuted instantiation: htsdns.c:is_hypertext_mime
Unexecuted instantiation: htsname.c:is_hypertext_mime
Unexecuted instantiation: htsmirror.c:is_hypertext_mime
Unexecuted instantiation: htsparse.c:is_hypertext_mime
Unexecuted instantiation: htssinglefile.c:is_hypertext_mime
Unexecuted instantiation: htswizard.c:is_hypertext_mime
Unexecuted instantiation: htsfilters.c:is_hypertext_mime
Unexecuted instantiation: htsrobots.c:is_hypertext_mime
Unexecuted instantiation: htsindex.c:is_hypertext_mime
Unexecuted instantiation: htslines.c:is_hypertext_mime
Unexecuted instantiation: htsfetch.c:is_hypertext_mime
Unexecuted instantiation: htswarc.c:is_hypertext_mime
Unexecuted instantiation: htscoremain.c:is_hypertext_mime
Unexecuted instantiation: htsalias.c:is_hypertext_mime
Unexecuted instantiation: htshelp.c:is_hypertext_mime
Unexecuted instantiation: htscatchurl.c:is_hypertext_mime
Unexecuted instantiation: htscookiefile.c:is_hypertext_mime
Unexecuted instantiation: htsproxy.c:is_hypertext_mime
Unexecuted instantiation: htszlib.c:is_hypertext_mime
Unexecuted instantiation: htsconcat.c:is_hypertext_mime
Unexecuted instantiation: htsmodules.c:is_hypertext_mime
Unexecuted instantiation: htsescape.c:is_hypertext_mime
Unexecuted instantiation: htssniff.c:is_hypertext_mime
Unexecuted instantiation: htsselftest.c:is_hypertext_mime
Unexecuted instantiation: htsback_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsselftest_util.c:is_hypertext_mime
Unexecuted instantiation: htsbase_selftest.c:is_hypertext_mime
Unexecuted instantiation: htscache_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsckd_selftest.c:is_hypertext_mime
Unexecuted instantiation: htscharset_selftest.c:is_hypertext_mime
Unexecuted instantiation: htscmdline_selftest.c:is_hypertext_mime
Unexecuted instantiation: htscookie_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsdns_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsfetch_selftest.c:is_hypertext_mime
Unexecuted instantiation: htspsl_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsindex_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsbundle_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsfilters_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsheader_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsio_selftest.c:is_hypertext_mime
Unexecuted instantiation: htslib_selftest.c:is_hypertext_mime
Unexecuted instantiation: htswrap.c:is_hypertext_mime
Unexecuted instantiation: htslines_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsmime_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsname_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsnet_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsopt_selftest.c:is_hypertext_mime
Unexecuted instantiation: htsparse_selftest.c:is_hypertext_mime
Unexecuted instantiation: htstools_selftest.c:is_hypertext_mime
Unexecuted instantiation: htswarc_selftest.c:is_hypertext_mime
Unexecuted instantiation: htswizard_selftest.c:is_hypertext_mime
1205
1206
// check if (mime, file) is JavaScript, guessing from the extension as above
1207
HTS_STATIC int is_javascript_mime(httrackp *opt, const char *mime,
1208
0
                                  const char *file) {
1209
0
  if (is_javascript_mime_type(mime))
1210
0
    return 1;
1211
0
  if (file != NULL && file[0] != '\0' && may_unknown(opt, mime)) {
1212
0
    char guessed[256];
1213
1214
0
    guessed[0] = '\0';
1215
0
    if (!guess_httptype_sized(opt, guessed, sizeof(guessed), file))
1216
0
      return 0;
1217
0
    return is_javascript_mime_type(guessed);
1218
0
  }
1219
0
  return 0;
1220
0
}
Unexecuted instantiation: htssitemap.c:is_javascript_mime
Unexecuted instantiation: htscodec.c:is_javascript_mime
Unexecuted instantiation: htstools.c:is_javascript_mime
Unexecuted instantiation: htslib.c:is_javascript_mime
Unexecuted instantiation: htsbase.c:is_javascript_mime
Unexecuted instantiation: htsmime.c:is_javascript_mime
Unexecuted instantiation: htsbauth.c:is_javascript_mime
Unexecuted instantiation: htspsl.c:is_javascript_mime
Unexecuted instantiation: htsbundle.c:is_javascript_mime
Unexecuted instantiation: htssecret.c:is_javascript_mime
Unexecuted instantiation: htscore.c:is_javascript_mime
Unexecuted instantiation: htshash.c:is_javascript_mime
Unexecuted instantiation: htsmhtml.c:is_javascript_mime
Unexecuted instantiation: htsusercmd.c:is_javascript_mime
Unexecuted instantiation: htschanges.c:is_javascript_mime
Unexecuted instantiation: htscache.c:is_javascript_mime
Unexecuted instantiation: htsback.c:is_javascript_mime
Unexecuted instantiation: htsftp.c:is_javascript_mime
Unexecuted instantiation: htscrashtest.c:is_javascript_mime
Unexecuted instantiation: htsdns.c:is_javascript_mime
Unexecuted instantiation: htsname.c:is_javascript_mime
Unexecuted instantiation: htsmirror.c:is_javascript_mime
Unexecuted instantiation: htsparse.c:is_javascript_mime
Unexecuted instantiation: htssinglefile.c:is_javascript_mime
Unexecuted instantiation: htswizard.c:is_javascript_mime
Unexecuted instantiation: htsfilters.c:is_javascript_mime
Unexecuted instantiation: htsrobots.c:is_javascript_mime
Unexecuted instantiation: htsindex.c:is_javascript_mime
Unexecuted instantiation: htslines.c:is_javascript_mime
Unexecuted instantiation: htsfetch.c:is_javascript_mime
Unexecuted instantiation: htswarc.c:is_javascript_mime
Unexecuted instantiation: htscoremain.c:is_javascript_mime
Unexecuted instantiation: htsalias.c:is_javascript_mime
Unexecuted instantiation: htshelp.c:is_javascript_mime
Unexecuted instantiation: htscatchurl.c:is_javascript_mime
Unexecuted instantiation: htscookiefile.c:is_javascript_mime
Unexecuted instantiation: htsproxy.c:is_javascript_mime
Unexecuted instantiation: htszlib.c:is_javascript_mime
Unexecuted instantiation: htsconcat.c:is_javascript_mime
Unexecuted instantiation: htsmodules.c:is_javascript_mime
Unexecuted instantiation: htsescape.c:is_javascript_mime
Unexecuted instantiation: htssniff.c:is_javascript_mime
Unexecuted instantiation: htsselftest.c:is_javascript_mime
Unexecuted instantiation: htsback_selftest.c:is_javascript_mime
Unexecuted instantiation: htsselftest_util.c:is_javascript_mime
Unexecuted instantiation: htsbase_selftest.c:is_javascript_mime
Unexecuted instantiation: htscache_selftest.c:is_javascript_mime
Unexecuted instantiation: htsckd_selftest.c:is_javascript_mime
Unexecuted instantiation: htscharset_selftest.c:is_javascript_mime
Unexecuted instantiation: htscmdline_selftest.c:is_javascript_mime
Unexecuted instantiation: htscookie_selftest.c:is_javascript_mime
Unexecuted instantiation: htsdns_selftest.c:is_javascript_mime
Unexecuted instantiation: htsfetch_selftest.c:is_javascript_mime
Unexecuted instantiation: htspsl_selftest.c:is_javascript_mime
Unexecuted instantiation: htsindex_selftest.c:is_javascript_mime
Unexecuted instantiation: htsbundle_selftest.c:is_javascript_mime
Unexecuted instantiation: htsfilters_selftest.c:is_javascript_mime
Unexecuted instantiation: htsheader_selftest.c:is_javascript_mime
Unexecuted instantiation: htsio_selftest.c:is_javascript_mime
Unexecuted instantiation: htslib_selftest.c:is_javascript_mime
Unexecuted instantiation: htswrap.c:is_javascript_mime
Unexecuted instantiation: htslines_selftest.c:is_javascript_mime
Unexecuted instantiation: htsmime_selftest.c:is_javascript_mime
Unexecuted instantiation: htsname_selftest.c:is_javascript_mime
Unexecuted instantiation: htsnet_selftest.c:is_javascript_mime
Unexecuted instantiation: htsopt_selftest.c:is_javascript_mime
Unexecuted instantiation: htsparse_selftest.c:is_javascript_mime
Unexecuted instantiation: htstools_selftest.c:is_javascript_mime
Unexecuted instantiation: htswarc_selftest.c:is_javascript_mime
Unexecuted instantiation: htswizard_selftest.c:is_javascript_mime
1221
1222
// check if (mime, file) is an m3u playlist, guessing from the extension
1223
HTS_STATIC int is_playlist_mime(httrackp *opt, const char *mime,
1224
0
                                const char *file) {
1225
0
  if (is_playlist_mime_type(mime))
1226
0
    return 1;
1227
0
  if (file != NULL && file[0] != '\0' && may_unknown(opt, mime)) {
1228
0
    char guessed[256];
1229
1230
0
    guessed[0] = '\0';
1231
0
    if (!guess_httptype_sized(opt, guessed, sizeof(guessed), file))
1232
0
      return 0;
1233
0
    return is_playlist_mime_type(guessed);
1234
0
  }
1235
0
  return 0;
1236
0
}
Unexecuted instantiation: htssitemap.c:is_playlist_mime
Unexecuted instantiation: htscodec.c:is_playlist_mime
Unexecuted instantiation: htstools.c:is_playlist_mime
Unexecuted instantiation: htslib.c:is_playlist_mime
Unexecuted instantiation: htsbase.c:is_playlist_mime
Unexecuted instantiation: htsmime.c:is_playlist_mime
Unexecuted instantiation: htsbauth.c:is_playlist_mime
Unexecuted instantiation: htspsl.c:is_playlist_mime
Unexecuted instantiation: htsbundle.c:is_playlist_mime
Unexecuted instantiation: htssecret.c:is_playlist_mime
Unexecuted instantiation: htscore.c:is_playlist_mime
Unexecuted instantiation: htshash.c:is_playlist_mime
Unexecuted instantiation: htsmhtml.c:is_playlist_mime
Unexecuted instantiation: htsusercmd.c:is_playlist_mime
Unexecuted instantiation: htschanges.c:is_playlist_mime
Unexecuted instantiation: htscache.c:is_playlist_mime
Unexecuted instantiation: htsback.c:is_playlist_mime
Unexecuted instantiation: htsftp.c:is_playlist_mime
Unexecuted instantiation: htscrashtest.c:is_playlist_mime
Unexecuted instantiation: htsdns.c:is_playlist_mime
Unexecuted instantiation: htsname.c:is_playlist_mime
Unexecuted instantiation: htsmirror.c:is_playlist_mime
Unexecuted instantiation: htsparse.c:is_playlist_mime
Unexecuted instantiation: htssinglefile.c:is_playlist_mime
Unexecuted instantiation: htswizard.c:is_playlist_mime
Unexecuted instantiation: htsfilters.c:is_playlist_mime
Unexecuted instantiation: htsrobots.c:is_playlist_mime
Unexecuted instantiation: htsindex.c:is_playlist_mime
Unexecuted instantiation: htslines.c:is_playlist_mime
Unexecuted instantiation: htsfetch.c:is_playlist_mime
Unexecuted instantiation: htswarc.c:is_playlist_mime
Unexecuted instantiation: htscoremain.c:is_playlist_mime
Unexecuted instantiation: htsalias.c:is_playlist_mime
Unexecuted instantiation: htshelp.c:is_playlist_mime
Unexecuted instantiation: htscatchurl.c:is_playlist_mime
Unexecuted instantiation: htscookiefile.c:is_playlist_mime
Unexecuted instantiation: htsproxy.c:is_playlist_mime
Unexecuted instantiation: htszlib.c:is_playlist_mime
Unexecuted instantiation: htsconcat.c:is_playlist_mime
Unexecuted instantiation: htsmodules.c:is_playlist_mime
Unexecuted instantiation: htsescape.c:is_playlist_mime
Unexecuted instantiation: htssniff.c:is_playlist_mime
Unexecuted instantiation: htsselftest.c:is_playlist_mime
Unexecuted instantiation: htsback_selftest.c:is_playlist_mime
Unexecuted instantiation: htsselftest_util.c:is_playlist_mime
Unexecuted instantiation: htsbase_selftest.c:is_playlist_mime
Unexecuted instantiation: htscache_selftest.c:is_playlist_mime
Unexecuted instantiation: htsckd_selftest.c:is_playlist_mime
Unexecuted instantiation: htscharset_selftest.c:is_playlist_mime
Unexecuted instantiation: htscmdline_selftest.c:is_playlist_mime
Unexecuted instantiation: htscookie_selftest.c:is_playlist_mime
Unexecuted instantiation: htsdns_selftest.c:is_playlist_mime
Unexecuted instantiation: htsfetch_selftest.c:is_playlist_mime
Unexecuted instantiation: htspsl_selftest.c:is_playlist_mime
Unexecuted instantiation: htsindex_selftest.c:is_playlist_mime
Unexecuted instantiation: htsbundle_selftest.c:is_playlist_mime
Unexecuted instantiation: htsfilters_selftest.c:is_playlist_mime
Unexecuted instantiation: htsheader_selftest.c:is_playlist_mime
Unexecuted instantiation: htsio_selftest.c:is_playlist_mime
Unexecuted instantiation: htslib_selftest.c:is_playlist_mime
Unexecuted instantiation: htswrap.c:is_playlist_mime
Unexecuted instantiation: htslines_selftest.c:is_playlist_mime
Unexecuted instantiation: htsmime_selftest.c:is_playlist_mime
Unexecuted instantiation: htsname_selftest.c:is_playlist_mime
Unexecuted instantiation: htsnet_selftest.c:is_playlist_mime
Unexecuted instantiation: htsopt_selftest.c:is_playlist_mime
Unexecuted instantiation: htsparse_selftest.c:is_playlist_mime
Unexecuted instantiation: htstools_selftest.c:is_playlist_mime
Unexecuted instantiation: htswarc_selftest.c:is_playlist_mime
Unexecuted instantiation: htswizard_selftest.c:is_playlist_mime
1237
1238
// check if (mime, file) might be "false" hypertext
1239
HTS_STATIC int may_be_hypertext_mime(httrackp * opt, const char *mime,
1240
0
                                     const char *file) {
1241
0
  if (may_be_hypertext_mime__(mime))
1242
0
    return 1;
1243
0
  if (file != NULL && file[0] != '\0' && may_unknown(opt, mime)) {
1244
0
    char guessed[256];
1245
1246
0
    guessed[0] = '\0';
1247
0
    if (!guess_httptype_sized(opt, guessed, sizeof(guessed), file))
1248
0
      return 0;
1249
0
    return may_be_hypertext_mime__(guessed);
1250
0
  }
1251
0
  return 0;
1252
0
}
Unexecuted instantiation: htssitemap.c:may_be_hypertext_mime
Unexecuted instantiation: htscodec.c:may_be_hypertext_mime
Unexecuted instantiation: htstools.c:may_be_hypertext_mime
Unexecuted instantiation: htslib.c:may_be_hypertext_mime
Unexecuted instantiation: htsbase.c:may_be_hypertext_mime
Unexecuted instantiation: htsmime.c:may_be_hypertext_mime
Unexecuted instantiation: htsbauth.c:may_be_hypertext_mime
Unexecuted instantiation: htspsl.c:may_be_hypertext_mime
Unexecuted instantiation: htsbundle.c:may_be_hypertext_mime
Unexecuted instantiation: htssecret.c:may_be_hypertext_mime
Unexecuted instantiation: htscore.c:may_be_hypertext_mime
Unexecuted instantiation: htshash.c:may_be_hypertext_mime
Unexecuted instantiation: htsmhtml.c:may_be_hypertext_mime
Unexecuted instantiation: htsusercmd.c:may_be_hypertext_mime
Unexecuted instantiation: htschanges.c:may_be_hypertext_mime
Unexecuted instantiation: htscache.c:may_be_hypertext_mime
Unexecuted instantiation: htsback.c:may_be_hypertext_mime
Unexecuted instantiation: htsftp.c:may_be_hypertext_mime
Unexecuted instantiation: htscrashtest.c:may_be_hypertext_mime
Unexecuted instantiation: htsdns.c:may_be_hypertext_mime
Unexecuted instantiation: htsname.c:may_be_hypertext_mime
Unexecuted instantiation: htsmirror.c:may_be_hypertext_mime
Unexecuted instantiation: htsparse.c:may_be_hypertext_mime
Unexecuted instantiation: htssinglefile.c:may_be_hypertext_mime
Unexecuted instantiation: htswizard.c:may_be_hypertext_mime
Unexecuted instantiation: htsfilters.c:may_be_hypertext_mime
Unexecuted instantiation: htsrobots.c:may_be_hypertext_mime
Unexecuted instantiation: htsindex.c:may_be_hypertext_mime
Unexecuted instantiation: htslines.c:may_be_hypertext_mime
Unexecuted instantiation: htsfetch.c:may_be_hypertext_mime
Unexecuted instantiation: htswarc.c:may_be_hypertext_mime
Unexecuted instantiation: htscoremain.c:may_be_hypertext_mime
Unexecuted instantiation: htsalias.c:may_be_hypertext_mime
Unexecuted instantiation: htshelp.c:may_be_hypertext_mime
Unexecuted instantiation: htscatchurl.c:may_be_hypertext_mime
Unexecuted instantiation: htscookiefile.c:may_be_hypertext_mime
Unexecuted instantiation: htsproxy.c:may_be_hypertext_mime
Unexecuted instantiation: htszlib.c:may_be_hypertext_mime
Unexecuted instantiation: htsconcat.c:may_be_hypertext_mime
Unexecuted instantiation: htsmodules.c:may_be_hypertext_mime
Unexecuted instantiation: htsescape.c:may_be_hypertext_mime
Unexecuted instantiation: htssniff.c:may_be_hypertext_mime
Unexecuted instantiation: htsselftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsback_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsselftest_util.c:may_be_hypertext_mime
Unexecuted instantiation: htsbase_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htscache_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsckd_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htscharset_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htscmdline_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htscookie_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsdns_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsfetch_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htspsl_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsindex_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsbundle_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsfilters_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsheader_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsio_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htslib_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htswrap.c:may_be_hypertext_mime
Unexecuted instantiation: htslines_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsmime_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsname_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsnet_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsopt_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htsparse_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htstools_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htswarc_selftest.c:may_be_hypertext_mime
Unexecuted instantiation: htswizard_selftest.c:may_be_hypertext_mime
1253
1254
// compare (mime, file) with reference
1255
HTS_STATIC HTS_CHECK_RESULT int compare_mime(httrackp *opt, const char *mime,
1256
                                             const char *file,
1257
0
                                             const char *reference) {
1258
0
  if (is_hypertext_mime__(mime) || may_be_hypertext_mime__(mime))
1259
0
    return hts_streq_ci(mime, reference);
1260
0
  if (file != NULL && file[0] != '\0' && may_unknown(opt, mime)) {
1261
0
    char guessed[256];
1262
1263
0
    guessed[0] = '\0';
1264
0
    if (!guess_httptype_sized(opt, guessed, sizeof(guessed), file))
1265
0
      return 0;
1266
0
    return hts_streq_ci(guessed, reference);
1267
0
  }
1268
0
  return 0;
1269
0
}
Unexecuted instantiation: htssitemap.c:compare_mime
Unexecuted instantiation: htscodec.c:compare_mime
Unexecuted instantiation: htstools.c:compare_mime
Unexecuted instantiation: htslib.c:compare_mime
Unexecuted instantiation: htsbase.c:compare_mime
Unexecuted instantiation: htsmime.c:compare_mime
Unexecuted instantiation: htsbauth.c:compare_mime
Unexecuted instantiation: htspsl.c:compare_mime
Unexecuted instantiation: htsbundle.c:compare_mime
Unexecuted instantiation: htssecret.c:compare_mime
Unexecuted instantiation: htscore.c:compare_mime
Unexecuted instantiation: htshash.c:compare_mime
Unexecuted instantiation: htsmhtml.c:compare_mime
Unexecuted instantiation: htsusercmd.c:compare_mime
Unexecuted instantiation: htschanges.c:compare_mime
Unexecuted instantiation: htscache.c:compare_mime
Unexecuted instantiation: htsback.c:compare_mime
Unexecuted instantiation: htsftp.c:compare_mime
Unexecuted instantiation: htscrashtest.c:compare_mime
Unexecuted instantiation: htsdns.c:compare_mime
Unexecuted instantiation: htsname.c:compare_mime
Unexecuted instantiation: htsmirror.c:compare_mime
Unexecuted instantiation: htsparse.c:compare_mime
Unexecuted instantiation: htssinglefile.c:compare_mime
Unexecuted instantiation: htswizard.c:compare_mime
Unexecuted instantiation: htsfilters.c:compare_mime
Unexecuted instantiation: htsrobots.c:compare_mime
Unexecuted instantiation: htsindex.c:compare_mime
Unexecuted instantiation: htslines.c:compare_mime
Unexecuted instantiation: htsfetch.c:compare_mime
Unexecuted instantiation: htswarc.c:compare_mime
Unexecuted instantiation: htscoremain.c:compare_mime
Unexecuted instantiation: htsalias.c:compare_mime
Unexecuted instantiation: htshelp.c:compare_mime
Unexecuted instantiation: htscatchurl.c:compare_mime
Unexecuted instantiation: htscookiefile.c:compare_mime
Unexecuted instantiation: htsproxy.c:compare_mime
Unexecuted instantiation: htszlib.c:compare_mime
Unexecuted instantiation: htsconcat.c:compare_mime
Unexecuted instantiation: htsmodules.c:compare_mime
Unexecuted instantiation: htsescape.c:compare_mime
Unexecuted instantiation: htssniff.c:compare_mime
Unexecuted instantiation: htsselftest.c:compare_mime
Unexecuted instantiation: htsback_selftest.c:compare_mime
Unexecuted instantiation: htsselftest_util.c:compare_mime
Unexecuted instantiation: htsbase_selftest.c:compare_mime
Unexecuted instantiation: htscache_selftest.c:compare_mime
Unexecuted instantiation: htsckd_selftest.c:compare_mime
Unexecuted instantiation: htscharset_selftest.c:compare_mime
Unexecuted instantiation: htscmdline_selftest.c:compare_mime
Unexecuted instantiation: htscookie_selftest.c:compare_mime
Unexecuted instantiation: htsdns_selftest.c:compare_mime
Unexecuted instantiation: htsfetch_selftest.c:compare_mime
Unexecuted instantiation: htspsl_selftest.c:compare_mime
Unexecuted instantiation: htsindex_selftest.c:compare_mime
Unexecuted instantiation: htsbundle_selftest.c:compare_mime
Unexecuted instantiation: htsfilters_selftest.c:compare_mime
Unexecuted instantiation: htsheader_selftest.c:compare_mime
Unexecuted instantiation: htsio_selftest.c:compare_mime
Unexecuted instantiation: htslib_selftest.c:compare_mime
Unexecuted instantiation: htswrap.c:compare_mime
Unexecuted instantiation: htslines_selftest.c:compare_mime
Unexecuted instantiation: htsmime_selftest.c:compare_mime
Unexecuted instantiation: htsname_selftest.c:compare_mime
Unexecuted instantiation: htsnet_selftest.c:compare_mime
Unexecuted instantiation: htsopt_selftest.c:compare_mime
Unexecuted instantiation: htsparse_selftest.c:compare_mime
Unexecuted instantiation: htstools_selftest.c:compare_mime
Unexecuted instantiation: htswarc_selftest.c:compare_mime
Unexecuted instantiation: htswizard_selftest.c:compare_mime
1270
1271
#endif
1272
1273
// returns (size_t) -1 upon error
1274
0
static HTS_UNUSED size_t llint_to_size_t(LLint o) {
1275
0
  const size_t so = (size_t) o;
1276
0
  if ((LLint) so == o) {
1277
0
    return so;
1278
0
  } else {
1279
0
    return (size_t) -1;
1280
0
  }
1281
0
}
Unexecuted instantiation: htssitemap.c:llint_to_size_t
Unexecuted instantiation: htscodec.c:llint_to_size_t
Unexecuted instantiation: htstools.c:llint_to_size_t
Unexecuted instantiation: htslib.c:llint_to_size_t
Unexecuted instantiation: htsbase.c:llint_to_size_t
Unexecuted instantiation: htsmime.c:llint_to_size_t
Unexecuted instantiation: htsbauth.c:llint_to_size_t
Unexecuted instantiation: htspsl.c:llint_to_size_t
Unexecuted instantiation: htsbundle.c:llint_to_size_t
Unexecuted instantiation: htssecret.c:llint_to_size_t
Unexecuted instantiation: htscore.c:llint_to_size_t
Unexecuted instantiation: htshash.c:llint_to_size_t
Unexecuted instantiation: htsmhtml.c:llint_to_size_t
Unexecuted instantiation: htsusercmd.c:llint_to_size_t
Unexecuted instantiation: htschanges.c:llint_to_size_t
Unexecuted instantiation: htscache.c:llint_to_size_t
Unexecuted instantiation: htsback.c:llint_to_size_t
Unexecuted instantiation: htsftp.c:llint_to_size_t
Unexecuted instantiation: htscrashtest.c:llint_to_size_t
Unexecuted instantiation: htsdns.c:llint_to_size_t
Unexecuted instantiation: htsname.c:llint_to_size_t
Unexecuted instantiation: htsmirror.c:llint_to_size_t
Unexecuted instantiation: htsparse.c:llint_to_size_t
Unexecuted instantiation: htssinglefile.c:llint_to_size_t
Unexecuted instantiation: htswizard.c:llint_to_size_t
Unexecuted instantiation: htsfilters.c:llint_to_size_t
Unexecuted instantiation: htsrobots.c:llint_to_size_t
Unexecuted instantiation: htsindex.c:llint_to_size_t
Unexecuted instantiation: htslines.c:llint_to_size_t
Unexecuted instantiation: htsfetch.c:llint_to_size_t
Unexecuted instantiation: htswarc.c:llint_to_size_t
Unexecuted instantiation: htscoremain.c:llint_to_size_t
Unexecuted instantiation: htsalias.c:llint_to_size_t
Unexecuted instantiation: htshelp.c:llint_to_size_t
Unexecuted instantiation: htscatchurl.c:llint_to_size_t
Unexecuted instantiation: htscookiefile.c:llint_to_size_t
Unexecuted instantiation: htsproxy.c:llint_to_size_t
Unexecuted instantiation: htszlib.c:llint_to_size_t
Unexecuted instantiation: htsconcat.c:llint_to_size_t
Unexecuted instantiation: htsmodules.c:llint_to_size_t
Unexecuted instantiation: htsescape.c:llint_to_size_t
Unexecuted instantiation: htssniff.c:llint_to_size_t
Unexecuted instantiation: htsselftest.c:llint_to_size_t
Unexecuted instantiation: htsback_selftest.c:llint_to_size_t
Unexecuted instantiation: htsselftest_util.c:llint_to_size_t
Unexecuted instantiation: htsbase_selftest.c:llint_to_size_t
Unexecuted instantiation: htscache_selftest.c:llint_to_size_t
Unexecuted instantiation: htsckd_selftest.c:llint_to_size_t
Unexecuted instantiation: htscharset_selftest.c:llint_to_size_t
Unexecuted instantiation: htscmdline_selftest.c:llint_to_size_t
Unexecuted instantiation: htscookie_selftest.c:llint_to_size_t
Unexecuted instantiation: htsdns_selftest.c:llint_to_size_t
Unexecuted instantiation: htsfetch_selftest.c:llint_to_size_t
Unexecuted instantiation: htspsl_selftest.c:llint_to_size_t
Unexecuted instantiation: htsindex_selftest.c:llint_to_size_t
Unexecuted instantiation: htsbundle_selftest.c:llint_to_size_t
Unexecuted instantiation: htsfilters_selftest.c:llint_to_size_t
Unexecuted instantiation: htsheader_selftest.c:llint_to_size_t
Unexecuted instantiation: htsio_selftest.c:llint_to_size_t
Unexecuted instantiation: htslib_selftest.c:llint_to_size_t
Unexecuted instantiation: htswrap.c:llint_to_size_t
Unexecuted instantiation: htslines_selftest.c:llint_to_size_t
Unexecuted instantiation: htsmime_selftest.c:llint_to_size_t
Unexecuted instantiation: htsname_selftest.c:llint_to_size_t
Unexecuted instantiation: htsnet_selftest.c:llint_to_size_t
Unexecuted instantiation: htsopt_selftest.c:llint_to_size_t
Unexecuted instantiation: htsparse_selftest.c:llint_to_size_t
Unexecuted instantiation: htstools_selftest.c:llint_to_size_t
Unexecuted instantiation: htswarc_selftest.c:llint_to_size_t
Unexecuted instantiation: htswizard_selftest.c:llint_to_size_t
1282
1283
/* Capacity for @p used bytes plus @p extra more plus @p slack spare;
1284
   (size_t) -1 if the total exceeds (size_t) -2 or @p extra is negative
1285
   (llint_to_size_t() would map that to a huge valid-looking size). */
1286
static HTS_UNUSED size_t llint_grow_size_t(size_t used, LLint extra,
1287
0
                                           size_t slack) {
1288
0
  const size_t max = (size_t) -2; /* (size_t) -1 is the error value */
1289
0
  const size_t e = extra >= 0 ? llint_to_size_t(extra) : (size_t) -1;
1290
1291
0
  if (e == (size_t) -1 || used > max || slack > max - used ||
1292
0
      e > max - used - slack) {
1293
0
    return (size_t) -1;
1294
0
  }
1295
0
  return used + e + slack;
1296
0
}
Unexecuted instantiation: htssitemap.c:llint_grow_size_t
Unexecuted instantiation: htscodec.c:llint_grow_size_t
Unexecuted instantiation: htstools.c:llint_grow_size_t
Unexecuted instantiation: htslib.c:llint_grow_size_t
Unexecuted instantiation: htsbase.c:llint_grow_size_t
Unexecuted instantiation: htsmime.c:llint_grow_size_t
Unexecuted instantiation: htsbauth.c:llint_grow_size_t
Unexecuted instantiation: htspsl.c:llint_grow_size_t
Unexecuted instantiation: htsbundle.c:llint_grow_size_t
Unexecuted instantiation: htssecret.c:llint_grow_size_t
Unexecuted instantiation: htscore.c:llint_grow_size_t
Unexecuted instantiation: htshash.c:llint_grow_size_t
Unexecuted instantiation: htsmhtml.c:llint_grow_size_t
Unexecuted instantiation: htsusercmd.c:llint_grow_size_t
Unexecuted instantiation: htschanges.c:llint_grow_size_t
Unexecuted instantiation: htscache.c:llint_grow_size_t
Unexecuted instantiation: htsback.c:llint_grow_size_t
Unexecuted instantiation: htsftp.c:llint_grow_size_t
Unexecuted instantiation: htscrashtest.c:llint_grow_size_t
Unexecuted instantiation: htsdns.c:llint_grow_size_t
Unexecuted instantiation: htsname.c:llint_grow_size_t
Unexecuted instantiation: htsmirror.c:llint_grow_size_t
Unexecuted instantiation: htsparse.c:llint_grow_size_t
Unexecuted instantiation: htssinglefile.c:llint_grow_size_t
Unexecuted instantiation: htswizard.c:llint_grow_size_t
Unexecuted instantiation: htsfilters.c:llint_grow_size_t
Unexecuted instantiation: htsrobots.c:llint_grow_size_t
Unexecuted instantiation: htsindex.c:llint_grow_size_t
Unexecuted instantiation: htslines.c:llint_grow_size_t
Unexecuted instantiation: htsfetch.c:llint_grow_size_t
Unexecuted instantiation: htswarc.c:llint_grow_size_t
Unexecuted instantiation: htscoremain.c:llint_grow_size_t
Unexecuted instantiation: htsalias.c:llint_grow_size_t
Unexecuted instantiation: htshelp.c:llint_grow_size_t
Unexecuted instantiation: htscatchurl.c:llint_grow_size_t
Unexecuted instantiation: htscookiefile.c:llint_grow_size_t
Unexecuted instantiation: htsproxy.c:llint_grow_size_t
Unexecuted instantiation: htszlib.c:llint_grow_size_t
Unexecuted instantiation: htsconcat.c:llint_grow_size_t
Unexecuted instantiation: htsmodules.c:llint_grow_size_t
Unexecuted instantiation: htsescape.c:llint_grow_size_t
Unexecuted instantiation: htssniff.c:llint_grow_size_t
Unexecuted instantiation: htsselftest.c:llint_grow_size_t
Unexecuted instantiation: htsback_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsselftest_util.c:llint_grow_size_t
Unexecuted instantiation: htsbase_selftest.c:llint_grow_size_t
Unexecuted instantiation: htscache_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsckd_selftest.c:llint_grow_size_t
Unexecuted instantiation: htscharset_selftest.c:llint_grow_size_t
Unexecuted instantiation: htscmdline_selftest.c:llint_grow_size_t
Unexecuted instantiation: htscookie_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsdns_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsfetch_selftest.c:llint_grow_size_t
Unexecuted instantiation: htspsl_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsindex_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsbundle_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsfilters_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsheader_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsio_selftest.c:llint_grow_size_t
Unexecuted instantiation: htslib_selftest.c:llint_grow_size_t
Unexecuted instantiation: htswrap.c:llint_grow_size_t
Unexecuted instantiation: htslines_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsmime_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsname_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsnet_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsopt_selftest.c:llint_grow_size_t
Unexecuted instantiation: htsparse_selftest.c:llint_grow_size_t
Unexecuted instantiation: htstools_selftest.c:llint_grow_size_t
Unexecuted instantiation: htswarc_selftest.c:llint_grow_size_t
Unexecuted instantiation: htswizard_selftest.c:llint_grow_size_t
1297
1298
/* dirent() compatibility */
1299
#ifdef _WIN32
1300
/* Holds a UTF-8 d_name: MAX_PATH (260) UTF-16 units expand to <=3 bytes each.
1301
   Windows-only struct, ABI free to break. */
1302
#define HTS_DIRENT_SIZE 1024
1303
struct dirent {
1304
  ino_t d_ino;                  /* ignored */
1305
  off_t d_off;                  /* ignored */
1306
  unsigned short d_reclen;      /* ignored */
1307
  unsigned char d_type;         /* ignored */
1308
  char d_name[HTS_DIRENT_SIZE]; /* filename */
1309
};
1310
typedef struct DIR DIR;
1311
struct DIR {
1312
  HANDLE h;
1313
  struct dirent entry;
1314
  char *name;
1315
};
1316
1317
HTS_CHECK_RESULT DIR *opendir(const char *name);
1318
HTS_CHECK_RESULT struct dirent *readdir(DIR *dir);
1319
int closedir(DIR * dir);
1320
#endif
1321
1322
/* Like fil_normalized(), but first drops query keys in STRIP (comma-separated,
1323
   "*" = all); STRIP NULL/empty behaves exactly like fil_normalized(). */
1324
char *fil_normalized_filtered(const char *source, char *dest,
1325
                              const char *strip);
1326
1327
/* As fil_normalized_filtered(), but DO_SLASH/DO_QUERY gate the // collapse and
1328
   the query-argument sort independently (the urlhack sub-flags). */
1329
char *fil_normalized_filtered_ex(const char *source, char *dest,
1330
                                 const char *strip, int do_slash, int do_query);
1331
1332
/* For URL ADR/FIL, return (in DEST) the comma keylist to strip from the
1333
   '\n'-separated "[pattern=]keys" RULES (patterns matched on host/path via
1334
   strjoker, last wins); NULL if none match. Feeds fil_normalized_filtered(). */
1335
HTS_CHECK_RESULT const char *hts_query_strip_keys(const char *rules,
1336
                                                  const char *adr,
1337
                                                  const char *fil,
1338
                                                  hts_buf dest);
1339
1340
/* Is KEY in the comma list STRIP? Tokens are space-trimmed and
1341
   case-sensitive, and "*" matches any key. */
1342
HTS_CHECK_RESULT hts_boolean hts_query_key_stripped(hts_span key,
1343
                                                    const char *strip);
1344
1345
/* Return the canonical host (length *CANONLEN) of the last RULES entry whose
1346
   aliases match HOST or FULL ("scheme://host"), or NULL. COLLAPSE_WWW ignores
1347
   a "www." prefix on both sides. */
1348
const char *hts_host_alias_match(const char *rules, const char *host,
1349
                                 const char *full, hts_boolean collapse_www,
1350
                                 size_t *canonlen);
1351
1352
/* The --host-alias rules of OPT, or NULL when the option was not given.
1353
   While a mirror runs it returns the hash's snapshot, so names match keys. */
1354
const char *hts_host_alias_rules(httrackp *opt);
1355
1356
/* Return the query-strip keys of OPT or NULL, like hts_host_alias_rules(). */
1357
const char *hts_strip_query_rules(httrackp *opt);
1358
1359
/* ADR with its host replaced by the canonical one, from the '\n'-separated
1360
   "alias[,alias...]=canonical" RULES (aliases matched with strjoker, last
1361
   wins). NOWWW matches the host with its www. prefix collapsed, as -%u keys it.
1362
   Chains are followed to their end, so the result is a fixpoint. Scheme and
1363
   credentials are kept. NULL when no rule applies, the mapping is a no-op, the
1364
   rules loop, or the result would not fit DEST. */
1365
const char *hts_host_alias(const char *rules, const char *adr,
1366
                           hts_boolean collapse_www, hts_buf dest);
1367
1368
/* Resolve like hts_host_alias, and set *SETTLED, when SETTLED is not NULL, to
1369
   whether the chain ended within the hop limit. Exposed for the -#test=spandiff
1370
   test. */
1371
HTS_CHECK_RESULT const char *hts_host_alias_resolve(const char *rules,
1372
                                                    const char *adr,
1373
                                                    hts_boolean collapse_www,
1374
                                                    hts_buf dest,
1375
                                                    hts_boolean *settled);
1376
1377
/* HTS_TRUE when OPT's url hacks collapse www.host onto host. */
1378
hts_boolean hts_host_alias_collapse_www(httrackp *opt);
1379
1380
/* Rewrite AF's host to its --host-alias canonical form, in place, and return
1381
   it. Idempotent; returns af->adr unchanged when no rule applies. */
1382
const char *hts_host_alias_fold(httrackp *opt, lien_adrfil *af);
1383
1384
/* HTS_TRUE if ADRA and ADRB name the same host once RULES are applied. */
1385
HTS_CHECK_RESULT hts_boolean hts_host_same_alias(const char *rules,
1386
                                                 const char *adra,
1387
                                                 const char *adrb,
1388
                                                 hts_boolean collapse_www);
1389
1390
/* First canonical host in RULES whose chain never ends ("a=b" plus "b=a"),
1391
   copied into DEST, or NULL if every chain settles. Those hosts are left
1392
   unaliased, so the engine reports them rather than picking a hop. */
1393
HTS_CHECK_RESULT const char *hts_host_alias_looping(const char *rules,
1394
                                                    hts_boolean collapse_www,
1395
                                                    hts_buf dest);
1396
1397
#endif