#endif /* HAVE_LIBIDN */
#ifdef HAVE_LIBIDN
-/**
- * mutt_idna_to_ascii_lz - Convert a domain to Punycode
- * @param input Domain
- * @param output Result
- * @param flags Flags, e.g. IDNA_ALLOW_UNASSIGNED
- * @retval 0 Success
- * @retval >0 Failure, error code
- *
- * Convert a domain from the current locale to Punycode.
- *
- * @note The caller must free output
- */
-int mutt_idna_to_ascii_lz(const char *input, char **output, int flags)
-{
- return idna_to_ascii_lz(input, output, flags);
-}
-
/**
* check_idn - Is domain in Punycode?
* @param domain Domain to test
return false;
}
+
+/**
+ * mutt_idna_to_ascii_lz - Convert a domain to Punycode
+ * @param input Domain
+ * @param output Result
+ * @param flags Flags, e.g. IDNA_ALLOW_UNASSIGNED
+ * @retval 0 Success
+ * @retval >0 Failure, error code
+ *
+ * Convert a domain from the current locale to Punycode.
+ *
+ * @note The caller must free output
+ */
+int mutt_idna_to_ascii_lz(const char *input, char **output, int flags)
+{
+ return idna_to_ascii_lz(input, output, flags);
+}
#endif /* HAVE_LIBIDN */
/**
{ "smtp", U_SMTP }, { "smtps", U_SMTPS }, { NULL, U_UNKNOWN },
};
+/**
+ * parse_query_string - Parse a URL query string
+ * @param u Url to store the results
+ * @param src String to parse
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+static int parse_query_string(struct Url *u, char *src)
+{
+ struct UrlQueryString *qs = NULL;
+ char *k = NULL, *v = NULL;
+
+ while (src && *src)
+ {
+ qs = mutt_mem_calloc(1, sizeof(struct UrlQueryString));
+ k = strchr(src, '&');
+ if (k)
+ *k = '\0';
+
+ v = strchr(src, '=');
+ if (v)
+ {
+ *v = '\0';
+ qs->value = v + 1;
+ if (url_pct_decode(qs->value) < 0)
+ {
+ FREE(&qs);
+ return -1;
+ }
+ }
+ qs->name = src;
+ if (url_pct_decode(qs->name) < 0)
+ {
+ FREE(&qs);
+ return -1;
+ }
+ STAILQ_INSERT_TAIL(&u->query_strings, qs, entries);
+
+ if (!k)
+ break;
+ src = k + 1;
+ }
+ return 0;
+}
+
/**
* url_pct_decode - Decode a percent-encoded string
* @param s String to decode
return (enum UrlScheme) i;
}
-/**
- * parse_query_string - Parse a URL query string
- * @param u Url to store the results
- * @param src String to parse
- * @retval 0 Success
- * @retval -1 Error
- */
-static int parse_query_string(struct Url *u, char *src)
-{
- struct UrlQueryString *qs = NULL;
- char *k = NULL, *v = NULL;
-
- while (src && *src)
- {
- qs = mutt_mem_calloc(1, sizeof(struct UrlQueryString));
- k = strchr(src, '&');
- if (k)
- *k = '\0';
-
- v = strchr(src, '=');
- if (v)
- {
- *v = '\0';
- qs->value = v + 1;
- if (url_pct_decode(qs->value) < 0)
- {
- FREE(&qs);
- return -1;
- }
- }
- qs->name = src;
- if (url_pct_decode(qs->name) < 0)
- {
- FREE(&qs);
- return -1;
- }
- STAILQ_INSERT_TAIL(&u->query_strings, qs, entries);
-
- if (!k)
- break;
- src = k + 1;
- }
- return 0;
-}
-
/**
* url_parse - Fill in Url
* @param u Url where the result is stored