interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / url.h

54 lines · 1531 bytes Raw Blame History
1#ifndef URL_H
2#define URL_H
3
4struct strbuf;
5
6int is_url(const char *url);
7int is_urlschemechar(int first_flag, int ch);
8char *url_decode(const char *url);
9char *url_decode_mem(const char *url, int len);
10
11/*
12 * Similar to the url_decode_{,mem} methods above, but doesn't assume there
13 * is a scheme followed by a : at the start of the string. Instead, %-sequences
14 * before any : are also parsed.
15 */
16char *url_percent_decode(const char *encoded);
17
18char *url_decode_parameter_name(const char **query);
19char *url_decode_parameter_value(const char **query);
20
21void end_url_with_slash(struct strbuf *buf, const char *url);
22void str_end_url_with_slash(const char *url, char **dest);
23
24int url_is_local_not_ssh(const char *url);
25
26enum url_scheme {
27 URL_SCHEME_UNKNOWN = 0,
28 URL_SCHEME_LOCAL,
29 URL_SCHEME_FILE,
30 URL_SCHEME_SSH,
31 URL_SCHEME_GIT,
32};
33
34/*
35 * Identify the URL scheme by name. Returns URL_SCHEME_UNKNOWN
36 * if the name does not match any scheme that Git knows about.
37 */
38enum url_scheme url_get_scheme(const char *name);
39
40/*
41 * The set of unreserved characters as per STD66 (RFC3986) is
42 * '[A-Za-z0-9-._~]'. These characters are safe to appear in URI
43 * components without percent-encoding.
44 */
45int is_rfc3986_unreserved(char ch);
46
47/*
48 * This is a variant of is_rfc3986_unreserved() that treats uppercase
49 * letters as "reserved". This forces them to be percent-encoded, allowing
50 * 'Foo' (%46oo) and 'foo' (foo) to be distinct on case-folding filesystems.
51 */
52int is_casefolding_rfc3986_unreserved(char c);
53
54#endif /* URL_H */