From: <ju...@pr...> - 2007-10-01 13:03:12
|
Hello Robin, That is expected behaviour. You may find the 'yaws_showarg' module handy when testing: For example try: appmods = <showstuff, yaws_showarg> </test/etc/showstuff, yaws_showarg> This appmod shows two different ways of specifying the mounting path of the appmod. The first one I refer to as 'floating' and the second as 'anchored' - (but this is not standard terminology) You'll see that with longer paths, 'prepath' does indeed include more than just '/' e.g for GET /test/etc/showstuff/blah prepath = "/test/etc/" You raise an interesting point about getting the mounting path. I guess at the moment you could do something like strip off the leading 'prepath' from 'server_path', grab the first segment of what remains, then tack that onto the end of 'prepath'. Seems clumsy yes.. but it is derivable, either as above, or perhaps more easily by taking 'pathinfo' off the right hand side of 'server_path' I suspect this may warrant the addition of a helper function to make it simpler - but it's probably not necessary to add another member to the ARG record. Cheers, Julian Robin Bhattacharyya wrote: > I am using yaws 1.71 with one appmod mounted at "/blog". > > Based on the yaws_api.hrl: > > prepath, %% Path prior to 'dynamic' segment of URI. > %% ie > http://some.host/<prepath>/<script-point>/d/e > > The yaws arg field 'prepath' is always returning '/' when I thought it > should return '/blog'. > > Is this the expected behavior or a bug? > > If this is the expected behavior, then how does one determine the path > where the appmod was mounted? > > Thanks, > > Robin > > > start_yaws(Port)-> > code:add_patha("/opt/local/lib/yaws/ebin"), > > yaws:start_embedded("./apps/blog/www", > [{servername, "localhost"}, > {port, Port}, > {appmods,[{"/blog",boot}]}, > {opaque,[{"appname",blog}]}, > {allowed_scripts,[]}], > [{logdir,"./log"}]). > > out(A) -> > io:format("arg:~s~n",[?format_record(A, arg)). > > > ============ > arg:record arg > clisock = #Port< 0.342> > client_ip_port = {{127,0,0,1},52866} > headers = {headers,"keep-alive", > > "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q= > 0.5", > "localhost:3000", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; > en-US; rv: 1.8.1.7 <http://1.8.1.7>) Gecko/20070914 Firefox/2.0.0.7", > undefined, > [], > "300", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > [{http_header,9, > 'Accept-Charset', > undefined, > "ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > {http_header,10, > 'Accept-Encoding', > undefined, > "gzip,deflate"}, > {http_header,11, > 'Accept-Language', > undefined, > "en-us,en;q=0.5"}]} > req = {http_request,'GET',{abs_path,"/blog/posts"},{1,1}} > clidata = undefined > server_path = "/blog/posts" > querydata = undefined > appmoddata = posts > docroot = "./apps/blog/www" > docroot_mount = "/" > fullpath = "./apps/blog/www/blog/posts" > cont = undefined > state = undefined > pid = <0.205.0> > opaque = [{"appname",blog}] > appmod_prepath = "/" > prepath = "/" > pathinfo = "/posts" > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > ------------------------------------------------------------------------ > > _______________________________________________ > Erlyaws-list mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > |