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

George Hartzell hartzell at alerce.com
Sat Sep 20 21:23:49 EDT 2008


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.

The changes to the SYNOPSIS in fix-pod.patch and in
fix-empty-target-take-2.patch overlap and if you apply them in the
order they're listed above it causes a rejection.  It's a simple
one-line change to the SYNOPSIS.  I'll leave it to all y'all to sort
it out in your sandboxes.

Here's what I did to test things.

   527	7:57	tar -xvf ../CGI-Application-Server-0.050.tar.gz
   528	7:57	cd CGI-Application-Server-0.050/
   529	7:57	perl ./Build.PL
   530	7:57	./Build test
   531	7:58	patch < /tmp/fix-pod.patch
   532	7:58	./Build test
   533	7:58	patch < /tmp/fix-simple-use.patch
   534	7:58	./Build test
   535	7:58	mkdir t/htdocs/static
   536	7:58	mkdir t/htdocs/images
   537	7:58	patch < /tmp/static-content.patch
   538	7:58	./Build test
   539	7:59	patch < /tmp/fix-empty-target-take-2.patch
   540	7:59	cat lib/CGI/Application/Server.pm.rej
   541	7:59	./Build test
   542	8:00	history > /tmp/patch-history

Since there's a good chance that some part of the InterWeb Tube thingy
will eat the attachments from this message, the patches are available
at:

  http://shrimp.alerce.com/cgiapp

g.



More information about the cgiapp mailing list