@@ -343,45 +343,6 @@ static iString *punyDecodeHost_(iRangecc host) {
343343 return result ;
344344}
345345
346- void urlDecodePath_String (iString * d ) {
347- iUrl url ;
348- init_Url (& url , d );
349- if (isEmpty_Range (& url .path )) {
350- return ;
351- }
352- iString * decoded = new_String ();
353- appendRange_String (decoded , (iRangecc ){ constBegin_String (d ), url .path .start });
354- iString * path = newRange_String (url .path );
355- iString * decPath = urlDecodeExclude_String (path , ":;%?/#" ); /* don't decode reserved path chars */
356- append_String (decoded , decPath );
357- delete_String (decPath );
358- delete_String (path );
359- appendRange_String (decoded , (iRangecc ){ url .path .end , constEnd_String (d ) });
360- set_String (d , decoded );
361- delete_String (decoded );
362- }
363-
364- void urlEncodePath_String (iString * d ) {
365- iUrl url ;
366- init_Url (& url , d );
367- if (equalCase_Rangecc (url .scheme , "data" )) {
368- return ;
369- }
370- if (isEmpty_Range (& url .path )) {
371- return ;
372- }
373- iString * encoded = new_String ();
374- appendRange_String (encoded , (iRangecc ){ constBegin_String (d ), url .path .start });
375- iString * path = newRange_String (url .path );
376- iString * encPath = urlEncodeExclude_String (path , "%/= " );
377- append_String (encoded , encPath );
378- delete_String (encPath );
379- delete_String (path );
380- appendRange_String (encoded , (iRangecc ){ url .path .end , constEnd_String (d ) });
381- set_String (d , encoded );
382- delete_String (encoded );
383- }
384-
385346iString * withUrlParameters_String (const iString * d , ...) {
386347 iUrl url ;
387348 init_Url (& url , d );
@@ -745,21 +706,23 @@ const iString *canonicalUrl_String(const iString *d) {
745706 iString * canon = NULL ;
746707 iUrl parts ;
747708 init_Url (& parts , d );
709+ #if 0
748710 /* Colons (0x3a) are in decoded form in the URL path. */
749711 if (iStrStrN (parts .path .start , "%3A" , size_Range (& parts .path )) ||
750712 iStrStrN (parts .path .start , "%3a" , size_Range (& parts .path ))) {
751713 /* This is done separately to avoid the copy if %3A is not present; it's rare. */
752714 canon = copy_String (d );
753- urlDecodePath_String (canon );
715+ /* urlDecodePath_String(canon);*/
754716 iString * dec = maybeUrlDecodeExclude_String (canon , "% " URL_RESERVED_CHARS ); /* decode everything else in all parts */
755717 if (dec ) {
756718 set_String (canon , dec );
757719 delete_String (dec );
758720 }
759721 }
760722 else {
761- canon = maybeUrlDecodeExclude_String (d , "% " URL_RESERVED_CHARS );
762- }
723+ #endif
724+ canon = maybeUrlDecodeExclude_String (d , " " URL_DECODE_EXCLUDE_CHARS );
725+ // }
763726 /* `canon` may now be NULL if nothing was decoded. */
764727 if (indexOfCStr_String (canon ? canon : d , " " ) != iInvalidPos ||
765728 indexOfCStr_String (canon ? canon : d , "\n" ) != iInvalidPos ) {
0 commit comments