examples/http1_parser.rb in tipi-0.41 vs examples/http1_parser.rb in tipi-0.42
- old
+ new
@@ -29,25 +29,27 @@
trace '*' * 40
headers = parser.parse_headers
break unless headers
trace headers
- body = parser.read_body(headers)
+ body = parser.read_body
trace "body: #{body ? body.bytesize : 0} bytes"
+ trace body if body && body.bytesize < 80
end
end
o << "GET /a HTTP/1.1\r\n\r\n"
-o << "GET /b HTTP/1.1\r\n\r\n"
+# o << "GET /a HTTP/1.1\r\nContent-Length: 0\r\n\r\n"
+
# o << "GET / HTTP/1.1\r\nHost: localhost:10080\r\nUser-Agent: curl/7.74.0\r\nAccept: */*\r\n\r\n"
-# o << "post /?q=time&blah=blah HTTP/1\r\nHost: dev.realiteq.net\r\n\r\n"
+o << "post /?q=time&blah=blah HTTP/1\r\nTransfer-Encoding: chunked\r\n\r\na\r\nabcdefghij\r\n0\r\n\r\n"
-# data = " " * 4000000
-# o << "get /?q=time HTTP/1.1\r\nContent-Length: #{data.bytesize}\r\n\r\n#{data}"
+data = " " * 4000000
+o << "get /?q=time HTTP/1.1\r\nContent-Length: #{data.bytesize}\r\n\r\n#{data}"
-# o << "get /?q=time HTTP/1.1\r\nCookie: foo\r\nCookie: bar\r\n\r\n"
+o << "get /?q=time HTTP/1.1\r\nCookie: foo\r\nCookie: bar\r\n\r\n"
-# o.close
-
+o.close
+
f.await