diff --git a/Makefile b/Makefile index 329e61b..2b8c802 100644 --- a/Makefile +++ b/Makefile @@ -7,14 +7,14 @@ all: .setup test: .setup raco test -p smol-http -run: all +run: ifndef FB_USERNAME $(error "Provide FB_USERNAME variable") endif ifndef FB_PASSWORD $(error "Provide FB_PASSWORD variable") endif - ./webcrawler $(USERNAME) $(PASSWORD) + ./webcrawler $(FB_USERNAME) $(FB_PASSWORD) .setup: raco pkg install smol-http/ diff --git a/smol-http/util.rkt b/smol-http/util.rkt index ebbdc4d..0b3b915 100644 --- a/smol-http/util.rkt +++ b/smol-http/util.rkt @@ -31,7 +31,7 @@ (define (->bytes x) (if (bytes? x) x - (string->bytes/latin-1 (format "~a" x)))) + (string->bytes/utf-8 (format "~a" x)))) (module+ test (let ([b #"hello"]) (check-eq? (->bytes b) b)) diff --git a/webcrawler b/webcrawler index a05e711..44619ce 100755 --- a/webcrawler +++ b/webcrawler @@ -3,8 +3,12 @@ ; vim: ft=racket (require smol-http) +(define DEFAULT-HDRS '((user-agent . "🦈 hash-lang-uwu crawler v1.0") + ;; christo pls do not track thanks + (dnt . "1"))) + (define req - (make-http-req 'GET "/hello-world")) + (make-http-req 'GET "/hello-world" DEFAULT-HDRS)) (define (run-webcrawler username password) (printf "the credentials are: ~s ~s\n" username password)