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: Tue, 10 Jul 2018 11:35:04 +0800

Thanks, Nala.

After synced the new version, both 1 and 2 are ok.

On Tue, Jul 10, 2018 at 1:49 AM, Nala Ginrut <address@hidden> wrote:

Refixed something, please update to the latest version from git.
Thanks!

Nala Ginrut writes:

> Wensheng Xie writes:
>
>> 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?
>
> You should also import (artanis config)
>
>> 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)
>
> Are you trying to handle http body?
> Please import (rnrs) and use utf8->string to convert it to
> string. If the body is too big, then you shouldn't convert it to string
> but operate on bytevector directly.
>
>> 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
>>>


--
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]