summaryrefslogtreecommitdiffstats
path: root/hn/g
diff options
context:
space:
mode:
Diffstat (limited to 'hn/g')
-rwxr-xr-xhn/g24
1 files changed, 24 insertions, 0 deletions
diff --git a/hn/g b/hn/g
new file mode 100755
index 0000000..db168e0
--- /dev/null
+++ b/hn/g
@@ -0,0 +1,24 @@
+#!/usr/bin/env racket
+;;
+;; SPDX-License-Identifier: ISC
+;;
+;; Copyright © 2019 rsiddharth <s@ricketyspace.net>
+;;
+
+#lang racket/base
+
+(require net/http-client)
+(require racket/port)
+(require sxml/sxpath)
+(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)))