+
+ if (!(flags & HTTP_URL_STRIP_PATH)) {
+ if ((flags & HTTP_URL_JOIN_PATH) && __URLSET(old_url, path) && __URLSET(new_url, path) && *new_url->path != '/') {
+ size_t old_path_len = strlen(old_url->path), new_path_len = strlen(new_url->path);
+
+ url->path = ecalloc(1, old_path_len + new_path_len + 1 + 1);
+
+ strcat(url->path, old_url->path);
+ if (url->path[old_path_len - 1] != '/') {
+ php_dirname(url->path, old_path_len);
+ strcat(url->path, "/");
+ }
+ strcat(url->path, new_url->path);
+ } else {
+ __URLCPY(path);
+ }
+ }
+ if (!(flags & HTTP_URL_STRIP_QUERY)) {
+ if ((flags & HTTP_URL_JOIN_QUERY) && __URLSET(new_url, query) && __URLSET(old_url, query)) {
+ url->query = ecalloc(1, strlen(new_url->query) + strlen(old_url->query) + 1 + 1);
+ strcat(url->query, old_url->query);
+ strcat(url->query, "&");
+ strcat(url->query, new_url->query);
+ } else {
+ __URLCPY(query);
+ }
+ }
+ if (!(flags & HTTP_URL_STRIP_FRAGMENT)) {
+ __URLCPY(fragment);
+ }