Fixing problem reported by Nadeem Abdul Hamid

This commit is contained in:
Jay McCarthy 2010-09-06 10:34:37 -06:00
parent df68ef4deb
commit f2b5a454bd
2 changed files with 35 additions and 5 deletions

View File

@ -0,0 +1,29 @@
#lang racket
(require net/url
rackunit
tests/eli-tester
htdp/bsl/reader
web-server/servlet/web)
(require/expose web-server/servlet/web
(embed-ids))
(require/expose htdp/bsl/reader
(wrap-reader))
(define base-url
(string->url
"http://localhost:8000/servlets/standalone.rkt"))
(define a-k-url
(string->url
"http://localhost:8000/servlets/standalone.rkt;((%22k%22%20.%20%22(1%201%2033620206)%22))"))
(define k-info
'(1 1 33620206))
(define (can-encode?)
(test
(continuation-url? a-k-url) => k-info
(embed-ids k-info base-url) => (url->string a-k-url)))
(test
(can-encode?)
((wrap-reader can-encode? empty)))

View File

@ -23,11 +23,12 @@
;; determine if this url encodes a continuation and extract the instance id and
;; continuation id.
(define (continuation-url? a-url)
(parameterize ([read-accept-dot #t])
(cond
[(extract-param a-url "k")
=> read/string]
[else
#f]))
#f])))
(provide/contract
[continuation-url? (url? . -> . (or/c false/c (list/c number? number? number?)))])