[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: http-client egg and authentication
From: |
Vasilij Schneidermann |
Subject: |
Re: http-client egg and authentication |
Date: |
Thu, 29 Sep 2022 08:35:03 +0200 |
> Instead, you'd have to pass in an intarweb request object instead of an
> URI, and construct the Authorization header yourself.
Code:
(import (chicken base))
(import (chicken io))
(import http-client)
(import intarweb)
(import uri-common)
(define url "http://localhost:12345")
(define user "myuser")
(define pass "mypass")
(let* ((authorization-header `(authorization #(basic ((username . ,user)
(password .
,pass)))))
(request (make-request uri: (uri-reference url)
headers: (headers (list
authorization-header)))))
(with-input-from-request request #f read-string))
Request:
GET / HTTP/1.1
Authorization: Basic bXl1c2VyOm15cGFzcw==
Host: localhost:12345
User-Agent: http-client/1.2 (CHICKEN Scheme HTTP-client)
signature.asc
Description: PGP signature