Re: modperl with SSL
realserver, generally, it means a web server like apache, which is different from a proxy like squid. On Mon, Mar 24, 2008 at 3:56 PM, Foo JH <[EMAIL PROTECTED]> wrote: > What is a realserver? > > > > J. Peng wrote: > > hello list, > > > > we have our own realserver called QHttpd. > > This realserver doesn't support SSL protocal (https). > > So I have to develop a proxy before QHttpd to get it be compatible with > SSL. > > I was thinking using modperl handler to do it. > > modperl accept the SSL connection from clients, do the verification, > > and if it's valid, redirect it to realserver with non-SSL (common > > http) protocal. > > Is it possible? if so, how to begin with it? at which stage? > > Thanks in advance. > > > > B. Regards, > > Joy P. > > > >
modperl with SSL
hello list, we have our own realserver called QHttpd. This realserver doesn't support SSL protocal (https). So I have to develop a proxy before QHttpd to get it be compatible with SSL. I was thinking using modperl handler to do it. modperl accept the SSL connection from clients, do the verification, and if it's valid, redirect it to realserver with non-SSL (common http) protocal. Is it possible? if so, how to begin with it? at which stage? Thanks in advance. B. Regards, Joy P.
retrun 302 in Trans handler
Can I return a 302 redirection code in TransHandler? I know generally we do it in AccessHandler. Thanks.
Re: MapToStorage and the use of path_info (was Re: return DECLINED...)
On Sat, Mar 1, 2008 at 1:37 PM, Raymond Wan <[EMAIL PROTECTED]> wrote: > Not a very technical answer, but maybe an easy way of thinking of > things. The second scenario also makes it possible for Google, etc. to > index your web pages since it is a "real" URL. In the first case, it is > possible, but not as straight-forward. > oh, it's good that I learned another way to request an uri with the path_info way. yes the path_info uri is good to be recorded by google, since it looks doesn't like a dynamic page. for us we generally use mod_rewrite to rewrite a dynamic page to seem like a static page,like: RewriteRule ^/myspace/my(\d+).html /myspace/index.cgi?id=$1 thanks. //joy
Re: MapToStorage and the use of path_info (was Re: return DECLINED...)
I'm still confused why we need a path_info for the additional info to CGI/modperl scripts? Generally under CGI we say x.cgi?key=value to pass arguments, under modperl handler we say /myHandler/?key=value to do it, or using POST method. Under what case we use path_info? //joy On Sat, Mar 1, 2008 at 3:22 AM, Torsten Foertsch <[EMAIL PROTECTED]> wrote: > On Fri 29 Feb 2008, Frank Maas wrote: > > I am using a mechanism where I use the path_info to carry information > > about the content to be served. However, as far as I know the only way to > > do this is to create a handler that is defined for the correct location. > > In the described situation, something like, > > > > > > PerlHandler MyNews->handler() > > > > > > I do not see how MapToStorage handler will help here. There probably is no > > /var/www/archive/news file (or directory), and even if there is, it is of > > no use to Apache. Or am I completely and utterly mistaken here? > > Your confusion comes from the fact that you look at it through mod_perl > spectacles where you don't necessarily have a corresponding disk file. But > Apache is made chiefly to ship files. > > So in the m2s phase apache splits the filename it gets from trans into the > name of a filesystem entry and the trailing "path_info". > > If you have a CGI script say /bin/x.cgi that is located in /www/cgi-bin/x.cgi > and you call it as /bin/x.cgi/path/info then after trans filename points > to /www/cgi-bin/x.cgi/path/info. m2s then finds that /www/cgi-bin/x.cgi is a > regular file. So it sets filename to /www/cgi-bin/x.cgi and path_info > to /path/info. So in CGI context you can be certain that PATH_INFO is the > remainder of the URI after the current script is stripped off. > > BTW, the default response handler the one that ships files returns 404 if > path_info is not empty. > > Now in mod_perl you normally don't have a disk file. You have a compiled > handler. So m2s will determine the start of path_info somewhere in the URI > where it finds the last existing directory. > > Hence when using a modperl handler don't rely on path_info. By creating an > additional directory or deleting one you can spoil your logic! That is called > action at a distance. > > Use $r->uri and $r->location instead. Don't use in this case. > Then the first part of $r->uri equals to $r->location. So you can compute a > mod_perl version of path_info as "substr($r->uri, length($r->location))". > This one doesn't depend on existing or non-existing filesystem entries. > > Torsten >
Re: return DECLINED or OK?
On Fri, Feb 29, 2008 at 9:52 PM, Raymond Wan <[EMAIL PROTECTED]> wrote: > I think you'll > pick it up in time and one starting point is to write some sample code > and try things out... > I have written lots of modperl codes actually,:) But I primarilly write with AccessHandler or ResponseHandler, didn't do any TransHandler coding. Most website products use only ResponseHandler. Just googled and know what's "path_info" now. It's an odd concept I think.Anyway thanks. //joy
Re: return DECLINED or OK?
On Fri, Feb 29, 2008 at 8:13 PM, Raymond Wan <[EMAIL PROTECTED]> wrote: > Say you have a news site like: > > http://example.com/archive/news/2008/02/29/index.html > > A user might request that, but it wouldn't make sense to have 365 > "index.html"'s every year (ok, 366 this year :-) ). Instead, you could > do a trick above and keep going up the hierarchy until you have a > filename "/var/www/archive/news/" and a path_info > "/2008/02/29/index.html". Do you mean mod_rewrite for the trick? yes with mod_rewrite people can rewrite: http://example.com/archive/news/2008/02/29/index.html to something like: http://example.com/archive/news?object=/2008/02/29/index.html so here /archive/news is filename and /2008/02/29/index.html is path_info,is it? But in this case we don't need to guess the path_info from filename, just saying $r->param() can get the arguments,:) Thanks.
Re: return DECLINED or OK?
On Fri, Feb 29, 2008 at 7:03 PM, Torsten Foertsch <[EMAIL PROTECTED]> wrote: > > Example continued: The entry /var/www/a/b exists on disk either as file or as > directory but /var/www/a/b/c does not. Then after MapToStorage $r->filename > is /var/www/a/b and $r->path_info is /c/d/e. > Sorry I can't understand for this. If /var/www/a/b exists but /var/www/a/b/c not, why user requests it? What's $r->path_info? How to get path_info from filename? thanks again.
Re: return DECLINED or OK?
On Fri, Feb 29, 2008 at 11:26 AM, Geoffrey Young <[EMAIL PROTECTED]> wrote: > they usually > alter the uri then let the default apache trans handler do the mapping. btw, mapping uri to disk sources in apache2 was done in MapToStorageHandler rather than Trans handler, is it?
Re: return DECLINED or OK?
Thanks to all. That really be helpful.
return DECLINED or OK?
At what cases should we return a DECLINED or a OK from a handler? I saw the handler of PerlTransHandler returns a Apache2::Const::DECLINED but dont know why. thanks.
Re: need to write a fitler based on request header
Hello Torsten, I have tested your rewrite syntax like below: RewriteEngine On RewriteCond %{HTTP:Accept-Encoding} gzip [OR] RewriteCond %{HTTP:Accept-Encoding} deflate RewriteRule ^/unzip/(.*) /gziped/$1 [PT,L] Sorry it can't work. Also I checked apache's official document for mod_rewrite: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html It says the rewriting conditions on http headers include only: HTTP headers: -- HTTP_USER_AGENT HTTP_REFERER HTTP_COOKIE HTTP_FORWARDED HTTP_HOST HTTP_PROXY_CONNECTION HTTP_ACCEPT So as I've said, you can't rewrite the request based on Accept-Encoding header.Is it? Thanks. On Thu, Feb 28, 2008 at 8:30 PM, Torsten Foertsch <[EMAIL PROTECTED]> wrote: > On Thu 28 Feb 2008, J. Peng wrote: > > > no, mod_rewrite can't rewrite requests based on Accept-Encoding header. > > yes, something like this: > > RewriteCond %{HTTP:Accept-Encoding} gzip [OR] > RewriteCond %{HTTP:Accept-Encoding} deflate > RewriteRule ^(.*) /pathA/$1 [PT,L] > > RewriteRule ^(.*) /pathB/$1 [PT,L] > > or as an external redirect: > > RewriteCond %{HTTP:Accept-Encoding} gzip [OR] > RewriteCond %{HTTP:Accept-Encoding} deflate > RewriteRule ^(.*) /pathA/$1 [R,L] > > RewriteRule ^(.*) /pathB/$1 [R,L] > > Why do you think this wouldn't work? >
Re: need to write a fitler based on request header
On Thu, Feb 28, 2008 at 8:30 PM, Torsten Foertsch <[EMAIL PROTECTED]> wrote: > On Thu 28 Feb 2008, J. Peng wrote: > > > currently I write it with PerlAccessHandler, it also works. is it > > right with this handler? > > Do you want to send a redirect to the browser (HTTP code 3xx)? I use apache's inner redirect rather than the 3xx external redirection. > If yes then it > can be done in an access handler as well. If you simply want to send the > document in /pathA or /pathB then I think you'd prefer something *before* the > core map_to_storage handler, that means a PerlTransHandler or a > PerlMapToStorageHandler since otherwise you'd need to fill out the finfo > field by yourself, see > > http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_finfo_ > > thanks for the info. > > no, mod_rewrite can't rewrite requests based on Accept-Encoding header. > > yes, something like this: > > RewriteCond %{HTTP:Accept-Encoding} gzip [OR] > RewriteCond %{HTTP:Accept-Encoding} deflate > RewriteRule ^(.*) /pathA/$1 [PT,L] > > RewriteRule ^(.*) /pathB/$1 [PT,L] > > or as an external redirect: > > RewriteCond %{HTTP:Accept-Encoding} gzip [OR] > RewriteCond %{HTTP:Accept-Encoding} deflate > RewriteRule ^(.*) /pathA/$1 [R,L] > > RewriteRule ^(.*) /pathB/$1 [R,L] > > Why do you think this wouldn't work? > I'll try it. thanks so much torsten.
Re: need to write a fitler based on request header
thanks torsten. currently I write it with PerlAccessHandler, it also works. is it right with this handler? no, mod_rewrite can't rewrite requests based on Accept-Encoding header. On Thu, Feb 28, 2008 at 7:26 PM, Torsten Foertsch <[EMAIL PROTECTED]> wrote: > On Thu 28 Feb 2008, J. Peng wrote: > > I need to write an input filter based on the request headers. > > If request includes a "Accept-Encoding: gzip, deflate" header, I > > should redirect the request to /pathA. > > If request doesn't include that header, I should redirect the request to > > /pathB. (pathA and pathB are web document dirs on web server.) > > I think you don't need an input filter. What you need is a PerlTransHandler > or > a PerlMapToStorageHandler that checks $r->headers_in->{'Accept-Encoding'} and > sets $r->filename and/or $r->uri accordingly. > > This can even be done with mod_rewrite. > > Torsten >
need to write a fitler based on request header
Hello members, I need to write an input filter based on the request headers. If request includes a "Accept-Encoding: gzip, deflate" header, I should redirect the request to /pathA. If request doesn't include that header, I should redirect the request to /pathB. (pathA and pathB are web document dirs on web server.) How to do it? thanks.
Re: Amazon
coding from perl to python is easy,at least it's easy for me. but,as many guys have said to me, from python to perl is not easy. perl's many features,like the rich built-in variables and context,are not so easy to be accetable by newbies. //joy On Wed, Feb 27, 2008 at 12:50 AM, Aaron Trevena <[EMAIL PROTECTED]> wrote: > On 26/02/2008, Michael Lackhoff <[EMAIL PROTECTED]> wrote: > > Of course you are right, Perl is totally up to the task, that's why we > > are here, aren't we? ;-) > > The other posters are also right, there is lots of community, lots of > > CPAN and still enough books... > > > > ...but > > Perl is no longer the "duct tape of the internet", there are these > > stories about sites moving from Perl to JAVA but none about moving in > > the opposite direction, there is all this fuzz about Ruby on Rails and a > > boss who wants me to learn JAVA. > > There are stories about moving from Perl to Java, but to be honest, > I've never seen an example of this actually happening succesfully. In > my experience, management talk about moving to whatever is on magazine > covers but any decent project manager or IT Director would run away > screaming if asked to actually do it. > > > > So, I don't want to do Perl-bashing, of course not, it is the language I > > feel most at home with but I see that nowadays you really have to fight > > to be allowed to write the next bigger project in Perl. There is this > > "You are still using Perl?" all around that makes me feel a bit uneasy. > > Not been my experience. > > -- > > > http://www.aarontrevena.co.uk > LAMP System Integration, Development and Hosting >
Re: Amazon
I like Perl than others. once a company wanted to hire me and gave me much higher salary than the current job. But one of their conditions is not permit to use perl, but use python instead. I'm familiar with python too, but I hate that clause. So I gave up that job finally.:) On Tue, Feb 26, 2008 at 6:21 PM, Aaron Trevena <[EMAIL PROTECTED]> wrote: > On 23/02/2008, Michael Lackhoff <[EMAIL PROTECTED]> wrote: > > - Perl usage is declining. I read some statistics from O'Reilly and > > they showed that Perl book sales are going down. > > A few years ago the 'P' in LAMP clearly was 'Perl', now it is 'PHP' > > in most cases. Developers tend to go (even if slowly) where the money > > is. > > Sorry, you're making wild claims there - yes ORA perl book sales are > down, but then that really doesn't indicate much - most of the ORA > perl books have been around for ages and are on their 3rd or 4th > reprint. Hardly a surprise. > > If you look at other more useful numbers you can see that the number > of contributors to CPAN and perl projects in increasing, the number of > jobs is steady or increasing, and that actually it's all rather > healthy. > > A. > > > -- > http://www.aarontrevena.co.uk > LAMP System Integration, Development and Hosting >
Re: Amazon
On Sat, Feb 23, 2008 at 11:08 PM, Tina Müller <[EMAIL PROTECTED]> wrote: > offtopic: > > > On Sat, 23 Feb 2008, J. Peng wrote: > > > modperl is fast, but it consumes too much memory. > > so we choose fastcgi written by C++. > > actually it consumes less memory than FastCGI if you do it right. If you > load as many modules and data structures as you can at startup time, > Apache will share the memory between the processes (as long as you don't > change the data). Apache with prefork mode can share the memory? Sorry I didn't know it. Sharing memory between multi-processes need extra programming, I don't know apache has done it already.
Re: Amazon
modperl is fast, but it consumes too much memory. so we choose fastcgi written by C++. On Sat, Feb 23, 2008 at 10:49 PM, Roberto C. Sánchez <[EMAIL PROTECTED]> wrote: > On Sat, Feb 23, 2008 at 06:25:42PM +1100, Jie Gao wrote: > > > > Choosing java for better performance would certainly be a joke. If a > > java solution fails, it would be an industry-standard failure, backside > > covered. :-) > > > Just a variation on the old, "Nobody ever got fired for choosing IBM." >
Re: AP2.2.7 + MP2.0.3 on Win32
thanks, good note. On Jan 14, 2008 5:12 PM, Foo JH <[EMAIL PROTECTED]> wrote: > Hi all, > > Just want to slap a quick note that I've tried the following combo on > Win32 platform (Windows 2003 Server x86): > Apache 2.2.7 from ApacheLounge (apachelounge.com) > modperl 2.0.3 from theoryx5 (ppd) > libapreq 2.6.2 from theoryx5 (ppd) > Perl 5.8.8 (ActivePerl build 822) > > The only thing I'm interested (the rest I take for granted) is that it > survives a restart from the ApacheMonitor app. Had painful issues with > past versions, so this is always my priority. I know Linuxians take it > for granted... > > >