Ok, I had a lookaround in the server code and I noticed that there seems to
be a work in progress on virtual directories and appmods that might be the
reason for the problems I described, so I downloaded 1.68 and appmods on "/=
"
works fine on that release. One small inconsistency remains in the
appmoddata-value though, on a "named" appmod things behave as expected:
1. http://test.com/small returns: Hello world! Appmoddata is []
2. http://test.com/small/ returns: Hello world! Appmoddata is [].
3. http://test.com/small/foobar returns: "Hello world! Appmoddata is
"foobar".
but on "/":
1. http://test.com/ <http://test.com/small> returns: Hello world!
Appmoddata is []
2. http://test.com// <http://test.com/small/> returns: Hello world!
Appmoddata is [].
3. http://test.com/foobar <http://test.com/small/foobar> returns: "Hello
world! Appmoddata is "/foobar".
the appmoddata gets an extra / at the beginning. No biggie though.
/Tobias
On 3/13/07, Tobias L=F6fgren <ugglan@...> wrote:
>
>
> I'm using the latest yaws checked out from CVS and I'm having trouble wit=
h
> appmods on "/". I seem to recall that I've made this work previously.
>
> Example appmod I'm using as a minimal test:
>
> -module(smallmod).
> -include("/usr/local/lib/yaws/include/yaws_api.hrl").
> -export([out/1]).
>
> out(A)-> {html, io_lib:format("Hello world! Appmoddata is ~p.",[
> A#arg.appmoddata]) }.
>
>
> First - with "appmods =3D <"/small",smallmod>", everything works fine:
>
> 1. http://test.com/small returns: Hello world! Appmoddata is undefined.
> 2. http://test.com/small/ returns: Hello world! Appmoddata is "/".
> 3. http://test.com/small/foobar returns: "Hello world! Appmoddata is
> "foobar".
>
> although I feel an empty string/list would have been a more consistent
> return value for case #2, alternatively return value "","/","/foobar" for
> cases #1-3. But that is less important.
>
>
> The main problems occur when I try a "root" appmod with "appmods =3D
> <"/",smallmod>":
>
> 1. http://test.com/ passes through handling to yaws and returns the
> docroots index page.
> 2. http://test.com// returns: Hello world! Appmoddata is [].
> 3. http://test.com/foobar returns nothing, console reports this error:
> Yaws process died:
> {function_clause,[{lists,sublist_2,[["foobar"],-1]},
> {yaws_server,do_url_type,4},
> {yaws_server,url_type,3},
> {yaws_server,handle_request,3},
> {yaws_server,aloop,3},
> {yaws_server,acceptor0,2},
> {proc_lib,init_p,5}]}
>
>
>
> I also tested "appmods =3D <"",smallmod>" and there I got the badmatch-er=
ror
> of case #3 above for every possible url, but that seems fine as I underst=
and
> the correct way of specifying it is "/", not ""?
>
>
> /Tobias
>
>
|