view 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 source

#{
	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
	}
}