[cgiapp] ::Server vs ::Dispatch::Server: Worth having both?

George Hartzell hartzell at alerce.com
Sat Sep 20 23:18:09 EDT 2008


George Hartzell writes:
 > Ricardo SIGNES writes:
 >  > * Michael Peters <mpeters at plusthree.com> [2008-09-17T12:37:04]
 >  > > Bradley C Bailey wrote:
 >  > > 
 >  > > >In CAD::Server it tries to serve files staticly first before sending to
 >  > > >dispatch.  I think the best solution would be to specify a way to mark an
 >  > > >entry point in the CA::Server config to specify static content. 
 >  > > 
 >  > > This would also improve performance since static content is more common 
 >  > > than non-static (each non-static page probably links to at least a dozen 
 >  > > static files).
 >  > 
 >  > Patches welcome.
 > 
 > Attached are four patches to CGI::Application::Server version 0.050
 > that implement various changes that have been discussed on the cgiapp
 > mailing list.
 > 
 >   fix-pod.patch touches up the SYNOPSIS section to include 'use'
 >     statements for the various modules in the entry-points.
 > 
 >   fix-simple-use.patch moves HTTP::Server::Simple::Static from
 >     CGI::Application::Server's base class list to a simple use
 >     (pointed out by Bradley C. Bailey in the context of
 >     CGI::Application::Dispatch::Server).
 > 
 >   static-content.patch extends the entry-points table so that you can
 >     point specific entry-points at directories, which are then used as
 >     the docroot in a call to serve-static.
 > 
 >   fix-empty-target-take-2.patch provides support for dispatching on
 >     '/'. 
 > 
 > I created each of these patches by developing the patches on a
 > subversion branch and then diffing the branch to the trunk.  The
 > static-content.patch creates two new directories in t/htdocs and
 > populates them with simple index.html files that are used by the
 > associated test script.  I found that I needed to create these
 > directories by hand before applying that patch or the index.html files
 > weren't created (but patch didn't complain either...).  I don't know
 > if it's a freebsd-ism, or....  Go figure.
 > [...]

It turns out that if you cd into the CGI-Application-Server-0.050
directory and apply the static-content.patch file with 

  patch -p0 < static-content.patch

the directories under t/htdocs are created as required.

phew.

g.



More information about the cgiapp mailing list