wisp

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bd852355946fe8cdb7dd1bb36e2fe760cd474bc0
parent bda4c26f8788a204d27bd5730019ce20ba84da98
Author: rsiddharth <s@ricketyspace.net>
Date:   Wed,  5 Jun 2019 19:27:38 -0400

hn: Add fp.

* hn (fp): New function.
(HOST): New constant.

Diffstat:
hn | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/hn b/hn @@ -7,3 +7,17 @@ #lang racket/base +(require net/http-client) +(require racket/port) +(require openssl) + +(define HOST "news.ycombinator.com") + +(define (fp) + "Fetch HN Front Page." + (let ((hc (http-conn-open HOST + #:ssl? (ssl-make-client-context 'secure) + #:port 443))) + (define-values (status headers port) + (http-conn-sendrecv! hc "/")) + (port->string port)))