File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
web-server-lib/web-server/private Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1111
1212;; --
1313
14+ (define (byte-upcase b)
15+ (if (<= 97 b 122 )
16+ (- b (- 97 65 ))
17+ b))
1418(define (bytes-ci=? b0 b1)
15- (string-ci=? (bytes->string/utf-8 b0)
16- (bytes->string/utf-8 b1)))
19+ (and (= (bytes-length b0)
20+ (bytes-length b1))
21+ (for/and ([b0 (in-bytes b0)]
22+ [b1 (in-bytes b1)])
23+ (= (byte-upcase b0) (byte-upcase b1)))))
1724;; Eli: If this ever gets in, it should say that the memory requirements
1825;; are 4 times the input size, especially since bytes are often used to save
1926;; space. Also, fails on (bytes-ci=? #"\277" #"\277"), and a trivial fix
2229(provide/contract
2330 [bytes-ci=? (bytes? bytes? . -> . boolean?)])
2431
32+ (module+ test
33+ (require rackunit)
34+ (check-true (bytes-ci=? #"FBCR/M\351ditel " #"fbCR/M\351ditel " )))
35+
2536;; --
2637
2738(define path-piece?
You can’t perform that action at this time.
0 commit comments