Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-03-18 00:03:10 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-18 00:03:10 +0300
commit92c56da09683fa3331668adec073b6769da8f0b7 (patch)
treeb114e12cbf97692ce1e07af74616d8b38cda0408 /git-compat-util.h
parentaf5388d2ddb0bc7c22fbe698078f4ca07879d954 (diff)
parent5f2117b24f568ecc789c677748d70ccd538b16ba (diff)
Merge branch 'mc/credential-helper-www-authenticate'
Allow information carried on the WWW-AUthenticate header to be passed to the credential helpers. * mc/credential-helper-www-authenticate: credential: add WWW-Authenticate header to cred requests http: read HTTP WWW-Authenticate response headers t5563: add tests for basic and anoymous HTTP access
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index f77f986fbf..1e6592624d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1288,6 +1288,25 @@ static inline int skip_iprefix(const char *str, const char *prefix,
return 0;
}
+/*
+ * Like skip_prefix_mem, but compare case-insensitively. Note that the
+ * comparison is done via tolower(), so it is strictly ASCII (no multi-byte
+ * characters or locale-specific conversions).
+ */
+static inline int skip_iprefix_mem(const char *buf, size_t len,
+ const char *prefix,
+ const char **out, size_t *outlen)
+{
+ do {
+ if (!*prefix) {
+ *out = buf;
+ *outlen = len;
+ return 1;
+ }
+ } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));
+ return 0;
+}
+
static inline int strtoul_ui(char const *s, int base, unsigned int *result)
{
unsigned long ul;