[RFC] Dynamic image generator handler
This is an request for comments. If you don't care about dynamic image generation with mod_perl, or don't care about offering or reading about suggestions, you can safely ignore this. Also, be forewarned, this was written in StarOffice, and then copied/pasted into my email program, and hand tweaked, so some things may not have made the transition properly. Dynamic Image Manipulator - *) Overview This is a mod_perl handler, not directly tied in with my content management system, but is/will be used extensively by it. The premise is to dynamically generate images, cache them, and present them to browser clients. The URI, as well as Apache configuration directives, is used to determine what is to be generated. *) Basic Uses The most basic uses of this application will to dynamically generate TTF text for titles, buttons, sidebars, etc. The current version of this code does this, and quite well. Foreground and background colors, font name (with bold/italic support), font size, image size (or automatically detected based on the size of the text), and rotation. The basic text support could be extended to allow for images to be overlayed on the text (or placed under the text), or stretch images similarly to how Enlightenment displays window manager themes. Other uses planned would be to manipulate existing images. For instance, if an image on a website needs a thumbnail, medium size and full-size view, normally a person must make all versions by hand. If any formatting needs to be done, like borders or drop-shadows, this increases complexity. If a person could just drop an image in a directory, and link to that image, the image could automatically be resized, borders added, drop shadows put in place. The resulting image would then be cached, and outputted. *) URI Arguments Information about what is to be done is passed through the URI. This works for simple tasks like text display, but if anything more complicated is to be done, external configuration files must be used. We'll get to that in a bit. Essentially, arguments are passed using the PATH_INFO HTTP header. We want the browser to think this is an actual file, instead of a dynamically generated image, so that the browser is more inclined to cache the content. So, a typical query would be: http://localhost/genText/font=ArialBold;size=24;fgcolor=#ff; bgcolor=#00;rotate=90;text=This+Is+The+Text Resizing an image could be accomplished by doing: http://localhost/genImage/source=/images/ducks.jpg;scale-ratio=1:1; width=120;height=80;border-size:1px;border-color:#00; shadow-color:#00;shadow-angle:270;shadow-distance:5px This would resize an image to the indicated width/height. The "scale-ratio" argument would limit the width/height ratio, so the maximum dimension would be used. The other attributes are obvious. *) Configuration Files Lets assume that we are going to scale an image, add borders to it which consist of other images, and add text captions over the image. This would result in such a long URI, that browsers would probably truncate it. In addition, providing direct access to the browser opens up possibilities for DoS attacks. Therefore, a configuration file should be used. The config file must be flexible enough to allow a web page to provide various input, but have certain defaults set, and restricted. The proposed solution would be to have a config file that has preset default templates that the input arguments augment. For instance: border-style: solid; border-color: #00; border-width: 1px; shadow-distance: 5px; shadow-angle: 270; shadow-color: #00; /images/watermark.gif font-face: Arial; font-size: 10px; color: #00; border-style: solid; border-color: #ff; opacity: 80%; text-align: right; Copyright © 2002 Foo Bar Industries font-face: Arial; font-size: 14px; color: #ff; text-align: left; position: top; As you can see, the above configuration file uses CSS. It makes sense to leverage that, although I'm not certain how difficult it would be to interface with CSS files. As far as I know, there are Perl CSS parsers, but I have yet to use them. The configuration for a preset config template would be layered, so the earlier the definition, the lower the layer is. The real important part here, is the "name" attribute of any element, as this identifies where input can be indicated. The above preset could be used by invoking the following URI. http://localhost/genImage/preset=thumbnail-image;src=/images/ducks.jpg As you can see, the preset is invoked by passing it's name as an attribute, and any element that has a name attribute, it's value can be provided on the
Desperate for ePerl fix on 5.6.1
Title: Blank Hi all I'm sorry to butt in like this but I notice you replied on an Apache mailing list (archive)l and I'm desperate to get a technical problem fixed. I wondered if you could help me. I've installed ePerl on FreeBSD 4.5-Stable and have Perl 5.6.1 i386-freebsd. Running ePerl standalone it reports 'Can't locate loadable object for module Parse::ePerl' i.e. can't find the C extension. What I need to do to the Makefile for eperl to get it to run with perl 5.6.1 (or 0) Again forgive the intrusion but I've got a project hanging on this and I'm getting edgy! best regards Nick Barton http://www.websavant.co.uk
problems with authentication handler
Greetings, I have written a mod_perl authentication module and I am trying to figure out how to get it to protect top level directories. I have it setup in such a way that it calls lower level directories to display the login form and when I protect the top level directory it just loops and gives me the login screen when i attempt to login. I assume this is because it needs authentication to send the information to the login handler. I tried to fix the problem by adding a PerlFixupHandler to a subroutine that returns OK, which didn't fix the problem. Here is the httpd.conf entry: AuthType Apache::CookieLogin AuthName TestAuth PerlAuthenHandler Apache::CookieLogin::authenticate PerlAuthzHandler Apache::CookieLogin::authorize require valid-user AuthType Apache::CookieLogin AuthName TestAuth SetHandler perl-script PerlFixupHandler Apache::CookieLogin::no_auth_req PerlHandler Apache::CookieLogin::login_handler AuthType Apache::CookieLogin AuthName TestAuth SetHandler perl-script PerlFixupHandler Apache::CookieLogin::no_auth_req Perlhandler Apache::CookieLogin::login_screen AuthType Apache::CookieLogin AuthName TestAuth SetHandler perl-script PerlFixupHandler Apache::CookieLogin::no_auth_req Perlhandler Apache::CookieLogin::logout the no_auth_req subroutine: sub no_auth_req { return OK; } any ideas would be greatly appreciated. Thanks, DJ
[RFC] Dynamic image generator handler
This is an request for comments. If you don't care about dynamic image generation with mod_perl, or don't care about offering or reading about suggestions, you can safely ignore this. Also, be forewarned, this was written in StarOffice, and then copied/pasted into my email program, and hand tweaked, so some things may not have made the transition properly. http://nachbaur.com/software/writing/rfc-imagegen.xhtml Just a note, I originally posted a text-version of this RFC to the mailing list (tried twice) but it never got through apparently. I'm guessing the mailing list blocked it since it was too big. Anyway, if anyone would prefer the text version, and you know why I wasn't able to post, let me know and I'll repost it. -- -man Michael A Nachbaur PGP Public Key at http://www.nachbaur.com/pgpkey.asc PGP Key fingerprint = 83DC 7C3A 3084 6A21 9A3F 801E D974 AFB4 BFD7 2B6F
[RFC] Dynamic image generator handler
This is an request for comments. If you don't care about dynamic image generation with mod_perl, or don't care about offering or reading about suggestions, you can safely ignore this. Also, be forewarned, this was written in StarOffice, and then copied/pasted into my email program, and hand tweaked, so some things may not have made the transition properly. Dynamic Image Manipulator - *) Overview This is a mod_perl handler, not directly tied in with my content management system, but is/will be used extensively by it. The premise is to dynamically generate images, cache them, and present them to browser clients. The URI, as well as Apache configuration directives, is used to determine what is to be generated. *) Basic Uses The most basic uses of this application will to dynamically generate TTF text for titles, buttons, sidebars, etc. The current version of this code does this, and quite well. Foreground and background colors, font name (with bold/italic support), font size, image size (or automatically detected based on the size of the text), and rotation. The basic text support could be extended to allow for images to be overlayed on the text (or placed under the text), or stretch images similarly to how Enlightenment displays window manager themes. Other uses planned would be to manipulate existing images. For instance, if an image on a website needs a thumbnail, medium size and full-size view, normally a person must make all versions by hand. If any formatting needs to be done, like borders or drop-shadows, this increases complexity. If a person could just drop an image in a directory, and link to that image, the image could automatically be resized, borders added, drop shadows put in place. The resulting image would then be cached, and outputted. *) URI Arguments Information about what is to be done is passed through the URI. This works for simple tasks like text display, but if anything more complicated is to be done, external configuration files must be used. We'll get to that in a bit. Essentially, arguments are passed using the PATH_INFO HTTP header. We want the browser to think this is an actual file, instead of a dynamically generated image, so that the browser is more inclined to cache the content. So, a typical query would be: http://localhost/genText/font=ArialBold;size=24;fgcolor=#ff; bgcolor=#00;rotate=90;text=This+Is+The+Text Resizing an image could be accomplished by doing: http://localhost/genImage/source=/images/ducks.jpg;scale-ratio=1:1; width=120;height=80;border-size:1px;border-color:#00; shadow-color:#00;shadow-angle:270;shadow-distance:5px This would resize an image to the indicated width/height. The "scale-ratio" argument would limit the width/height ratio, so the maximum dimension would be used. The other attributes are obvious. *) Configuration Files Lets assume that we are going to scale an image, add borders to it which consist of other images, and add text captions over the image. This would result in such a long URI, that browsers would probably truncate it. In addition, providing direct access to the browser opens up possibilities for DoS attacks. Therefore, a configuration file should be used. The config file must be flexible enough to allow a web page to provide various input, but have certain defaults set, and restricted. The proposed solution would be to have a config file that has preset default templates that the input arguments augment. For instance: border-style: solid; border-color: #00; border-width: 1px; shadow-distance: 5px; shadow-angle: 270; shadow-color: #00; /images/watermark.gif font-face: Arial; font-size: 10px; color: #00; border-style: solid; border-color: #ff; opacity: 80%; text-align: right; Copyright © 2002 Foo Bar Industries font-face: Arial; font-size: 14px; color: #ff; text-align: left; position: top; As you can see, the above configuration file uses CSS. It makes sense to leverage that, although I'm not certain how difficult it would be to interface with CSS files. As far as I know, there are Perl CSS parsers, but I have yet to use them. The configuration for a preset config template would be layered, so the earlier the definition, the lower the layer is. The real important part here, is the "name" attribute of any element, as this identifies where input can be indicated. The above preset could be used by invoking the following URI. http://localhost/genImage/preset=thumbnail-image;src=/images/ducks.jpg As you can see, the preset is invoked by passing it's name as an attribute, and any element that has a name attribute, it's value can be provided on the
Re: Desperate for ePerl fix on 5.6.1
On Thu, 9 May 2002 04:29:43 +0100 "Nick Barton" <[EMAIL PROTECTED]> wrote: : I've installed ePerl on FreeBSD 4.5-Stable and have Perl 5.6.1 i386-freebsd. : Running ePerl standalone it reports 'Can't locate loadable object for module : Parse::ePerl' i.e. can't find the C extension. : : What I need to do to the Makefile for eperl to get it to run with perl 5.6.1 : (or 0) Have you installed the ePerl port? It's under /usr/ports/lang/eperl? -- fxn
Re: Desperate for ePerl fix on 5.6.1
On Sun, 12 May 2002, F. Xavier Noria wrote: > Date: Sun, 12 May 2002 13:47:23 +0200 > From: F. Xavier Noria <[EMAIL PROTECTED]> > To: Nick Barton <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] > Subject: Re: Desperate for ePerl fix on 5.6.1 > > On Thu, 9 May 2002 04:29:43 +0100 > "Nick Barton" <[EMAIL PROTECTED]> wrote: > > : I've installed ePerl on FreeBSD 4.5-Stable and have Perl 5.6.1 i386-freebsd. > : Running ePerl standalone it reports 'Can't locate loadable object for module > : Parse::ePerl' i.e. can't find the C extension. > : > : What I need to do to the Makefile for eperl to get it to run with perl 5.6.1 > : (or 0) > > Have you installed the ePerl port? It's under /usr/ports/lang/eperl? Having updated my copy of perl beyond what FreeBSD expects me to have, I use the following values when building ports using perl: PERL_VERSION= 5.6.1 PERL_VER= 5.6.1 PERL_ARCH= i386-freebsd You can set these on the command line, which gets tedious. I've been in the habit of patching bsd.port.mk so it gets these right, but it looks like that's probably not necessary any more. It looks like you should be able to just set these in /etc/make.conf Andrew McNaughton
RES: RES: Windows mod_perl build
Ok ! Thanks! Vitor -Mensagem original- De: Per Einar Ellefsen [mailto:[EMAIL PROTECTED]] Enviada em: sabado, 11 de maio de 2002 19:17 Para: Vitor Cc: Mod-perl list Assunto: Re: RES: Windows mod_perl build Please Cc the list when replying. At 23:52 11.05.2002, Vitor wrote: >Excellent resource. > >Just one more question : I want to have mod_perl running in my application >as a thread. All requests to mod_perl will occur inside the application >through piped I/O. Do you know a resource where i can find more information >about this ? Hmm, that's pretty much above my head :) But I think it seems a little complicated... Maybe you should just be starting up Apache on a non-standard port and use standard sockets to communicate with Apache/mod_perl? That's all I can say. >Best regards, > >Vitor > >-Mensagem original- >De: Per Einar Ellefsen [mailto:[EMAIL PROTECTED]] >Enviada em: sabado, 11 de maio de 2002 17:18 >Para: Vitor >Cc: [EMAIL PROTECTED] >Assunto: Re: Windows mod_perl build > > >At 22:21 11.05.2002, Vitor wrote: > >Hello, > > > >I am searching for windows mod_perl compilations resources. > > > >Any suggestions ? > >Randy Kobes has kindly written instructions for you to compile mod_perl on >Windows and other Win32-related issues. >http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/win32/index.h t >ml -- Per Einar Ellefsen [EMAIL PROTECTED]
[modperl2] XML::LibXML crashes apache
Hi ! with last modperl2 passing almost all test ok on win32, i have a problem with XML:LibXLML -8<-- Start Bug Report 8<--1. Problem Description: [XML-LibXML 1.40 (from RK ppd) crashes apache 2.0.36 or 2.0.37-dev] this file (below) run with "perl file" is ok and output ok. the same one used from startup.pl, or registry script output ok but also crashes apache immediately after output for 2.0.36, after some seconds for 2.0.37-dev file:-package Produits; print "content-type:text/plain\n\n";use warnings;use strict; use Data::Dumper ;use XML::LibXML();our %C ;my $base='c:/path'; %C=(promod=>XML::LibXML->new->parse_file("$base/promod.xsl"),); print Dumper %C ; 1;--- 2. Used Components and their Configuration: *** using lib/Apache/BuildConfig.pm*** Makefile.PL options: MP_AP_PREFIX => c:\ap2036 MP_GENERATE_XS => 1 MP_INST_APACHE2 => 1 MP_LIBNAME => mod_perl MP_USE_DSO => 1 *** c:\ap2036/bin/Apache.exe -VServer version: Apache/2.0.36Server built: May 7 2002 17:17:14Server's Module Magic Number: 20020329:1Architecture: 32-bitServer compiled with -D APACHE_MPM_DIR="server/mpm/winnt" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/apache" -D SUEXEC_BIN="/apache/bin/suexec" -D DEFAULT_ERRORLOG="logs/error.log" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** C:\Perl\bin\perl.exe -VSummary of my perl5 (revision 5 version 6 subversion 1) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX', optimize='-O1 -MD -DNDEBUG', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -libpath:"C:\Perl\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib" "C:\Program Files\Microsoft Visual Studio\VC98\lib" "C:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 631 Built under MSWin32 Compiled at Jan 2 2002 17:16:22 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: C:/Perl/lib C:/Perl/site/lib . 3. This is the core dump trace: (if you get a core dump):with 2.0.36unhandled exception in MSCVRT.DLLMSVCRT! 780011ce()PERL56! 28071244()PERL56! 2805c5b1()PERL56! 2805c577()PERL56! 2805c577()PERL56! 2805c870()PERL56! 2805ba24()PERL56! 2800c882()PERL56! 2805c7f3()PERL56! 2805ba24()PERL56! 2800c882()PERL56! 2805b9fd()PERL56! 2800c882()PERL56! 2805b9fd()PERL56! 2800c882()PERL56! 2805b9fd()PERL56! 2800c882()PERL56! 2805c248()PERL56! 2805d510()PERL56! 2805d16f()MOD_PERL! 10001fc3()MOD_PERL! 10002a32()MOD_PERL! 10001840()MOD_PERL! 10001796()ap_run_post_config(apr_pool_t * 0x0078a1e0, apr_pool_t * 0x007ba510, apr_pool_t * 0x007bc548, server_rec * 0x007a2478) line 130 + 89 bytesmain(int 3, const char * const * 0x007826f0) line 579 + 22 bytesmainCRTStartup() line 338 + 17 bytesKERNEL32! 77e77903() with 2.0.37-dev PERL56! 28073f60()PERL56! 28074f56() This report was generated by t/report on Sun May 12 15:26:12 2002 GMT. -8<-- End Bug Report --8<--
[RFC] Apache::AuthTicketPlus
Title: Message I've subclassed Apache::AuthTicket with a 'Require group ' authorization handler, since neither AuthTicket nor AuthCookie included it (though AuthCookie does have the hooks for it which I took advantage of). I also added a 'Require not ' hander. I wanted to be able to exclude one or two authenticated users (like guest) from certain areas while still being able to 'Require valid-user'. Much easier than having to remember to add every authenticated use to a group when I only want to exclude one or two users. If AuthCookie ever changes from requiring all check to pass to just a single check, this will break. (See Apache::AuthCookie authorize() section for comments on ALL vs. ANY.) Example: Require not group Require not user Also, I had to implement my own 'user' authorization method since Apache::AuthCookie embeds it directly into the main authorization method. My method only gets called by the 'not' method when applicable. I could have just put the code directly in the not method, but then anyone subclassing my module would have the same problem... Feel free to do whatever you want with the code... Comment/criticism welcome - especially on the init method. I'll post to CPAN if anyone thinks it's worth it. I'd gladly accept integrating this directly into AuthTicket if the maintainer wishes (Michael Schout?). I'm not crazy about the name, but it has to be called something - suggestions welcome. Thanks, Jim ---snip--- package Apache::AuthTicketPlus; use strict; use vars qw($VERSION @ISA %DEFAULTS); use Apache::Constants qw(FORBIDDEN OK);use Apache::AuthTicket qw(); @ISA = qw(Apache::AuthTicket); $VERSION = '0.01'; $DEFAULTS{TicketGroupTable} = 'groups:grpname:usrname'; sub init { my ($self, $r) = @_; $self->SUPER::init($r); map { $self->{$_} = $self->_get_config_item($r, $_); } keys %DEFAULTS; } sub not { my ($self, $r, $args) = @_; $self = $self->new($r) unless ref $self; my ($requirement, $sub_args) = split(/\s+/, $args, 2); my $rv = $self->$requirement($r, $sub_args); return ($rv == OK) ? FORBIDDEN : OK; } sub user { my ($self, $r, $args) = @_; $self = $self->new($r) unless ref $self; my $user = $r->connection->user; my $req_user = (split /\s+/,$args)[0]; return ($user eq $req_user) ? OK : FORBIDDEN; } sub group { my ($self, $r, $args) = @_; $self = $self->new($r) unless ref $self; my $group = (split /\s+/, $args)[0]; my $user = $r->connection->user; my $dbh = $self->dbh; my ($_table,$_group,$_user) = split(/:/, $self->{TicketGroupTable}); my $query = qq{ SELECT COUNT(*) FROM $_table WHERE $_group = ? AND $_user = ? }; my $rows = 0; eval { my $sth = $dbh->prepare($query); $sth->execute($group,$user); $sth->bind_columns(\$rows); $sth->fetch; }; if ($@) { $dbh->rollback; die $@; } return $rows ? OK : FORBIDDEN ;} 1;
RE: [RFC] Apache::AuthTicketPlus
I don't know, but I'm sure someone here will have the answer... Jim > -Original Message- > From: Steven Lembark [mailto:[EMAIL PROTECTED]] > Sent: Sunday, May 12, 2002 5:50 PM > To: Jim Helm > Subject: Re: [RFC] Apache::AuthTicketPlus > > > > > Example: > > Require not group > > Require not user > > > Q: do you know how to set multiple require xxx entries > in sections? I've tried every structure I can > think of w/o any success. If I could figure that out > the modlue would be a big help. > > thanx. > > -- > Steven Lembark 2930 W. Palmer > Workhorse Computing Chicago, IL 60647 > +1 800 762 1582 >