+/* We need a slightly modified version of pb_url_join, to allow for the
+ * pxelinux "::filename" syntax for absolute URLs
+ */
+static struct pb_url *pxe_url_join(void *ctx, const struct pb_url *url,
+ const char *s)
+{
+ struct pb_url *new_url;
+ int len;
+
+ len = strlen(s);
+
+ if (len > 2 && s[0] == ':' && s[1] == ':') {
+ char *tmp;
+
+ if (s[2] == '/') {
+ /* ::/path -> /path */
+ tmp = talloc_strdup(ctx, s+2);
+ } else {
+ /* ::path -> /path */
+ tmp = talloc_strdup(ctx, s+1);
+ tmp[0] = '/';
+ }
+
+ new_url = pb_url_join(ctx, url, tmp);
+
+ talloc_free(tmp);
+
+ } else {
+ const char *tmp;
+ /* strip leading slashes */
+ for (tmp = s; *tmp == '/'; tmp++)
+ ;
+ new_url = pb_url_join(ctx, url, tmp);
+ }
+
+ return new_url;
+}
+