diff options
Diffstat (limited to 'src/gmutil.c')
-rw-r--r-- | src/gmutil.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index 8dcffaa1..b7ddfa21 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -95,7 +95,14 @@ void stripDefaultUrlPort_String(iString *d) { | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | iBool isDataUrl_String(const iString *d) { | ||
99 | return startsWithCase_String(d, "data:"); | ||
100 | } | ||
101 | |||
98 | const iString *urlFragmentStripped_String(const iString *d) { | 102 | const iString *urlFragmentStripped_String(const iString *d) { |
103 | if (isDataUrl_String(d)) { | ||
104 | return d; | ||
105 | } | ||
99 | /* Note: Could use `iUrl` here and leave out the fragment. */ | 106 | /* Note: Could use `iUrl` here and leave out the fragment. */ |
100 | const size_t fragPos = indexOf_String(d, '#'); | 107 | const size_t fragPos = indexOf_String(d, '#'); |
101 | if (fragPos != iInvalidPos) { | 108 | if (fragPos != iInvalidPos) { |
@@ -227,6 +234,9 @@ void urlDecodePath_String(iString *d) { | |||
227 | void urlEncodePath_String(iString *d) { | 234 | void urlEncodePath_String(iString *d) { |
228 | iUrl url; | 235 | iUrl url; |
229 | init_Url(&url, d); | 236 | init_Url(&url, d); |
237 | if (equalCase_Rangecc(url.scheme, "data")) { | ||
238 | return; | ||
239 | } | ||
230 | if (isEmpty_Range(&url.path)) { | 240 | if (isEmpty_Range(&url.path)) { |
231 | return; | 241 | return; |
232 | } | 242 | } |
@@ -355,6 +365,9 @@ void punyEncodeDomain_Rangecc(iRangecc domain, iString *encoded_out) { | |||
355 | void punyEncodeUrlHost_String(iString *absoluteUrl) { | 365 | void punyEncodeUrlHost_String(iString *absoluteUrl) { |
356 | iUrl url; | 366 | iUrl url; |
357 | init_Url(&url, absoluteUrl); | 367 | init_Url(&url, absoluteUrl); |
368 | if (equalCase_Rangecc(url.scheme, "data")) { | ||
369 | return; | ||
370 | } | ||
358 | if (isEmpty_Range(&url.host)) { | 371 | if (isEmpty_Range(&url.host)) { |
359 | return; | 372 | return; |
360 | } | 373 | } |
@@ -391,6 +404,9 @@ void urlEncodeSpaces_String(iString *d) { | |||
391 | } | 404 | } |
392 | 405 | ||
393 | const iString *withSpacesEncoded_String(const iString *d) { | 406 | const iString *withSpacesEncoded_String(const iString *d) { |
407 | if (isDataUrl_String(d)) { | ||
408 | return d; | ||
409 | } | ||
394 | iString *enc = copy_String(d); | 410 | iString *enc = copy_String(d); |
395 | urlEncodeSpaces_String(enc); | 411 | urlEncodeSpaces_String(enc); |
396 | return collect_String(enc); | 412 | return collect_String(enc); |