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: Wensheng Xie
Subject: Re: [Artanis] Beginner: How to use the following in artanis
Date: Mon, 9 Jul 2018 11:18:09 +0800

Thanks, Nala.

1. scheme@(guile-user)> ,use (artanis artanis)
scheme@(guile-user)> artanis-version
$4 = "GNU Artanis-0.2.5"
scheme@(guile-user)> (conf-set! 'debug-mode #t)
;;; <stdin>:19:0: warning: possibly unbound variable `conf-set!'
<unnamed port>:19:0: In procedure module-lookup: Unbound variable: conf-set!

Is it also internal?

2. Get is not working either.

Oh~Fark! Internal Server Error!

ERROR: In procedure string-split:
In procedure string-split: Wrong type argument in position 1 (expecting string): #vu8(106 97 99 107 58 49 50 51)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
HTTP 500
Captured in <artanis/server/ragnarok.scm>
Threw in procedure handle-request :
[REASON] Internal ERROR wrong-type-arg (string-split Wrong type argument in position ~A (expecting ~A): ~S (1 string #vu8(106 97 99 107 58 49 50 51)) (#vu8(106 97 99 107 58 49 50 51)))!
[SERVER ERROR] Internal error from server-side, rendering a 500 page for client ...

best regards,
wxie

On Fri, Jul 6, 2018 at 10:34 PM, Nala Ginrut <address@hidden> wrote:

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



--
I'm an FSF member -- Help us support software freedom! https://my.fsf.org/join

reply via email to

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