1 USING: accessors assocs http http.server.requests io.streams.string kernel
2 sequences tools.test urls ;
3 IN: http.server.requests.tests
5 ! content-length in combination with POST
10 "host: 127.0.0.1:55532"
11 "user-agent: Factor http.client"
15 } "\n" join [ read-request ] with-string-reader
16 [ post-data>> data>> ] [ header>> "content-length" of ] bi
23 "host: 127.0.0.1:55532"
24 "user-agent: Factor http.client"
28 } "\n" join [ read-request ] with-string-reader
29 [ post-data>> data>> ] [ header>> "content-length" of ] bi
32 ! RFC 2616: Section 4.1
33 ! In the interest of robustness, servers SHOULD ignore any empty
34 ! line(s) received where a Request-Line is expected. In other words, if
35 ! the server is reading the protocol stream at the beginning of a
36 ! message and receives a CRLF first, it should ignore the CRLF.
47 "\r\n\r\n\r\nGET / HTTP/1.0\r\n\r\n"
48 [ read-request ] with-string-reader
51 ! RFC 2616: Section 19.3
52 ! The line terminator for message-header fields is the sequence CRLF.
53 ! However, we recommend that applications, when parsing such headers,
54 ! recognize a single LF as a line terminator and ignore the leading CR.
59 "host: 127.0.0.1:55532"
60 "user-agent: Factor http.client"
61 } [ "\n" join ] [ "\r\n" join ] bi
62 [ [ read-request ] with-string-reader ] same?