Fix CVS crap
original commit: cc9a1fe584a421095441c48197ad18bb0dae06b7
This commit is contained in:
parent
9c29860de8
commit
a06af27c72
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
(require (lib "unitsig.ss")
|
(require (lib "unitsig.ss")
|
||||||
(lib "match.ss")
|
(lib "match.ss")
|
||||||
|
(lib "string.ss")
|
||||||
"uri-codec-sig.ss")
|
"uri-codec-sig.ss")
|
||||||
|
|
||||||
(provide uri-codec@)
|
(provide uri-codec@)
|
||||||
|
@ -80,14 +81,14 @@
|
||||||
;; Macro to loop over integers from n (inclusive) to m (exclusive)
|
;; Macro to loop over integers from n (inclusive) to m (exclusive)
|
||||||
;; Extracted from iteration.ss in macro package at Schematics
|
;; Extracted from iteration.ss in macro package at Schematics
|
||||||
(define-syntax for
|
(define-syntax for
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((for (i n m) forms ...)
|
((for (i n m) forms ...)
|
||||||
(let ((fixed-m m))
|
(let ((fixed-m m))
|
||||||
(let loop ((i n))
|
(let loop ((i n))
|
||||||
(if (< i fixed-m)
|
(if (< i fixed-m)
|
||||||
(begin
|
(begin
|
||||||
forms ...
|
forms ...
|
||||||
(loop (+ i 1)))))))))
|
(loop (+ i 1)))))))))
|
||||||
|
|
||||||
(define uri-codec@
|
(define uri-codec@
|
||||||
(unit/sig net:uri-codec^
|
(unit/sig net:uri-codec^
|
||||||
|
@ -107,13 +108,13 @@
|
||||||
|
|
||||||
;; Characters that sometimes map to themselves
|
;; Characters that sometimes map to themselves
|
||||||
(define safe-mapping
|
(define safe-mapping
|
||||||
(map (lambda (char)
|
(map (lambda (char)
|
||||||
(cons char char))
|
(cons char char))
|
||||||
'(#\- #\_ #\. #\! #\~ #\* #\' #\( #\))))
|
'(#\- #\_ #\. #\! #\~ #\* #\' #\( #\))))
|
||||||
|
|
||||||
;; The strict URI mapping
|
;; The strict URI mapping
|
||||||
(define uri-mapping
|
(define uri-mapping
|
||||||
(append alphanumeric-mapping safe-mapping))
|
(append alphanumeric-mapping safe-mapping))
|
||||||
|
|
||||||
;; The form-urlencoded mapping
|
;; The form-urlencoded mapping
|
||||||
(define form-urlencoded-mapping
|
(define form-urlencoded-mapping
|
||||||
|
@ -161,7 +162,7 @@
|
||||||
|
|
||||||
;; vector string -> string
|
;; vector string -> string
|
||||||
(define (encode table str)
|
(define (encode table str)
|
||||||
(apply string-append
|
(apply string-append
|
||||||
(map (lambda (char)
|
(map (lambda (char)
|
||||||
(vector-ref table (char->integer char)))
|
(vector-ref table (char->integer char)))
|
||||||
(string->list str))))
|
(string->list str))))
|
||||||
|
@ -225,7 +226,9 @@
|
||||||
#f
|
#f
|
||||||
(match (regexp-match-positions key-regexp str start)
|
(match (regexp-match-positions key-regexp str start)
|
||||||
[((start . end))
|
[((start . end))
|
||||||
(vector (form-urlencoded-decode (substring str start end))
|
(vector (let ([s (form-urlencoded-decode (substring str start end))])
|
||||||
|
(string-lowercase! s)
|
||||||
|
(string->symbol s))
|
||||||
(add1 end))]
|
(add1 end))]
|
||||||
[#f #f])))
|
[#f #f])))
|
||||||
(define (next-value str start)
|
(define (next-value str start)
|
||||||
|
@ -245,16 +248,16 @@
|
||||||
[#f
|
[#f
|
||||||
(vector (cons key "") (string-length str))])]
|
(vector (cons key "") (string-length str))])]
|
||||||
[#f #f]))
|
[#f #f]))
|
||||||
(let loop ((start 0)
|
(let loop ([start 0]
|
||||||
(end (string-length str))
|
[end (string-length str)]
|
||||||
(alist '()))
|
[make-alist (lambda (x) x)])
|
||||||
(cond
|
(cond
|
||||||
[(>= start end) alist]
|
[(>= start end) (make-alist '())]
|
||||||
[else
|
[else
|
||||||
(match (next-pair str start)
|
(match (next-pair str start)
|
||||||
[#(pair next-start)
|
[#(pair next-start)
|
||||||
(loop next-start end (cons pair alist))]
|
(loop next-start end (lambda (x) (make-alist (cons pair x))))]
|
||||||
[#f alist])])))
|
[#f (make-alist '())])])))
|
||||||
|
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user