# HG changeset patch # User Mike Pavone # Date 1376051315 25200 # Node ID 7f442b3e4448d97722a4e92dfcfee30c5726d714 # Parent 5071d601fe70dca4692fd5dd38a600ec7af8bba9 Tiny bit of work on HTTP client and sample usage of it diff -r 5071d601fe70 -r 7f442b3e4448 modules/http.tp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/http.tp Fri Aug 09 05:28:35 2013 -0700 @@ -0,0 +1,17 @@ +#{ + client:usingPort <- :address :port{ + #{ + get <- :path { + sock <- socket connectTo: address onPort: port + sock send: "GET " . path . " HTTP/1.1\r\nHost: " . address . "\r\n\r\n" + resp <- sock recv 4096 + print: resp + sock close + } + } + } + + client <- :address { + client: address usingPort: 80 + } +} diff -r 5071d601fe70 -r 7f442b3e4448 samples/http.tp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/http.tp Fri Aug 09 05:28:35 2013 -0700 @@ -0,0 +1,6 @@ +#{ + main <- { + cli <- http client: "rhope.retrodev.com" + print: (string: (cli get: "/")) + } +}