diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-03-17 14:03:10 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-03-17 14:03:10 -0700 |
| commit | 92c56da09683fa3331668adec073b6769da8f0b7 (patch) | |
| tree | b114e12cbf97692ce1e07af74616d8b38cda0408 /git-compat-util.h | |
| parent | Merge branch 'jc/gpg-lazy-init' (diff) | |
| parent | credential: add WWW-Authenticate header to cred requests (diff) | |
| download | git-92c56da09683fa3331668adec073b6769da8f0b7.tar.gz git-92c56da09683fa3331668adec073b6769da8f0b7.zip | |
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.h | 19 |
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; |
