File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
http-easy-test/net/http-easy/private Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 122
122
(get-output-string out))
123
123
124
124
(define (maybe-percent-encode s [encode uri-encode])
125
- (if (is-percent-encoded? s) s (encode s)))
125
+ (if (is-percent-encoded? s encode ) s (encode s)))
126
126
127
- (define (is-percent-encoded? s)
127
+ (define (is-percent-encoded? s [encode uri-encode] )
128
128
(define num-%-matches (length (regexp-match* #rx"% " s)))
129
- (and (> num-%-matches 0 )
130
- (= num-%-matches (length (regexp-match* #px"%[a-fA-F0-9]{2} " s)))))
129
+ (or (and (> num-%-matches 0 )
130
+ (= num-%-matches (length (regexp-match* #px"%[a-fA-F0-9]{2} " s))))
131
+ (and (eq? encode form-urlencoded-encode)
132
+ (regexp-match? #rx"[+] " s))))
131
133
132
134
(define (ipv6-host? s)
133
135
(regexp-match? #rx"^[0-9a-fA-F:]*:[0-9a-fA-F:]*$ " s))
Original file line number Diff line number Diff line change 1
1
#lang info
2
2
3
3
(define license 'BSD-3-Clause )
4
- (define version "0.8.1 " )
4
+ (define version "0.8.2 " )
5
5
(define collection "net " )
6
6
(define deps
7
7
'(["base " #:version "8.1.0.4 " ]
Original file line number Diff line number Diff line change 65
65
66
66
("http://example.com/a/b/c " . "http://example.com/a/b/c " )
67
67
("http://example.com/a%2Bb.mp3 " . "http://example.com/a%2Bb.mp3 " )
68
- ("http://example.com/a%2Bb.mp3?c=d+e " . "http://example.com/a%2Bb.mp3?c=d%2Be " )
69
- ("http://example.com/a%2Bb.mp3?c=d+e&f&g=h " . "http://example.com/a%2Bb.mp3?c=d%2Be &f&g=h " )
68
+ ("http://example.com/a%2Bb.mp3?c=d+e " . "http://example.com/a%2Bb.mp3?c=d+e " )
69
+ ("http://example.com/a%2Bb.mp3?c=d+e&f&g=h " . "http://example.com/a%2Bb.mp3?c=d+e &f&g=h " )
70
70
("a/b/c " . "a/b/c " )
71
71
("/a/b/c " . "/a/b/c " )
72
72
("/a;b;c " . "/a;b;c " )))
95
95
(for ([test (in-list tests)])
96
96
(check-equal?
97
97
(url/literal->string (string->url/literal test))
98
- (url->string (string->url test))))))
98
+ (url->string (string->url test)))))
99
+
100
+ (test-case "examples "
101
+ (let ([example "https://d12xz7rzfw7xh7.cloudfront.net/v1/download/episodes/original/43796816?a=en&eg=https%3A%2F%2Fapi.spreaker.com%2Fepisode%2F57758598&eu=https%3A%2F%2Fdts.podtrac.com%2Fredirect.mp3%2Fapi.spreaker.com%2Fdownload%2Fepisode%2F57758598%2Ftmp9u92imeh.mp3&p=3&q=9808638&f=559&r=128&t=3&u=11393707&o=2401044&d=2023-11-22&g=57758598&h=5937276&k=https%3A%2F%2Fwww.spreaker.com%2Fshow%2F5937276%2Fepisodes%2Ffeed&i=43796816&n=Petros+And+Money&b=%5B%22IAB6-7%22%2C%22IAB7-39%22%2C%22IAB11-4%22%2C%22IAB26%22%5D&c=%5B%22sports%22%5D&l=%5B%22hosting_plan_ihr%22%5D&m=%5B904294%2C904294%2C904294%2C1436858%2C1436858%2C1436858%2C1436858%2C1436858%2C1937091%2C1937091%2C1937091%5D&rr=4444444444444&fax=0.4&Expires=1732993926&Signature=XDgffPCg91Gd6ThNXoenP4axeBN2zEUK6Bs56F2Pw-LGE9XJuLPghg1f2etV1l6I3%7Ed7Ms12AQbkCp1vfkqleStA30fPDH2PpO1IKkw5k7PlSYyPCeb1DOc1No8s6KHn7C8DZ7swXjWEz5WGzrj6KtSgI%7EWMhQyiLuGxEmT9YBQViowMGeO7p1PNocQmT-SKo8WqMDMdzMmSXP2WQFYSk3AjFM2ukhGLzDkIcrNxy2ZRLGeUykF9ZWgNnGGAOfwsmx6n0IFQZcdDo2QpRKxOUjSBYOTxTo1Y716OYb73P59QurF%7El-jM7WLHgvFxWnJQHj9SwCnjSaCJgzDBlh%7EEDQ__&Key-Pair-Id=K1J2BR3INU6RYD"])
102
+ (check-equal? (url/literal->string (string->url/literal example)) example))))
99
103
100
104
(test-suite
101
105
"is-percent-encoded? "
You can’t perform that action at this time.
0 commit comments