File tree 2 files changed +28
-7
lines changed
2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -742,8 +742,9 @@ bad_hex: Trap0(RE_INVALID_CHARS);
742
742
**
743
743
***********************************************************************/
744
744
{
745
- REBYTE * str ;
746
745
REBUNI n ;
746
+ REBYTE * str = Reset_Buffer (BUF_FORM , len );
747
+ REBCNT cnt = len ;
747
748
748
749
// !!! Need to check for any possible scheme followed by ':'
749
750
@@ -753,22 +754,22 @@ bad_hex: Trap0(RE_INVALID_CHARS);
753
754
// if (n >= URL_MAX) return 0;
754
755
// if (*str != ':') return 0;
755
756
756
- VAL_SERIES (value ) = Make_Binary (len );
757
- VAL_INDEX (value ) = 0 ;
758
-
759
- str = VAL_BIN (value );
757
+
760
758
for (; len > 0 ; len -- ) {
761
759
//if (*cp == '%' && len > 2 && Scan_Hex2(cp+1, &n, FALSE)) {
762
760
if (* cp == '%' ) {
763
761
if (len <= 2 || !Scan_Hex2 (cp + 1 , & n , FALSE)) return 0 ;
764
762
* str ++ = (REBYTE )n ;
765
- cp += 3 ;
763
+ cp += 3 ;
766
764
len -= 2 ;
765
+ cnt -= 2 ;
767
766
}
768
767
else * str ++ = * cp ++ ;
769
768
}
770
769
* str = 0 ;
771
- VAL_TAIL (value ) = (REBCNT )(str - VAL_BIN (value ));
770
+
771
+ VAL_SERIES (value ) = Decode_UTF_String (BIN_DATA (BUF_FORM ), cnt , 8 , FALSE);
772
+ VAL_INDEX (value ) = 0 ;
772
773
VAL_SET (value , REB_URL );
773
774
return cp ;
774
775
}
Original file line number Diff line number Diff line change @@ -172,6 +172,26 @@ Rebol [
172
172
173
173
===end-group===
174
174
175
+ ===start-group=== "url"
176
+
177
+ --test-- "mold url"
178
+ --assert "ftp://" = mold ftp://
179
+ --assert "ftp://š" = mold ftp://š
180
+ --assert "ftp://+" = mold ftp://+
181
+ --assert "ftp://+" = mold ftp://%2b
182
+ --assert "ftp://+" = mold ftp://%2B
183
+ --assert "ftp://%20" = mold ftp://%20
184
+ --test-- "mold append url"
185
+ --assert "ftp://a" = mold append ftp:// #"a"
186
+ --assert "ftp://a" = mold append ftp:// "a"
187
+ --assert "ftp://š" = mold append ftp:// "š"
188
+ --assert "ftp://+" = mold append ftp:// "+"
189
+ --assert "ftp://%2528" = mold append ftp:// "%28"
190
+ --assert "ftp://%28" = dehex mold append ftp:// "%28"
191
+
192
+ ===end-group===
193
+
194
+
175
195
===start-group=== "mold-all"
176
196
177
197
--test-- "mold-true" --assert "true" = mold true
You can’t perform that action at this time.
0 commit comments