From 0cdda05eff4ed7c697bcd77a0d5ecb70597b3efe Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Mon, 20 Aug 2012 00:03:55 +0100 Subject: [PATCH 1/2] bug #62844; relative URL schemes in parse_url() --- ext/standard/tests/url/parse_url_relative_scheme.phpt | 11 +++++++++++ ext/standard/url.c | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 ext/standard/tests/url/parse_url_relative_scheme.phpt diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt b/ext/standard/tests/url/parse_url_relative_scheme.phpt new file mode 100644 index 0000000000000..7c8952db71e9d --- /dev/null +++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test parse_url() function: Checks relative URL schemes (e.g. "//example.com") +--FILE-- + + string(11) "example.org" +} + diff --git a/ext/standard/url.c b/ext/standard/url.c index 0555c7b65aa8a..f1e48a1a5f747 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -204,6 +204,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } else { goto just_path; } + } else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL */ + s += 2; } else { just_path: ue = s + length; From 2b9a7a90c3d159b79ba54ca48d38f97b557921e2 Mon Sep 17 00:00:00 2001 From: Andrew Faulds Date: Mon, 20 Aug 2012 00:29:18 +0100 Subject: [PATCH 2/2] relative-scheme --- ext/standard/url.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/url.c b/ext/standard/url.c index f1e48a1a5f747..44a568032b690 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -204,7 +204,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } else { goto just_path; } - } else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL */ + } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ s += 2; } else { just_path: