1 USING: accessors io.sockets.secure http.client http.client.private http
2 io.streams.string kernel namespaces sequences tools.test urls ;
5 { "localhost" f } [ "localhost" parse-host ] unit-test
6 { "localhost" 8888 } [ "localhost:8888" parse-host ] unit-test
8 { "foo.txt" } [ "http://www.paulgraham.com/foo.txt" download-name ] unit-test
9 { "foo.txt" } [ "http://www.arc.com/foo.txt?xxx" download-name ] unit-test
10 { "foo.txt" } [ "http://www.arc.com/foo.txt/" download-name ] unit-test
11 { "www.arc.com" } [ "http://www.arc.com////" download-name ] unit-test
15 { url T{ url { protocol "http" } { host "www.apple.com" } { port 80 } { path "/index.html" } } }
19 { header H{ { "connection" "close" } { "user-agent" "Factor http.client" } } }
23 "http://www.apple.com/index.html"
29 { url T{ url { protocol "https" } { host "www.amazon.com" } { port 443 } { path "/index.html" } } }
33 { header H{ { "connection" "close" } { "user-agent" "Factor http.client" } } }
37 "https://www.amazon.com/index.html"
41 { "HEAD" } [ "http://google.com" <head-request> method>> ] unit-test
42 { "DELETE" } [ "http://arc.com" <delete-request> method>> ] unit-test
43 { "TRACE" } [ "http://concatenative.org" <trace-request> method>> ] unit-test
44 { "OPTIONS" } [ "http://factorcode.org" <options-request> method>> ] unit-test
46 "https://alice.sni.velox.ch" http-get nip
47 [ "Great!" swap subseq? ]
48 [ "TLS SNI Test Site: alice.sni.velox.ch" swap subseq? ] bi and
53 "HTTP/1.1 200 Document follows"
55 "content-type: text/html; charset=UTF-8"
56 "date: Wed, 12 Oct 2011 18:57:49 GMT"
57 "server: Factor http.server"
58 } [ "\n" join ] [ "\r\n" join ] bi
59 [ [ read-response ] with-string-reader ] same?