diff modules/http.tp @ 149:7f442b3e4448

Tiny bit of work on HTTP client and sample usage of it
author Mike Pavone <pavone@retrodev.com>
date Fri, 09 Aug 2013 05:28:35 -0700
parents
children 075b1e71feff
line wrap: on
line diff
--- /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
+	}
+}