struct pb_url *url;
const char *p;
- pb_log("%s: '%s'\n", __func__, url_str);
-
if (!url_str || !*url_str) {
assert(0 && "bad url");
return NULL;
pb_url_parse_path(url);
- pb_log(" scheme %d\n", url->scheme);
- pb_log(" host '%s'\n", url->host);
- pb_log(" port '%s'\n", url->port);
- pb_log(" path '%s'\n", url->path);
- pb_log(" dir '%s'\n", url->dir);
- pb_log(" file '%s'\n", url->file);
-
return url;
fail:
return strstr(str, "://") != NULL;
}
-static void pb_url_update_full(struct pb_url *url)
+char *pb_url_to_string(struct pb_url *url)
{
const struct pb_scheme_info *scheme = pb_url_scheme_info(url->scheme);
-
assert(scheme);
- talloc_free(url->full);
-
- url->full = talloc_asprintf(url, "%s://%s%s", scheme->str,
+ return talloc_asprintf(url, "%s://%s%s", scheme->str,
scheme->has_host ? url->host : "", url->path);
}
+static void pb_url_update_full(struct pb_url *url)
+{
+ talloc_free(url->full);
+ url->full = pb_url_to_string(url);
+}
+
static struct pb_url *pb_url_copy(void *ctx, const struct pb_url *url)
{
struct pb_url *new_url;