(My last mail was sent before I could complete it, sorry: here is the complete version)


Yep, tried out the updated cvs-version, root-appmods work now, thanks! Had a look at yaws_showarg, very useful! (You hadn't added it to the makefile yet though so it doesn't get compiled in by default)

I get these results now, marked changes from 1.68 with **

appmods = <"/small",yaws_showarg>

**http//test.com/small         appmoddata: undefined    pathinfo: undefined    1.68 appmoddata: []
**http//test.com/small/        appmoddata: "/"    pathinfo: "/"         1.68 appmoddata: []
http//test.com/small/foo    appmoddata: "foo"    pathinfo: "/foo"   1.68 appmoddata: "foo"

appmods = <"/",yaws_showarg>

http//test.com/          appmoddata: []       pathinfo: undefined      1.68 appmoddata: []
**http//test.com/foo    appmoddata: "foo"    pathinfo: "/foo"      1.68 appmoddata: "/foo"

I'll use pathinfo from now on, as the results are predictable and consistent.

Thank you!
/Tobias


On 3/14/07, julian@precisium.com < julian@precisium.com> wrote:
>The main problems occur when I try a "root" appmod with "appmods = <"/",smallmod>":
Sorry - yes -  I didn't properly take account of root appmods as a special case when adding the vdir stuff.
...
>I also tested "appmods = <"",smallmod>" and there I got the badmatch-error of case #3 above for every possible url, but that seems fine as I understand the correct way of specifying it is "/", not ""?
That's been my understanding.
 
Please try the latest CVS and see if it fits your expectations better.
 
The handling of root appmods will always be something of an edge case I suspect - with the potential to surprise someone no matter what we do.
Consider for starters that http://someserver/   and http://someserver    both end up  as an http GET / 
 
I've taken the view that when specifying an appmod path it's a segment 'between' slashes that is the point corresponding to the appmod.
Thus in the root appmod case - although it's specified in the conf as "/"  it's really more like the appmod applies to the notional empty string before that slash.
This then makes sense in that arg.pathinfo, when defined, will always have a leading slash.
 
Note that arg.pathinfo & arg.prepath are more general concepts that should replace arg.appmoddata & arg.appmod_prepath for future work with the arg record.
e.g they're applicable also to cgi/.yaws pages
They differ slightly in their handling of slashes compared to the 'appmod' fields.
appmoddata is *supposed* to retain the behaviour of the previous Yaws release - I'll need to review that.
 
Try the new yaws_showarg  appmod as a reasonably convenient way of comparing all these values.
e.g as a root appmod
appmod = </ , yaws_showarg>
or as a 'floating' appmod
appmod = <showarg, yaws_showarg>
 
I think there's room for discussion re undefined vs [] in some of the arg fields.
 
Cheers,
 
Julian Noble
 

----- Original Message -----
Sent: Tuesday, March 13, 2007 9:59 PM
Subject: Re: [Erlyaws-list] Appmods on root-path


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/  returns: Hello world! Appmoddata is []
2. http://test.com//  returns: Hello world! Appmoddata is [].
3. http://test.com/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öfgren < ugglan@gmail.com> wrote:

I'm using the latest yaws checked out from CVS and I'm having trouble with 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 = <"/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 = <"/",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 = <"",smallmod>" and there I got the badmatch-error of case #3 above for every possible url, but that seems fine as I understand the correct way of specifying it is "/", not ""?


/Tobias



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list