-/* $OpenBSD: x509_constraints.c,v 1.27 2022/06/26 11:29:27 beck Exp $ */
+/* $OpenBSD: x509_constraints.c,v 1.28 2022/06/27 15:03:11 beck Exp $ */
/*
* Copyright (c) 2020 Bob Beck <beck@openbsd.org>
*
}
/*
- * Extract the host part of a URI, returns the host part as a c string
- * the caller must free, or or NULL if it could not be found or is
- * invalid.
+ * Extract the host part of a URI. On failure to parse a valid host part of the
+ * URI, 0 is returned indicating an invalid URI. If the host part parses as
+ * valid, or is not present, 1 is returned indicating a possibly valid URI.
+ *
+ * In the case of a valid URI, *hostpart will be set to a copy of the host part
+ * of the URI, or the empty string if no URI is present. If memory allocation
+ * fails *hostpart will be set to NULL, even though we returned 1. It is the
+ * caller's responsibility to indicate an error for memory allocation failure,
+ * and the callers responsibility to free *hostpart.
*
* RFC 3986:
* the authority part of a uri starts with // and is terminated with