artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Artanis] Beginner: How to use the following in artanis


From: Nala Ginrut
Subject: Re: [Artanis] Beginner: How to use the following in artanis
Date: Fri, 06 Jul 2018 22:34:34 +0800
User-agent: mu4e 1.1.0; emacs 25.1.1

hi there!


Wensheng Xie writes:

> Hi, artanis:
>
> Two questions:
>
> 1. how to use Config API
> e.g.
>
> (current-myhost)

In general, you should use get-conf for fetching config items.
But current-myhost is not exported since it's for internal using.

> causes unbund error.
>
> 2. how to use HTTP Basic authentication
> the code
> ;; test HTTP Basic authentication (BA) implementation
> (use-modules (artanis artanis))
> (init-server)
>
> (define (my-checker rc user passwd)
>   (and (string=? user "jack") (string=? passwd "123")))
>
> (post "/bauth" #:auth `(basic ,my-checker)
>   (lambda (rc)
>     (if (:auth rc)
>         "auth ok"
>             (throw-auth-needed))))
>
> (run #:port 8080)
>
> but
> http://localhost:8080/bauth/
> is 404.

When you visit http://localhost:8080/bauth/ , it's actually using GET
method, but /bauth is registered in POST method for hiding password
information.
The solution is (get "/bauth" ...)

> best regards,
> wxie


--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]