open file URLs as html or text

svn: r1548
This commit is contained in:
Matthew Flatt 2005-12-07 01:43:19 +00:00
parent 88a6f81a50
commit 31ddc71387

View File

@ -325,9 +325,18 @@ A test case:
(erase)
(clear-undos)
(let* ([mime-type (extract-field "content-type" mime-headers)]
[html? (and mime-type (regexp-match #rx"text/html" mime-type))]
[text? (and mime-type (regexp-match #rx"text/plain" mime-type))])
[path-extension (and (not mime-type)
(url? url)
(let ([p (url-path url)])
(and (not (null? p))
(regexp-match #rx"[.][^.]*$"
(car (last-pair p))))))]
[html? (or (and mime-type (regexp-match #rx"text/html" mime-type))
(member path-extension '(".html" ".htm")))]
[text? (or (and mime-type (regexp-match #rx"text/plain" mime-type))
(member path-extension '(".txt"))
(and (url? url)
(equal? (url-scheme url) "file")))])
(cond
[(or (and mime-type (regexp-match #rx"application/" mime-type))
(and (url? url)