| 
									
										
										
										
											2008-07-04 01:16:27 -04:00
										 |  |  | USING: http http.server http.client tools.test multiline | 
					
						
							|  |  |  | tuple-syntax io.streams.string io.encodings.utf8 | 
					
						
							|  |  |  | io.encodings.8-bit io.encodings.binary io.encodings.string | 
					
						
							|  |  |  | kernel arrays splitting sequences assocs io.sockets db db.sqlite | 
					
						
							|  |  |  | continuations urls hashtables accessors ;
 | 
					
						
							| 
									
										
										
										
											2008-03-01 17:00:45 -05:00
										 |  |  | IN: http.tests | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-25 04:25:08 -04:00
										 |  |  | [ "text/plain" latin1 ] [ "text/plain" parse-content-type ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "text/html" utf8 ] [ "text/html;  charset=UTF-8" parse-content-type ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "application/octet-stream" binary ] [ "application/octet-stream" parse-content-type ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  | : lf>crlf "\n" split "\r\n" join ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | STRING: read-request-test-1 | 
					
						
							| 
									
										
										
										
											2008-06-12 19:53:53 -04:00
										 |  |  | POST /bar HTTP/1.1 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | Some-Header: 1
 | 
					
						
							|  |  |  | Some-Header: 2
 | 
					
						
							|  |  |  | Content-Length: 4
 | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  | Content-type: application/octet-stream | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | blah | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     TUPLE{ request | 
					
						
							| 
									
										
										
										
											2008-06-12 19:53:53 -04:00
										 |  |  |         url: TUPLE{ url path: "/bar" } | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |         method: "POST" | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |         version: "1.1" | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |         header: H{ { "some-header" "1; 2" } { "content-length" "4" } { "content-type" "application/octet-stream" } } | 
					
						
							|  |  |  |         post-data: TUPLE{ post-data content: "blah" raw: "blah" content-type: "application/octet-stream" } | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  |         cookies: V{ } | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | ] [ | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  |     read-request-test-1 lf>crlf [ | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |         read-request | 
					
						
							|  |  |  |     ] with-string-reader | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRING: read-request-test-1' | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  | POST /bar HTTP/1.1 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | content-length: 4
 | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  | content-type: application/octet-stream | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  | some-header: 1; 2
 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | blah | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | read-request-test-1' 1array [ | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  |     read-request-test-1 lf>crlf | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |     [ read-request ] with-string-reader | 
					
						
							|  |  |  |     [ write-request ] with-string-writer | 
					
						
							|  |  |  |     ! normalize crlf | 
					
						
							|  |  |  |     string-lines "\n" join
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRING: read-request-test-2 | 
					
						
							| 
									
										
										
										
											2008-06-12 19:53:53 -04:00
										 |  |  | HEAD  /bar   HTTP/1.1 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | Host: www.sex.com | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     TUPLE{ request | 
					
						
							| 
									
										
										
										
											2008-06-12 19:53:53 -04:00
										 |  |  |         url: TUPLE{ url host: "www.sex.com" path: "/bar" } | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |         method: "HEAD" | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  |         version: "1.1" | 
					
						
							|  |  |  |         header: H{ { "host" "www.sex.com" } } | 
					
						
							|  |  |  |         cookies: V{ } | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | ] [ | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  |     read-request-test-2 lf>crlf [ | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |         read-request | 
					
						
							|  |  |  |     ] with-string-reader | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-01 18:22:39 -04:00
										 |  |  | STRING: read-request-test-3 | 
					
						
							|  |  |  | GET nested HTTP/1.0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-18 01:36:20 -04:00
										 |  |  | [ read-request-test-3 lf>crlf [ read-request ] with-string-reader ] | 
					
						
							| 
									
										
										
										
											2008-06-01 18:22:39 -04:00
										 |  |  | [ "Bad request: URL" = ] | 
					
						
							|  |  |  | must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-18 01:36:20 -04:00
										 |  |  | STRING: read-request-test-4 | 
					
						
							|  |  |  | GET /blah HTTP/1.0 | 
					
						
							|  |  |  | Host: "www.amazon.com" | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "www.amazon.com" ] | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     read-request-test-4 lf>crlf [ read-request ] with-string-reader | 
					
						
							|  |  |  |     "host" header | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | STRING: read-response-test-1 | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  | HTTP/1.1 404 not found | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | Content-Type: text/html; charset=UTF-8 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | blah | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     TUPLE{ response | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  |         version: "1.1" | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |         code: 404
 | 
					
						
							|  |  |  |         message: "not found" | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  |         header: H{ { "content-type" "text/html; charset=UTF-8" } } | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |         cookies: { } | 
					
						
							| 
									
										
										
										
											2008-05-01 17:24:50 -04:00
										 |  |  |         content-type: "text/html" | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  |         content-charset: utf8 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |     } | 
					
						
							|  |  |  | ] [ | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  |     read-response-test-1 lf>crlf | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |     [ read-response ] with-string-reader | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRING: read-response-test-1' | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  | HTTP/1.1 404 not found | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | content-type: text/html; charset=UTF-8 | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | read-response-test-1' 1array [ | 
					
						
							| 
									
										
										
										
											2008-04-23 01:53:42 -04:00
										 |  |  |     read-response-test-1 lf>crlf | 
					
						
							| 
									
										
										
										
											2008-02-25 15:53:18 -05:00
										 |  |  |     [ read-response ] with-string-reader | 
					
						
							|  |  |  |     [ write-response ] with-string-writer | 
					
						
							|  |  |  |     ! normalize crlf | 
					
						
							|  |  |  |     string-lines "\n" join
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							|  |  |  |     "rmid=732423sdfs73242; path=/; domain=.example.net; expires=Fri, 31-Dec-2010 23:59:59 GMT" | 
					
						
							| 
									
										
										
										
											2008-06-18 01:36:20 -04:00
										 |  |  |     dup parse-set-cookie first unparse-set-cookie =
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							|  |  |  |     "a=" | 
					
						
							|  |  |  |     dup parse-set-cookie first unparse-set-cookie =
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRING: read-response-test-2 | 
					
						
							|  |  |  | HTTP/1.1 200 Content follows | 
					
						
							|  |  |  | Set-Cookie: oo="bar; a=b"; httponly=yes; sid=123456 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 2 ] [ | 
					
						
							|  |  |  |     read-response-test-2 lf>crlf | 
					
						
							|  |  |  |     [ read-response ] with-string-reader | 
					
						
							|  |  |  |     cookies>> length
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRING: read-response-test-3 | 
					
						
							|  |  |  | HTTP/1.1 200 Content follows | 
					
						
							|  |  |  | Set-Cookie: oo="bar; a=b"; comment="your mom"; httponly=yes | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 1 ] [ | 
					
						
							|  |  |  |     read-response-test-3 lf>crlf | 
					
						
							|  |  |  |     [ read-response ] with-string-reader | 
					
						
							|  |  |  |     cookies>> length
 | 
					
						
							| 
									
										
										
										
											2008-02-29 01:57:38 -05:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Live-fire exercise | 
					
						
							| 
									
										
										
										
											2008-06-13 21:54:52 -04:00
										 |  |  | USING: http.server http.server.static furnace.sessions furnace.alloy | 
					
						
							| 
									
										
										
										
											2008-06-16 04:34:17 -04:00
										 |  |  | furnace.actions furnace.auth furnace.auth.login furnace.db http.client | 
					
						
							| 
									
										
										
										
											2008-06-17 01:10:46 -04:00
										 |  |  | io.servers.connection io.files io io.encodings.ascii | 
					
						
							| 
									
										
										
										
											2008-06-02 16:00:03 -04:00
										 |  |  | accessors namespaces threads | 
					
						
							| 
									
										
										
										
											2008-06-17 06:25:21 -04:00
										 |  |  | http.server.responses http.server.redirection furnace.redirection | 
					
						
							| 
									
										
										
										
											2008-06-13 21:54:52 -04:00
										 |  |  | http.server.dispatchers db.tuples ;
 | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  | : add-quit-action | 
					
						
							|  |  |  |     <action> | 
					
						
							| 
									
										
										
										
											2008-06-01 18:22:39 -04:00
										 |  |  |         [ stop-server "Goodbye" "text/html" <content> ] >>display | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |     "quit" add-responder ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-26 02:44:45 -04:00
										 |  |  | : test-db "test.db" temp-file sqlite-db ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-01 17:24:50 -04:00
										 |  |  | [ test-db drop delete-file ] ignore-errors
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-26 02:44:45 -04:00
										 |  |  | test-db [ | 
					
						
							| 
									
										
										
										
											2008-06-13 21:54:52 -04:00
										 |  |  |     init-furnace-tables | 
					
						
							| 
									
										
										
										
											2008-04-26 02:44:45 -04:00
										 |  |  | ] with-db | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-25 17:58:19 -04:00
										 |  |  | : test-httpd ( -- )
 | 
					
						
							|  |  |  |     #! Return as soon as server is running. | 
					
						
							|  |  |  |     <http-server> | 
					
						
							|  |  |  |         1237 >>insecure | 
					
						
							|  |  |  |         f >>secure | 
					
						
							|  |  |  |     start-server* ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  | [ ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         <dispatcher> | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |             add-quit-action | 
					
						
							| 
									
										
										
										
											2008-04-14 05:34:26 -04:00
										 |  |  |             <dispatcher> | 
					
						
							| 
									
										
										
										
											2008-05-06 13:37:11 -04:00
										 |  |  |                 "resource:extra/http/test" <static> >>default | 
					
						
							| 
									
										
										
										
											2008-04-14 05:34:26 -04:00
										 |  |  |             "nested" add-responder | 
					
						
							| 
									
										
										
										
											2008-04-22 16:37:49 -04:00
										 |  |  |             <action> | 
					
						
							| 
									
										
										
										
											2008-06-02 16:00:03 -04:00
										 |  |  |                 [ URL" redirect-loop" <temporary-redirect> ] >>display | 
					
						
							| 
									
										
										
										
											2008-04-22 16:37:49 -04:00
										 |  |  |             "redirect-loop" add-responder | 
					
						
							| 
									
										
										
										
											2008-03-11 04:39:09 -04:00
										 |  |  |         main-responder set
 | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-25 17:58:19 -04:00
										 |  |  |         test-httpd | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  |     ] with-scope
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							| 
									
										
										
										
											2008-05-06 13:37:11 -04:00
										 |  |  |     "resource:extra/http/test/foo.html" ascii file-contents | 
					
						
							| 
									
										
										
										
											2008-06-25 21:47:07 -04:00
										 |  |  |     "http://localhost:1237/nested/foo.html" http-get nip =
 | 
					
						
							| 
									
										
										
										
											2008-04-14 05:34:26 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "http://localhost:1237/redirect-loop" http-get nip ] | 
					
						
							| 
									
										
										
										
											2008-04-22 16:37:49 -04:00
										 |  |  | [ too-many-redirects? ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  | [ "Goodbye" ] [ | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  |     "http://localhost:1237/quit" http-get nip
 | 
					
						
							| 
									
										
										
										
											2008-03-07 18:21:20 -05:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Dispatcher bugs | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         <dispatcher> | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |             <action> <protected> | 
					
						
							| 
									
										
										
										
											2008-06-16 04:34:17 -04:00
										 |  |  |             "Test" <login-realm> | 
					
						
							| 
									
										
										
										
											2008-04-29 06:58:34 -04:00
										 |  |  |             <sessions> | 
					
						
							| 
									
										
										
										
											2008-04-26 02:44:45 -04:00
										 |  |  |             "" add-responder | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |             add-quit-action | 
					
						
							|  |  |  |             <dispatcher> | 
					
						
							|  |  |  |                 <action> "a" add-main-responder | 
					
						
							|  |  |  |             "d" add-responder | 
					
						
							| 
									
										
										
										
											2008-04-26 02:44:45 -04:00
										 |  |  |         test-db <db-persistence> | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |         main-responder set
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-25 17:58:19 -04:00
										 |  |  |         test-httpd | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |     ] with-scope
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : 404? [ download-failed? ] [ response>> code>> 404 = ] bi and ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! This should give a 404 not an infinite redirect loop | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "http://localhost:1237/d/blah" http-get nip ] [ 404? ] must-fail-with | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! This should give a 404 not an infinite redirect loop | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "http://localhost:1237/blah/" http-get nip ] [ 404? ] must-fail-with | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "Goodbye" ] [ "http://localhost:1237/quit" http-get nip ] unit-test | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         <dispatcher> | 
					
						
							| 
									
										
										
										
											2008-06-01 18:22:39 -04:00
										 |  |  |             <action> [ [ "Hi" write ] "text/plain" <content> ] >>display | 
					
						
							| 
									
										
										
										
											2008-06-16 04:34:17 -04:00
										 |  |  |             "Test" <login-realm> | 
					
						
							| 
									
										
										
										
											2008-04-29 06:58:34 -04:00
										 |  |  |             <sessions> | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |             "" add-responder | 
					
						
							|  |  |  |             add-quit-action | 
					
						
							| 
									
										
										
										
											2008-04-26 02:44:45 -04:00
										 |  |  |         test-db <db-persistence> | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |         main-responder set
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-25 17:58:19 -04:00
										 |  |  |         test-httpd | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  |     ] with-scope
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "Hi" ] [ "http://localhost:1237/" http-get nip ] unit-test | 
					
						
							| 
									
										
										
										
											2008-04-25 04:23:47 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "Goodbye" ] [ "http://localhost:1237/quit" http-get nip ] unit-test | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-15 03:38:12 -04:00
										 |  |  | USING: html.components html.elements html.forms | 
					
						
							|  |  |  | xml xml.utilities validators | 
					
						
							| 
									
										
										
										
											2008-07-10 00:41:45 -04:00
										 |  |  | furnace furnace.conversations ;
 | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | SYMBOL: a | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         <dispatcher> | 
					
						
							|  |  |  |             <action> | 
					
						
							|  |  |  |                 [ a get-global "a" set-value ] >>init | 
					
						
							|  |  |  |                 [ [ <html> "a" <field> render </html> ] "text/html" <content> ] >>display | 
					
						
							|  |  |  |                 [ { { "a" [ v-integer ] } } validate-params ] >>validate | 
					
						
							|  |  |  |                 [ "a" value a set-global URL" " <redirect> ] >>submit | 
					
						
							| 
									
										
										
										
											2008-07-10 00:41:45 -04:00
										 |  |  |             <conversations> | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |             <sessions> | 
					
						
							|  |  |  |             >>default | 
					
						
							|  |  |  |             add-quit-action | 
					
						
							|  |  |  |         test-db <db-persistence> | 
					
						
							|  |  |  |         main-responder set
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-25 17:58:19 -04:00
										 |  |  |         test-httpd | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |     ] with-scope
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 3 a set-global
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : test-a string>xml "input" tag-named "value" swap at ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "3" ] [ | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  |     "http://localhost:1237/" http-get | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  |     swap dup cookies>> "cookies" set session-id-key get-cookie | 
					
						
							|  |  |  |     value>> "session-id" set test-a | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "4" ] [ | 
					
						
							|  |  |  |     H{ { "a" "4" } { "__u" "http://localhost:1237/" } } "session-id" get session-id-key associate assoc-union
 | 
					
						
							|  |  |  |     "http://localhost:1237/" <post-request> "cookies" get >>cookies http-request nip test-a | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 4 ] [ a get-global ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Test flash scope | 
					
						
							|  |  |  | [ "xyz" ] [ | 
					
						
							|  |  |  |     H{ { "a" "xyz" } { "__u" "http://localhost:1237/" } } "session-id" get session-id-key associate assoc-union
 | 
					
						
							| 
									
										
										
										
											2008-06-13 23:05:41 -04:00
										 |  |  |     "http://localhost:1237/" <post-request> "cookies" get >>cookies http-request nip test-a | 
					
						
							| 
									
										
										
										
											2008-06-04 20:54:05 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 4 ] [ a get-global ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-12 04:50:20 -04:00
										 |  |  | [ "Goodbye" ] [ "http://localhost:1237/quit" http-get nip ] unit-test | 
					
						
							| 
									
										
										
										
											2008-06-16 02:35:06 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Test cloning | 
					
						
							|  |  |  | [ f ] [ <404> dup clone "b" "a" set-header drop "a" header ] unit-test | 
					
						
							|  |  |  | [ f ] [ <404> dup clone "b" "a" <cookie> put-cookie drop "a" get-cookie ] unit-test |