-#define http_build_url(o, n, p, s, l) _http_build_url((o), (n), (p), (s), (l) TSRMLS_CC)
-PHP_HTTP_API void _http_build_url(const php_url *old_url, const php_url *new_url, php_url **url_ptr, char **url_str, size_t *url_len TSRMLS_DC);
+#define HTTP_URL_REPLACE 0x000
+#define HTTP_URL_JOIN_PATH 0x001
+#define HTTP_URL_JOIN_QUERY 0x002
+#define HTTP_URL_STRIP_USER 0x004
+#define HTTP_URL_STRIP_PASS 0x008
+#define HTTP_URL_STRIP_AUTH (HTTP_URL_STRIP_USER|HTTP_URL_STRIP_PASS)
+#define HTTP_URL_STRIP_PORT 0x020
+#define HTTP_URL_STRIP_PATH 0x040
+#define HTTP_URL_STRIP_QUERY 0x080
+#define HTTP_URL_STRIP_FRAGMENT 0x100
+#define HTTP_URL_STRIP_ALL ( \
+ HTTP_URL_STRIP_AUTH | \
+ HTTP_URL_STRIP_PORT | \
+ HTTP_URL_STRIP_PATH | \
+ HTTP_URL_STRIP_QUERY | \
+ HTTP_URL_STRIP_FRAGMENT \
+)
+
+#define http_build_url(f, o, n, p, s, l) _http_build_url((f), (o), (n), (p), (s), (l) TSRMLS_CC)
+PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_url *new_url, php_url **url_ptr, char **url_str, size_t *url_len TSRMLS_DC);