-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[RFC] Add RFC 3986 and WHATWG compliant URL parsing support #14461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
196957b
0334e22
a09a457
3abdb0a
1445e55
e4de160
77184ce
3b0449d
5f90823
b7011b8
f20842a
c88e92b
c743ead
19b7180
fb0c929
cf7ca4e
9de1271
db3b79d
feefccf
190bbfd
d1df694
0d1fc02
df1d0b9
e8261f7
7530dd9
b75cc5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -136,7 +136,7 @@ static zend_result uriparser_normalize_uri(UriUriA *uriparser_uri) | |||||
#define URIPARSER_READ_URI(uriparser_uri, uriparser_uris, read_mode) do { \ | ||||||
if (read_mode == URI_COMPONENT_READ_RAW) { \ | ||||||
uriparser_uri = (UriUriA *) uriparser_uris->uri; \ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a few lines here were indented by spaces not tabs |
||||||
} else if (read_mode == URI_COMPONENT_READ_NORMALIZED_HUMAN_FRIENDLY || read_mode == URI_COMPONENT_READ_NORMALIZED_MACHINE_FRIENDLY) { \ | ||||||
} else if (read_mode == URI_COMPONENT_READ_NORMALIZED_FOR_DISPLAY || read_mode == URI_COMPONENT_READ_NORMALIZED_FOR_MACHINE_PROCESSING) { \ | ||||||
if (uriparser_uris->normalized_uri == NULL) { \ | ||||||
uriparser_uris->normalized_uri = uriparser_copy_uri(uriparser_uris->uri); \ | ||||||
if (uriparser_normalize_uri(uriparser_uris->normalized_uri) == FAILURE) { \ | ||||||
|
@@ -260,6 +260,10 @@ static zend_result uriparser_read_path(const uri_internal_t *internal_uri, uri_c | |||||
const UriPathSegmentA *p; | ||||||
smart_str str = {0}; | ||||||
|
||||||
if (uriparser_uri->absolutePath || uriIsHostSetA(uriparser_uri)) { | ||||||
smart_str_appends(&str, "/"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
smart_str_appendl(&str, uriparser_uri->pathHead->text.first, (int) ((uriparser_uri->pathHead->text).afterLast - (uriparser_uri->pathHead->text).first)); | ||||||
|
||||||
for (p = uriparser_uri->pathHead->next; p != NULL; p = p->next) { | ||||||
|
@@ -355,15 +359,8 @@ static void uriparser_append_port(const uri_internal_t *internal_uri, smart_str | |||||
|
||||||
static void uriparser_append_path(const uri_internal_t *internal_uri, smart_str *uri_str) | ||||||
{ | ||||||
uriparser_uris_t *uriparser_uris = (uriparser_uris_t *) internal_uri->uri; | ||||||
UriUriA *uriparser_uri = uriparser_uris->uri; | ||||||
|
||||||
zval tmp; | ||||||
|
||||||
if (uriparser_uri->absolutePath || (uriparser_uri->pathHead != NULL && uriIsHostSetA(uriparser_uri))) { | ||||||
smart_str_appends(uri_str, "/"); | ||||||
} | ||||||
|
||||||
uriparser_read_path(internal_uri, URI_COMPONENT_READ_RAW, &tmp); | ||||||
if (Z_TYPE(tmp) == IS_STRING && Z_STRLEN(tmp) > 0) { | ||||||
smart_str_append(uri_str, Z_STR(tmp)); | ||||||
|
@@ -679,7 +676,7 @@ static zend_string *uriparser_uri_to_string(void *uri, uri_recomposition_mode_t | |||||
uriparser_uris_t *uriparser_uris = (uriparser_uris_t *) uri; | ||||||
UriUriA *uriparser_uri = uriparser_uris->uri; | ||||||
|
||||||
if ((recomposition_mode == URI_RECOMPOSITION_NORMALIZED_HUMAN_FRIENDLY || recomposition_mode == URI_RECOMPOSITION_NORMALIZED_MACHINE_FRIENDLY) && | ||||||
if ((recomposition_mode == URI_RECOMPOSITION_NORMALIZED_FOR_DISPLAY || recomposition_mode == URI_RECOMPOSITION_NORMALIZED_FOR_MACHINE_PROCESSING) && | ||||||
uriparser_uris->normalized_uri == NULL | ||||||
) { | ||||||
uriparser_uris->normalized_uri = uriparser_copy_uri(uriparser_uris->uri); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two blocks look the same - can they be combined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, nice catch