aboutsummaryrefslogtreecommitdiff
path: root/doc/man3/http_strncasecmp.3
blob: 0d5449faa5f21466557cf9b05241a30fbee606bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.TH HTTP_STRNCASECMP 3 2026-02-27 0.6.0 "libweb Library Reference"

.SH NAME
http_strncasecmp \- compare two strings ignoring case as "POSIX" locale

.SH SYNOPSIS
.LP
.nf
#include <libweb/http.h>
.P
char *http_strncasecmp(const char *\fIs1\fP, const char *\fIs2\fP, size_t \fIn\fP);
.fi

.SH DESCRIPTION
The
.IR http_strncasecmp ()
function compares two strings as done by
.IR strncasecmp (3),
but forces the use of the "POSIX" locale, so that characters are converted
to lowercase with
.IR tolower_l (3),
rather than relying on the locale configured by the system.

This makes
.IR http_strncasecmp ()
ideal to compare HTTP headers, which must be checked without case sensitivity
according to RFC 9110.

.SH RETURN VALUE
If the comparison is successful, zero is returned. If the two strings
are not equal (case ignored) or any of their characters could not be converted
by
.IR tolower_l(3) ,
a positive integer is returned.
Otherwise, a negative integer is returned.

.SH ERRORS
No errors are defined.

.SH SEE ALSO
.BR libweb_http (7),
.BR http_strcasecmp (3).

.B https://www.rfc-editor.org/rfc/rfc9110#name-field-names

.SH COPYRIGHT
Copyright (C) 2023-2026 libweb contributors
.P
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.