58 if (!src || (*src ==
'\0'))
129 struct Url *url = *ptr;
154 static const char *hex =
"0123456789ABCDEF";
161 while (src && *src && (buflen != 0))
163 if (strchr(
" /:&%=", *src))
169 *buf++ = hex[(*src >> 4) & 0xf];
170 *buf++ = hex[*src & 0xf];
201 if ((s[1] !=
'\0') && (s[2] !=
'\0') && isxdigit((
unsigned char) s[1]) &&
202 isxdigit((
unsigned char) s[2]) && (
hexval(s[1]) >= 0) && (
hexval(s[2]) >= 0))
314 if (!mutt_str_atous_full(ports, &num))
329 *(--url->
path) =
'/';
374 char str[256] = { 0 };
379 if (strchr(url->
host,
':'))
397 char str[256] = { 0 };
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
int mutt_map_get_value_n(const char *name, size_t len, const struct Mapping *map)
Lookup the constant for a string.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
#define MUTT_MEM_CALLOC(n, type)
Constants and macros for managing MIME encoding.
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
regmatch_t * mutt_prex_capture(enum Prex which, const char *str)
Match a precompiled regex against a string.
@ PREX_URL_QUERY_KEY_VAL_MATCH_VAL
key=[val]
@ PREX_URL_QUERY_KEY_VAL_MATCH_KEY
[key]=val
@ PREX_URL
[imaps://user:pass@example.com/INBOX?foo=bar]
@ PREX_URL_QUERY_KEY_VAL
https://example.com/?[q=foo]
@ PREX_URL_MATCH_USER
...//[user]:pass@...
@ PREX_URL_MATCH_QUERY
...Inbox?[foo=bar&baz=value]
@ PREX_URL_MATCH_HOSTNAME
imaps://...[host.com]...
@ PREX_URL_MATCH_PORT
imaps://host.com:[993]/...
@ PREX_URL_MATCH_PATH_ONLY
mailto:[me@example.com]?foo=bar
@ PREX_URL_MATCH_SCHEME
[imaps]://...
@ PREX_URL_MATCH_USERINFO
...//[user:pass@]...
@ PREX_URL_MATCH_PATH
...:993/[Inbox]
@ PREX_URL_MATCH_HOSTIPVX
imaps://...[127.0.0.1]...
@ PREX_URL_MATCH_PASS
...//user:[pass]@...
#define STAILQ_REMOVE_HEAD(head, field)
#define STAILQ_INIT(head)
#define STAILQ_FIRST(head)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_INSERT_TAIL(head, elm, field)
#define STAILQ_EMPTY(head)
#define STAILQ_NEXT(elm, field)
static size_t mutt_regmatch_len(const regmatch_t *match)
Return the length of a match.
static regoff_t mutt_regmatch_end(const regmatch_t *match)
Return the end of a match.
static regoff_t mutt_regmatch_start(const regmatch_t *match)
Return the start of a match.
String manipulation buffer.
Mapping between user-readable string and a constant.
A parsed URL proto://user:password@host:port/path?a=1&b=2
struct UrlQueryList query_strings
List of query strings.
char * src
Raw URL string.
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
int url_pct_decode(char *s)
Decode a percent-encoded string.
struct Url * url_parse(const char *src)
Fill in Url.
static bool parse_query_string(struct UrlQueryList *list, char *src)
Parse a URL query string.
void url_free(struct Url **ptr)
Free the contents of a URL.
enum UrlScheme url_check_scheme(const char *str)
Check the protocol of a URL.
static const struct Mapping UrlMap[]
Constants for URL protocols.
int url_tostring(const struct Url *url, char *dest, size_t len, uint8_t flags)
Output the URL string for a given Url object.
int url_tobuffer(const struct Url *url, struct Buffer *buf, uint8_t flags)
Output the URL string for a given Url object.
void url_pct_encode(char *buf, size_t buflen, const char *src)
Percent-encode a string.
static enum UrlScheme get_scheme(const char *src, const regmatch_t *match)
Extract the scheme part from a matched URL.
static struct Url * url_new(void)
Create a Url.
Parse and identify different URL schemes.
UrlScheme
All recognised Url types.
@ U_NOTMUCH
Url is notmuch://.
@ U_UNKNOWN
Url wasn't recognised.
@ U_NNTPS
Url is nntps://.
@ U_MAILTO
Url is mailto://.
@ U_SMTPS
Url is smtps://.
@ U_IMAPS
Url is imaps://.