Could you please comment on 7f9818b?<div><br></div><div>It changes URLs to be able to represent "there, but empty" query components, but this changes the invariant that URL query components were always lists, which I think is better than putting in extraneous ?s</div>
<div><br></div><div>Jay<br><br><div class="gmail_quote">On Wed, Nov 23, 2011 at 11:00 AM, <span dir="ltr"><<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
jay has updated `master' from 6a99c93ebb to 9d8d36e568.<br>
<a href="http://git.racket-lang.org/plt/6a99c93ebb..9d8d36e568" target="_blank">http://git.racket-lang.org/plt/6a99c93ebb..9d8d36e568</a><br>
<br>
=====[ 6 Commits ]======================================================<br>
<br>
Directory summary:<br>
14.7% collects/net/<br>
52.1% collects/tests/net/<br>
5.7% collects/tests/plai/<br>
15.4% collects/tests/web-server/pr/<br>
6.8% collects/web-server/scribblings/<br>
4.7% collects/web-server/<br>
<br>
~~~~~~~~~~<br>
<br>
d64d620 Jay McCarthy <<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>> 2011-11-23 09:44<br>
:<br>
| Fixing PR10485<br>
:<br>
A collects/tests/plai/datatype-coverage.rkt<br>
<br>
~~~~~~~~~~<br>
<br>
7f9818b Jay McCarthy <<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>> 2011-11-23 10:35<br>
:<br>
| This fixes 10497 and potentially breaks programs that assume the query of a URL is always a list. I have fixed uses in the Web Server, which I expect is the major thing affected, but much more could be. Therefore I am skeptical this is a good idea just for the representation of ?. So, I'd like other people to review the change and let me know if they think I should revert it.<br>
:<br>
M collects/net/url.rkt | 14 +-<br>
M collects/net/url-structs.rkt | 2 +-<br>
M collects/tests/net/url.rkt | 81 ++++---<br>
M collects/unstable/net/url.rkt | 2 +-<br>
M collects/web-server/dispatch/syntax.rkt | 2 +-<br>
M collects/web-server/http/request.rkt | 2 +-<br>
M .../default-web-root/htdocs/lang-servlets/add01.rkt | 4 +-<br>
<br>
~~~~~~~~~~<br>
<br>
ccd5061 Jay McCarthy <<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>> 2011-11-23 10:36<br>
:<br>
| Forgot to include doc change<br>
:<br>
M collects/net/scribblings/url.scrbl | 2 +-<br>
<br>
~~~~~~~~~~<br>
<br>
ce6eab6 Jay McCarthy <<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>> 2011-11-23 10:50<br>
:<br>
| Showing that 10546 is fixed<br>
:<br>
A collects/tests/web-server/pr/10546.rkt<br>
<br>
~~~~~~~~~~<br>
<br>
5bd12bb Jay McCarthy <<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>> 2011-11-23 10:55<br>
:<br>
| Clarifying syntax in docs<br>
:<br>
M collects/web-server/scribblings/templates.scrbl | 5 +++--<br>
<br>
~~~~~~~~~~<br>
<br>
9d8d36e Jay McCarthy <<a href="mailto:jay@racket-lang.org">jay@racket-lang.org</a>> 2011-11-23 10:58<br>
:<br>
| Demonstrating that 10772 is fixed<br>
:<br>
M collects/tests/plai/datatype.rkt | 2 ++<br>
<br>
=====[ Overall Diff ]===================================================<br>
<br>
collects/net/scribblings/url.scrbl<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/net/scribblings/url.scrbl<br>
+++ NEW/collects/net/scribblings/url.scrbl<br>
@@ -38,7 +38,7 @@ re-exported by @racketmodname[net/url].}<br>
[port (or/c false/c exact-nonnegative-integer?)]<br>
[path-absolute? boolean?]<br>
[path (listof path/param?)]<br>
- [query (listof (cons/c symbol? (or/c false/c string?)))]<br>
+ [query (or/c false/c (listof (cons/c symbol? (or/c false/c string?))))]<br>
[fragment (or/c false/c string?)])]{<br>
<br>
The basic structure for all URLs, which is explained in RFC 3986<br>
<br>
collects/net/url-structs.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/net/url-structs.rkt<br>
+++ NEW/collects/net/url-structs.rkt<br>
@@ -13,7 +13,7 @@<br>
[port (or/c false/c number?)]<br>
[path-absolute? boolean?]<br>
[path (listof path/param?)]<br>
- [query (listof (cons/c symbol? (or/c string? false/c)))]<br>
+ [query (or/c false/c (listof (cons/c symbol? (or/c string? false/c))))]<br>
[fragment (or/c false/c string?)]))<br>
(struct path/param ([path (or/c string? (symbols 'up 'same))]<br>
[param (listof string?)])))<br>
<br>
collects/net/url.rkt<br>
~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/net/url.rkt<br>
+++ NEW/collects/net/url.rkt<br>
@@ -76,7 +76,11 @@<br>
""))<br>
(combine-path-strings (url-path-absolute? url) path)<br>
;; (if query (sa "?" (uri-encode query)) "")<br>
- (if (null? query) "" (sa "?" (alist->form-urlencoded query)))<br>
+ (if query<br>
+ (if (null? query)<br>
+ "?"<br>
+ (sa "?" (alist->form-urlencoded query)))<br>
+ "")<br>
(if fragment (sa "#" (uri-encode fragment)) ""))))<br>
<br>
;; url->default-port : url -> num<br>
@@ -259,7 +263,7 @@<br>
;; transliteration of code in rfc 3986, section 5.2.2<br>
(define (combine-url/relative Base string)<br>
(let ([R (string->url string)]<br>
- [T (make-url #f #f #f #f #f '() '() #f)])<br>
+ [T (make-url #f #f #f #f #f '() #f #f)])<br>
(if (url-scheme R)<br>
(begin<br>
(set-url-scheme! T (url-scheme R))<br>
@@ -283,7 +287,7 @@<br>
(begin<br>
(set-url-path-absolute?! T (url-path-absolute? Base))<br>
(set-url-path! T (url-path Base))<br>
- (if (not (null? (url-query R)))<br>
+ (if (url-query R)<br>
(set-url-query! T (url-query R))<br>
(set-url-query! T (url-query Base))))<br>
(begin<br>
@@ -485,7 +489,7 @@<br>
[path (if win-file?<br>
(separate-windows-path-strings path)<br>
(separate-path-strings path))]<br>
- [query (if query (form-urlencoded->alist query) '())]<br>
+ [query (if query (form-urlencoded->alist query) #f)]<br>
[fragment (uri-decode/maybe fragment)])<br>
(make-url scheme user host port abs? path query fragment))))<br>
(cdr (or (regexp-match url-rx str)<br>
@@ -574,7 +578,7 @@<br>
(if (eq? base 'relative)<br>
accum<br>
(loop base accum)))])))])<br>
- (make-url "file" #f "" #f (absolute-path? path) url-path '() #f)))<br>
+ (make-url "file" #f "" #f (absolute-path? path) url-path #f #f)))<br>
<br>
(define (url->path url [kind (system-path-convention-type)])<br>
(file://->path url kind))<br>
<br>
collects/tests/net/url.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/tests/net/url.rkt<br>
+++ NEW/collects/tests/net/url.rkt<br>
@@ -1,6 +1,6 @@<br>
#lang scheme<br>
(require net/url tests/eli-tester<br>
- (only-in net/uri-codec current-alist-separator-mode))<br>
+ (only-in net/uri-codec current-alist-separator-mode uri-encode))<br>
<br>
(define (url->vec url)<br>
(vector<br>
@@ -50,29 +50,29 @@<br>
(current-proxy-servers))<br>
=> '(("http" "<a href="http://proxy.com" target="_blank">proxy.com</a>" 3128)))<br>
<br>
- (test-s->u #(#f #f #f #f #t (#("")) () #f)<br>
+ (test-s->u #(#f #f #f #f #t (#("")) #f #f)<br>
"/")<br>
- (test-s->u #(#f #f #f #f #f () () #f)<br>
+ (test-s->u #(#f #f #f #f #f () #f #f)<br>
"")<br>
<br>
- (test-s->u #("http" #f #f #f #t (#("")) () #f)<br>
+ (test-s->u #("http" #f #f #f #t (#("")) #f #f)<br>
"http:/")<br>
<br>
- (test-s->u #("http" #f "" #f #t (#("")) () #f)<br>
+ (test-s->u #("http" #f "" #f #t (#("")) #f #f)<br>
"http:///")<br>
<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #f () () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #f () #f #f)<br>
"<a href="http://www.drscheme.org" target="_blank">http://www.drscheme.org</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("")) #f #f)<br>
"<a href="http://www.drscheme.org/" target="_blank">http://www.drscheme.org/</a>")<br>
<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) #f #f)<br>
"<a href="http://www.drscheme.org/a/b/c" target="_blank">http://www.drscheme.org/a/b/c</a>")<br>
- (test-s->u #("http" "robby" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) () #f)<br>
+ (test-s->u #("http" "robby" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) #f #f)<br>
"<a href="http://robby@www.drscheme.org/a/b/c" target="_blank">http://robby@www.drscheme.org/a/b/c</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" 8080 #t (#("a") #("b") #("c")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" 8080 #t (#("a") #("b") #("c")) #f #f)<br>
"<a href="http://www.drscheme.org:8080/a/b/c" target="_blank">http://www.drscheme.org:8080/a/b/c</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) () "joe")<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) #f "joe")<br>
"<a href="http://www.drscheme.org/a/b/c#joe" target="_blank">http://www.drscheme.org/a/b/c#joe</a>")<br>
(test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) ((tim . "")) #f)<br>
"<a href="http://www.drscheme.org/a/b/c?tim=" target="_blank">http://www.drscheme.org/a/b/c?tim=</a>")<br>
@@ -90,53 +90,53 @@<br>
(parameterize ([current-alist-separator-mode 'amp])<br>
(test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) ((tam . "tom") (pam . "pom")) "joe")<br>
"<a href="http://www.drscheme.org/a/b/c?tam=tom&pam=pom#joe" target="_blank">http://www.drscheme.org/a/b/c?tam=tom&pam=pom#joe</a>"))<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c" "b")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c" "b")) #f #f)<br>
"<a href="http://www.drscheme.org/a/b/c;b" target="_blank">http://www.drscheme.org/a/b/c;b</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a" "x") #("b") #("c" "b")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a" "x") #("b") #("c" "b")) #f #f)<br>
"<a href="http://www.drscheme.org/a;x/b/c;b" target="_blank">http://www.drscheme.org/a;x/b/c;b</a>")<br>
<br>
;; test unquoting for %<br>
(test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a") #("b") #("c")) ((ti#m . "")) "jo e")<br>
"<a href="http://www.drscheme.org/a/b/c?ti%23m=#jo%20e" target="_blank">http://www.drscheme.org/a/b/c?ti%23m=#jo%20e</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a " " a") #(" b ") #(" c ")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a " " a") #(" b ") #(" c ")) #f #f)<br>
"<a href="http://www.drscheme.org/a%20;%20a/%20b%20/%20c%20" target="_blank">http://www.drscheme.org/a%20;%20a/%20b%20/%20c%20</a>")<br>
- (test-s->u #("http" "robb y" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("http" "robb y" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("")) #f #f)<br>
"<a href="http://robb" target="_blank">http://robb</a>%<a href="http://20y@www.drscheme.org/" target="_blank">20y@www.drscheme.org/</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("%a") #("b/") #("c")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("%a") #("b/") #("c")) #f #f)<br>
"<a href="http://www.drscheme.org/%25a/b%2F/c" target="_blank">http://www.drscheme.org/%25a/b%2F/c</a>")<br>
- (test-s->u #("http" "robby:password" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("http" "robby:password" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("")) #f #f)<br>
"<a href="http://robby:password@www.drscheme.org/" target="_blank">http://robby:password@www.drscheme.org/</a>")<br>
(test "robby:password" (lambda (x) (url-user (string->url x))) "<a href="http://robby" target="_blank">http://robby</a>%<a href="http://3apassword@www.drscheme.org/" target="_blank">3apassword@www.drscheme.org/</a>")<br>
<br>
;; test the characters that need to be encoded in paths vs those that do not need to<br>
;; be encoded in paths<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a:@!$&'()*+,=z") #("/?#[];") #("")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a:@!$&'()*+,=z") #("/?#[];") #("")) #f #f)<br>
"<a href="http://www.drscheme.org/a:@!$&'()*+,=z/%2F%3F%23%5B%5D%3B/" target="_blank">http://www.drscheme.org/a:@!$&'()*+,=z/%2F%3F%23%5B%5D%3B/</a>")<br>
<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#(".") #("..") #(same) #(up) #("...") #("abc.def")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#(".") #("..") #(same) #(up) #("...") #("abc.def")) #f #f)<br>
"<a href="http://www.drscheme.org/%2e/%2e%2e/./../.../abc.def" target="_blank">http://www.drscheme.org/%2e/%2e%2e/./../.../abc.def</a>")<br>
- (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("." "") #(".." "") #(same "") #(up "") #("..." "") #("abc.def" "")) () #f)<br>
+ (test-s->u #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("." "") #(".." "") #(same "") #(up "") #("..." "") #("abc.def" "")) #f #f)<br>
"<a href="http://www.drscheme.org/%2e;/%2e%2e;/.;/..;/...;/abc.def" target="_blank">http://www.drscheme.org/%2e;/%2e%2e;/.;/..;/...;/abc.def</a>;")<br>
<br>
;; test other scheme identifiers<br>
- (test-s->u #("blah" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("blah" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) #f #f)<br>
"blah://<a href="http://www.foo.com/" target="_blank">www.foo.com/</a>")<br>
- (test-s->u #("blah99" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("blah99" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) #f #f)<br>
"blah99://<a href="http://www.foo.com/" target="_blank">www.foo.com/</a>")<br>
- (test-s->u #("blah+" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("blah+" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) #f #f)<br>
"blah+://<a href="http://www.foo.com/" target="_blank">www.foo.com/</a>")<br>
- (test-s->u #("a+b-c456.d" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) () #f)<br>
+ (test-s->u #("a+b-c456.d" #f "<a href="http://www.foo.com" target="_blank">www.foo.com</a>" #f #t (#("")) #f #f)<br>
"a+b-c456.d://<a href="http://www.foo.com/" target="_blank">www.foo.com/</a>")<br>
<br>
;; a colon and other junk (`sub-delims') can appear in usernames<br>
- (test #("http" "x:!$&'()*+,;=y" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a")) () #f)<br>
+ (test #("http" "x:!$&'()*+,;=y" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #t (#("a")) #f #f)<br>
string->url/vec<br>
"http://x:!$&'()*+,;=<a href="http://y@www.drscheme.org/a" target="_blank">y@www.drscheme.org/a</a>")<br>
;; a colon and atsign can appear in absolute paths<br>
- (test-s->u #(#f #f #f #f #t (#("x:@y") #("z")) () #f)<br>
+ (test-s->u #(#f #f #f #f #t (#("x:@y") #("z")) #f #f)<br>
"/x:@y/z")<br>
;; and in relative paths as long as it's not in the first element<br>
- (test-s->u #(#f #f #f #f #f (#("x") #("y:@z")) () #f)<br>
+ (test-s->u #(#f #f #f #f #f (#("x") #("y:@z")) #f #f)<br>
"x/y:@z")<br>
<br>
;; test bad schemes<br>
@@ -148,38 +148,38 @@<br>
(string->url "a b://<a href="http://www.foo.com/" target="_blank">www.foo.com/</a>") =error> url-exception?)<br>
<br>
;; test file: urls<br>
- (test-s->u #("file" #f "" #f #t (#("abc") #("def.html")) () #f)<br>
+ (test-s->u #("file" #f "" #f #t (#("abc") #("def.html")) #f #f)<br>
"file:///abc/def.html")<br>
(test (url->string (string->url "file:///abc/def.html"))<br>
=> "file:///abc/def.html")<br>
(parameterize ([file-url-path-convention-type 'unix])<br>
(test (url->string (string->url "file://a/b"))<br>
=> "file://a/b")<br>
- (test-s->u #("file" #f "localhost" #f #t (#("abc") #("def.html")) () #f)<br>
+ (test-s->u #("file" #f "localhost" #f #t (#("abc") #("def.html")) #f #f)<br>
"file://localhost/abc/def.html"))<br>
<br>
;; test files: urls with colons, and the different parsing on Windows<br>
- (test-s->u #("file" #f "localhost" 123 #t (#("abc") #("def.html")) () #f)<br>
+ (test-s->u #("file" #f "localhost" 123 #t (#("abc") #("def.html")) #f #f)<br>
"file://localhost:123/abc/def.html")<br>
(parameterize ([file-url-path-convention-type 'unix])<br>
;; different parse for file://foo:/...<br>
(test (string->url/vec "file://foo:/abc/def.html")<br>
- => #("file" #f "foo" #f #t (#("abc") #("def.html")) () #f)))<br>
+ => #("file" #f "foo" #f #t (#("abc") #("def.html")) #f #f)))<br>
(parameterize ([file-url-path-convention-type 'windows])<br>
(test (string->url/vec "file://foo:/abc/def.html")<br>
- => #("file" #f "" #f #t (#("foo:") #("abc") #("def.html")) () #f)<br>
+ => #("file" #f "" #f #t (#("foo:") #("abc") #("def.html")) #f #f)<br>
(string->url/vec "file://c:/abc/def.html")<br>
- => #("file" #f "" #f #t (#("c:") #("abc") #("def.html")) () #f)<br>
+ => #("file" #f "" #f #t (#("c:") #("abc") #("def.html")) #f #f)<br>
(string->url/vec "file:\\\\d\\c\\abc\\def.html")<br>
- => #("file" #f "" #f #t (#("") #("d") #("c") #("abc") #("def.html")) () #f)))<br>
+ => #("file" #f "" #f #t (#("") #("d") #("c") #("abc") #("def.html")) #f #f)))<br>
<br>
(parameterize ([file-url-path-convention-type 'unix])<br>
;; but no effect on http://foo:/...<br>
(test (string->url/vec "http://foo:/abc/def.html")<br>
- => #("http" #f "foo" #f #t (#("abc") #("def.html")) () #f)))<br>
+ => #("http" #f "foo" #f #t (#("abc") #("def.html")) #f #f)))<br>
(parameterize ([file-url-path-convention-type 'windows])<br>
(test (string->url/vec "http://foo:/abc/def.html")<br>
- => #("http" #f "foo" #f #t (#("abc") #("def.html")) () #f)))<br>
+ => #("http" #f "foo" #f #t (#("abc") #("def.html")) #f #f)))<br>
<br>
(test (url->string (path->url (bytes->path #"c:\\a\\b" 'windows)))<br>
=> "file:///c:/a/b"<br>
@@ -228,7 +228,7 @@<br>
"<a href="HTTP://ROBBY@WWW.DRSCHEME.ORG:80/INDEX.HTML;XXX?T=P#YYY" target="_blank">HTTP://ROBBY@WWW.DRSCHEME.ORG:80/INDEX.HTML;XXX?T=P#YYY</a>")<br>
=> #("http" "ROBBY" "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" 80 #t (#("INDEX.HTML" "XXX")) ((T . "P")) "YYY"))<br>
<br>
- (test-s->u #("mailto" #f #f #f #f (#("<a href="mailto:robby@racket-lang.org">robby@racket-lang.org</a>")) () #f)<br>
+ (test-s->u #("mailto" #f #f #f #f (#("<a href="mailto:robby@racket-lang.org">robby@racket-lang.org</a>")) #f #f)<br>
"mailto:<a href="mailto:robby@racket-lang.org">robby@racket-lang.org</a>")<br>
<br>
(test (string->url/vec "<a href="http://www.drscheme.org?bar=%E9%A6%A8%E6%85%A7%22" target="_blank">http://www.drscheme.org?bar=馨慧"</a>)<br>
@@ -238,7 +238,7 @@<br>
=> #("http" #f "<a href="http://www.drscheme.org" target="_blank">www.drscheme.org</a>" #f #f () ((bár . "é")) #f))<br>
<br>
(test-c-u/r "<a href="http://www.drscheme.org" target="_blank">http://www.drscheme.org</a>"<br>
- (make-url #f #f #f #f #f '() '() #f)<br>
+ (make-url #f #f #f #f #f '() #f #f)<br>
"<a href="http://www.drscheme.org" target="_blank">http://www.drscheme.org</a>")<br>
<br>
(test-c-u/r "<a href="http://www.drscheme.org" target="_blank">http://www.drscheme.org</a>"<br>
@@ -351,6 +351,11 @@<br>
<br>
))<br>
<br>
+ ;; PR 10497<br>
+ (test<br>
+ (url->string (url #f #f #f #f #f empty empty #f)) => "?"<br>
+ (url->string (url #f #f #f #f #f empty #f #f)) => "")<br>
+<br>
)<br>
<br>
(provide tests)<br>
<br>
collects/tests/plai/datatype-coverage.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- /dev/null<br>
+++ NEW/collects/tests/plai/datatype-coverage.rkt<br>
@@ -0,0 +1,11 @@<br>
+#lang plai<br>
+;; RE: PR10485<br>
+(define-type toy<br>
+ [airplane (lift number?) (name string?)])<br>
+<br>
+(type-case toy (airplane 3412 "the bat!")<br>
+ [airplane (lift name) (+ lift 13)])<br>
+<br>
+;; The body of this function should be the only red in the file<br>
+(define (f x)<br>
+ (+ 1 1))<br>
\ No newline at end of file<br>
<br>
collects/tests/plai/datatype.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/tests/plai/datatype.rkt<br>
+++ NEW/collects/tests/plai/datatype.rkt<br>
@@ -57,4 +57,6 @@<br>
(type-case "foo" "bar") =error> "this must be a type defined with define-type"<br>
<br>
(type-case + "bar") =error> "this must be a type defined with define-type"<br>
+<br>
+ (type-case #f [x () 1]) =error> "this must be a type defined with define-type"<br>
)<br>
<br>
collects/tests/web-server/pr/10546.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- /dev/null<br>
+++ NEW/collects/tests/web-server/pr/10546.rkt<br>
@@ -0,0 +1,55 @@<br>
+#lang racket<br>
+<br>
+(define here (current-directory))<br>
+(define txt (build-path here "some.txt"))<br>
+<br>
+(with-output-to-file txt<br>
+ #:exists 'replace<br>
+ (lambda ()<br>
+ (display #<<END<br>
+Here is some text that looks at @this<br>
+END<br>
+ )))<br>
+<br>
+(with-output-to-file "relative.rkt"<br>
+ #:exists 'replace<br>
+ (lambda ()<br>
+ (display #<<END<br>
+#lang racket<br>
+(require web-server/templates)<br>
+(provide ans)<br>
+<br>
+(define this 5)<br>
+(define ans (include-template "some.txt"))<br>
+END<br>
+ )))<br>
+<br>
+(with-output-to-file "absolute.rkt"<br>
+ #:exists 'replace<br>
+ (lambda ()<br>
+ (display #<<END<br>
+#lang racket<br>
+(require web-server/templates)<br>
+(provide ans)<br>
+<br>
+(define this 5)<br>
+(define ans (include-template (file "<br>
+END<br>
+ )<br>
+<br>
+ (display (path->string txt))<br>
+<br>
+(display #<<END<br>
+")))<br>
+END<br>
+)))<br>
+<br>
+(require tests/eli-tester)<br>
+(define rel (dynamic-require "relative.rkt" 'ans))<br>
+(define abs (dynamic-require "absolute.rkt" 'ans))<br>
+(test<br>
+ rel => abs<br>
+ rel => "Here is some text that looks at 5")<br>
+<br>
+<br>
+<br>
<br>
collects/unstable/net/url.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/unstable/net/url.rkt<br>
+++ NEW/collects/unstable/net/url.rkt<br>
@@ -20,7 +20,7 @@<br>
(url-port in-url)<br>
(url-path-absolute? in-url)<br>
new-path<br>
- empty<br>
+ #f<br>
(url-fragment in-url))))<br>
;; Eli: if it also removes the query, this it's a bad name, and it's<br>
;; questionable whether it is general enough. Why not make it into a<br>
<br>
collects/web-server/default-web-root/htdocs/lang-servlets/add01.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/web-server/default-web-root/htdocs/lang-servlets/add01.rkt<br>
+++ NEW/collects/web-server/default-web-root/htdocs/lang-servlets/add01.rkt<br>
@@ -8,7 +8,7 @@<br>
(let* ([uri (request-uri req)]<br>
[qry (url-query uri)])<br>
(cond<br>
- [(assoc 'second qry)<br>
+ [(and qry (assoc 'second qry))<br>
=> (lambda (a-pair)<br>
(response/xexpr<br>
`(html (head (title "Answer Page"))<br>
@@ -17,7 +17,7 @@<br>
(p ,(format "The answer is: ~a"<br>
(+ (string->number (cdr a-pair))<br>
(string->number (cdr (assoc 'first qry))))))))))]<br>
- [(assoc 'first qry)<br>
+ [(and qry (assoc 'first qry))<br>
=> (lambda (a-pair)<br>
(response/xexpr<br>
`(html (head (title "Second Page"))<br>
<br>
collects/web-server/dispatch/syntax.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/web-server/dispatch/syntax.rkt<br>
+++ NEW/collects/web-server/dispatch/syntax.rkt<br>
@@ -16,7 +16,7 @@<br>
(list (make-path/param "" empty))<br>
(map (lambda (s) (make-path/param s empty))<br>
strlist))<br>
- empty #f)))<br>
+ #f #f)))<br>
<br>
(define-syntax (dispatch-case stx)<br>
(syntax-case stx (else)<br>
<br>
collects/web-server/http/request.rkt<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/web-server/http/request.rkt<br>
+++ NEW/collects/web-server/http/request.rkt<br>
@@ -177,7 +177,7 @@<br>
(make-binding:form (string->bytes/utf-8 (symbol->string k))<br>
(string->bytes/utf-8 v))<br>
#f)])<br>
- (url-query uri))))<br>
+ (or (url-query uri) empty))))<br>
#f)]<br>
[(bytes-ci=? #"POST" meth)<br>
(local<br>
<br>
collects/web-server/scribblings/templates.scrbl<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
--- OLD/collects/web-server/scribblings/templates.scrbl<br>
+++ NEW/collects/web-server/scribblings/templates.scrbl<br>
@@ -2,6 +2,7 @@<br>
@(require "web-server.rkt")<br>
@(require (for-label web-server/servlet<br>
web-server/templates<br>
+ racket/include<br>
racket/promise<br>
racket/list<br>
xml))<br>
@@ -358,8 +359,8 @@ the template to be unescaped, then create a @racket[cdata] structure:<br>
<br>
@section{API Details}<br>
<br>
-@defform[(include-template path)]{<br>
- Compiles the template at @racket[path] using the @at-reader-ref syntax within the enclosing lexical context.<br>
+@defform[(include-template path-spec)]{<br>
+ Compiles the template at @racket[path-spec] using the @at-reader-ref syntax within the enclosing lexical context. The @racket[path-spec] is the same format used by @racket[include].<br>
<br>
Example:<br>
@racketblock[<br>
</blockquote></div><br></div>