Changeset 53 in bookmarks


Ignore:
Timestamp:
08/15/13 19:48:39 (11 years ago)
Author:
peter
Message:
  • converted from a regular CGI application to a PSGI web application
  • added an app.psgi main script
  • use Plack::Middleware::ReverseProxy to adjust environment for when behind a reverse proxy
  • use Plack::Middleware::Auth::Digest to do HTTP digest authentication for non-GET requests
  • read in the db name, reverse proxy server IP, and digest password hash from a conf.yml config file
  • use the CGI::url method instead of trying to build the base URI from the %ENV hash
  • default to an empty tags parameter so split does not emit a warning
Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r52 r53  
    2424    }]); 
    2525 
    26     my $base_uri = URI->new; 
    27     $base_uri->scheme('http'); 
    28     $base_uri->host($ENV{SERVER_NAME}); 
    29     $base_uri->port($ENV{SERVER_PORT}); 
    30     $base_uri->path($ENV{SCRIPT_NAME}); 
     26    my $url = $self->query->url; 
     27    $url .= '/' unless $url =~ m{/$}; 
     28    my $base_uri = URI->new($url); 
    3129 
    3230    my $bookmarks = Bookmarks->new({ 
     
    441439        $bookmark->uri($q->param('uri')); 
    442440        $bookmark->title($q->param('title')); 
    443         $bookmark->tags([ split(' ', $q->param('tags')) ]); 
     441        $bookmark->tags([ split ' ', $q->param('tags') || '' ]); 
    444442 
    445443        # write to the database 
  • trunk/BookmarkApp/Dispatch.pm

    r45 r53  
    33 
    44package BookmarkApp::Dispatch; 
    5 use base 'CGI::Application::Dispatch'; 
     5use base 'CGI::Application::Dispatch::PSGI'; 
    66 
    77sub dispatch_args { 
Note: See TracChangeset for help on using the changeset viewer.