Re: Cookies and IE in mod_perl

2002-03-23 Thread Cees Hek


Some browsers don't accept cookies sent allong with a redirect header. 
A simple workaround is to leave your cookie in the header, but move the
redirect to a META HTTP-EQUIV tag in a blank HTML document.  

I'm not sure if IE 6.0 suffers from this but I suspect that this is your
problem.  So this isn't really a mod_perl problem, but likely a browser
problem.

Also, if you want to see exactly what headers your apache server is
sending out, or headers your client is sending in, have a look at
Apache::DumpHeaders.  It saves putting those warn statements in your
code.

Cees


On Sun, 2002-03-24 at 14:44, Jesse and Rebecca Stay wrote:
> Ok - I got rid of the Apache::Cookie stuff, and am now doing things manually, 
> but it still doesn't generate a cookie in IE.  It still works in Netscape.  I 
> get a redirect, but no cookie.  Here is my code:
> 
> my $r = Apache->request;
> 
> $r->content_type('text/html');
> $r->err_headers_out->add('Set-Cookie' => 'userSession=test; 
> domain=.hainesfamily.org; path=/; expires=Mon, 25-Mar-2002 03:30:43 GMT');
> $r->headers_out->add(Location => $redir);
> $r->status(REDIRECT);
> $r->send_http_header;
> 
> my $headers_out = $r->headers_out;
> foreach (keys %$headers_out) {
> warn "$_=$headers_out->{$_}";
> }
> 
> return OK;
> 
> The warn produces the following:
> 
> Set-Cookie=userSession=test; domain=.domain.org; path=/; expires=Mon, 
> 25-Mar-2002 03:30:43 GMT at /path/to/script.pm line 326.
> Location=/r/common/loginWelcome at /path/to/script.pm line 326.
> Connection=close at /path/to/script.pm line 326.
> Transfer-Encoding=chunked at /path/to/script.pm line 326.
> Content-Type=text/html at /path/to/script.pm line 326.
> 
> Am I doing something wrong???
> 
> -Jesse Stay
> 
> On Saturday 23 March 2002 06:43 pm, Eric Frazier wrote:
> > Strong suggestion. Look at an existing cookie that works in IE whatever,
> > copy it, then look at the header that Apache::Cookie is making.
> > This oop cookie crap really bugs me since a cookie is just a stupid header
> > line, not that big of a deal to parse, or write by hand.
> > Abscraction is for things that make good objects and that are HARD, cookies
> > in my opinon don't fit into that category.
> > I strongly bet it has to do with the expire date, also look at the docs,
> > and the code itself under the expires sub. I haven't done e com crap for a
> > while now, but I had lots of trouble getting IE to get it right. Remember
> > Netscape invented the cookie, then IE had to go and tweak with it.
> >
> >
> > Eric
> >
> > At 09:21 PM 3/23/02 -0500, Jesse and Rebecca Stay wrote:
> > >I guess in particular, does anyone know of any known issues with
> > >Apache::Cookie and IE6.0 (or any other versions)?
> > >
> > >On Saturday 23 March 2002 07:09 pm, Jesse and Rebecca Stay wrote:
> > >> Here is the code I use (in this particular case it is being used with a
> > >> redirect, but it doesn't work in any case.):
> > >>
> > >>
> > >>my $cookieContent = Apache::Cookie->new(
> > >>  $r,
> > >>  -name=> 'userSession',
> > >>  -value   => $cookieValue,
> > >>  -expires => '+365d');
> > >>
> > >>$cookieContent->bake();
> > >>
> > >> $r->headers_out->set(Location => $redir);
> > >> $r->status(REDIRECT);
> > >> $r->send_http_header;
> > >> return OK;
> > >>
> > >> I tried expires => '+1Y', but that didn't work either.  Adding the
> > >> domain doesn't do anything either.
> > >>
> > >> On Saturday 23 March 2002 06:44 pm, Frank Wiles wrote:
> > >> > On Sat, 23 Mar 2002 18:52:14 -0500 Jesse and Rebecca Stay
> > >>
> > >> <[EMAIL PROTECTED]> wrote:
> > >> > > Has anyone had any issues in getting cookies to work with IE using
> > >> > > mod_perl? I have tried using both CGI::Cookie and Apache::Cookie,
> > >> > > and in both instances it works just fine under Netscape, but on IE
> > >> > > it doesn't even try to set the cookie.  Any ideas?
> > >> >
> > >> >What are you expire times on your cookies? We ran into a situation
> > >> > where I work that all of the Windows machines were in the wrong time
> > >> > zone and with a 2 hour expire, IE would not set the cookie because it
> > >> > thought it was already expired.  Netscape would however set the cookie
> > >> > anyway.
> > >> >
> > >> >This may not be your problem, but it may be something to think
> > >> > about.
> > >> >
> > >> >  -
> > >> >Frank Wiles <[EMAIL PROTECTED]>
> > >> >http://frank.wiles.org
> > >> >  -
> >
> > http://www.kwinternet.com/eric
> > (250) 655 - 9513 (PST Time Zone)





Re: Fw: Re: Cookies and IE in mod_perl

2002-03-23 Thread Dzuy Nguyen



There are different security levels that must be set.  You can also specifically
tell the browser to accept
all cookies from a particular domain.  There is an article on MS site about
this.  I forgot what it was.
You can probably search for it on google.

Frank Wiles wrote:
[EMAIL PROTECTED]">
  On Sat, 23 Mar 2002 18:52:14 -0500 Jesse and Rebecca Stay <[EMAIL PROTECTED]> wrote:
  
Has anyone had any issues in getting cookies to work with IE using mod_perl?  I have tried using both CGI::Cookie and Apache::Cookie, and in both instances it works just fine under Netscape, but on IE it doesn't even try to set the cookie.  Any ideas?

   What are you expire times on your cookies? We ran into a situation where   I work that all of the Windows machines were in the wrong time zoneand with a 2 hour expire, IE would not set the cookie because it thought   it was already expired.  Netscape would however set the cookie anyway.This may not be your problem, but it may be something to think about.  -   Frank Wiles <[EMAIL PROTECTED]>   http://frank.wiles.org -






Re: Be carefull with apache 1.3.24

2002-03-23 Thread Stas Bekman

Pedro Melo Cunha wrote:
> Hi,
> 
> a bit of history: I read on the documentation the new mod_proxy feature
> called ProxyIOBufferSize which allows for even better handling of lasrge
> mod_perl httpd's. This babby, and another little patch that also made it
> (closing the backend connection as soon as possible) allows for me to
> have a split of 100 modproxy process for only 10 backend mod_perl
> process... neat! :) (BTW, using this and mod_gzip, and you can save a
> bundle instead of buying those nice redline boxes :)
> 
> the problem is that it's only available on 1.3.24 (at the time, 2 or 3
> days ago, it wasnt available yet), so I used the CVS version.
> 
> Looking at the change log, they mention a bug that multiple set-cookie's
> will fail (only the last one will be sent to the client, the proxy will
> "eat" the others). And it was true... The problem is that 1.3.24 final
> also has that bug: only the last set-cookie will reach your browser.
> 
> This was a show-stopper for my application. So I sat down, read the
> proxy code, and made a patch to solve the bug. I then sent the patch to
> the apache bug database (i really hate gnats ;), but they drop it (as a
> duplicate). I admit i could not attach my patch to the existing bug
> report on this subject (I said I hated gnat's :). So my patch did not
> made it the 1.3.24...

Pedro, please send it to dev @ httpd.apache.org.

> Anyway, I attached here. Maybe someone here can push it into apache for
> the next release, and in the meantime you can use it, if you want.
> 
> I also attach a cgi that set's two cookies, to demonstrate the problem.
> 
> Best regards,
> 
> PS: mod_perl totally rocks... serving well over 70.000.000 pageviews
> with mason...
> 
> 
> 
> 
> Index: proxy_http.c
> ===
> RCS file: /home/cvspublic/apache-1.3/src/modules/proxy/proxy_http.c,v
> retrieving revision 1.88
> diff -u -r1.88 proxy_http.c
> --- proxy_http.c  21 Mar 2002 11:38:03 -  1.88
> +++ proxy_http.c  22 Mar 2002 01:21:39 -
> @@ -136,6 +136,20 @@
>  return url;
>  }
>  
> +
> +/* copies header key/value into table p if it's a cookie header.
> + * this is a callback function for a ap_table_do below.
> + */
> +int ap_proxy_copy_cookie_headers(void *p, const char *key, const char *value)
> +{
> +table *d = (table *)p;
> +
> +if (!strcasecmp(key, "Set-Cookie") || !strcasecmp(key, "Set-Cookie2"))
> +  ap_table_add(d, key, value);
> +
> +return 1;
> +}
> +
>  /*
>   * This handles http:// URLs, and other URLs using a remote proxy over http
>   * If proxyhost is NULL, then contact the server directly, otherwise
> @@ -529,8 +543,20 @@
>  ap_proxy_write_headers(c, ap_pstrcat(p, "HTTP/1.1 ", r->status_line, NULL), 
>resp_hdrs);
>  }
>  
> -/* Setup the headers for our client from upstreams response-headers */
> +/* Setup the headers for our client from upstreams response-headers.
> + * We use resp_hdrs to keep all the Set-Cookie and Set-Cookie2 headers,
> + * and then call ap_overlap_table, because it keep's only the last one.
> + * The we copy all the cookies back.
> +  */
> +ap_table_do(ap_proxy_copy_cookie_headers, resp_hdrs, r->headers_out, NULL);
> +
>  ap_overlap_tables(r->headers_out, resp_hdrs, AP_OVERLAP_TABLES_SET);
> +
> +ap_table_unset(r->headers_out, "Set-Cookie");
> +ap_table_unset(r->headers_out, "Set-Cookie2");
> +
> +ap_table_do(ap_proxy_copy_cookie_headers, r->headers_out, resp_hdrs, NULL);
> +
>  /* Add X-Cache header - be careful not to obliterate any upstream headers */
>  ap_table_mergen(r->headers_out, "X-Cache",
>ap_pstrcat(r->pool, "MISS from ",
> 
> 
> 
> 
> #!/usr/local/bin/perl -w
> 
> use CGI qw( :standard );
> use CGI::Cookie;
> 
> my $c1 = new CGI::Cookie(-name=>'ID',-value=>123456);
> my $c2 = new CGI::Cookie(-name=>'preferences',
>  -value=>{ font => Helvetica, size => 12 });
> 
> print header(-cookie=>[$c1,$c2]);
> 
> print "Done";



-- 


__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com





Re: Cookies and IE in mod_perl

2002-03-23 Thread Jesse and Rebecca Stay

Ok - I got rid of the Apache::Cookie stuff, and am now doing things manually, 
but it still doesn't generate a cookie in IE.  It still works in Netscape.  I 
get a redirect, but no cookie.  Here is my code:

my $r = Apache->request;

$r->content_type('text/html');
$r->err_headers_out->add('Set-Cookie' => 'userSession=test; 
domain=.hainesfamily.org; path=/; expires=Mon, 25-Mar-2002 03:30:43 GMT');
$r->headers_out->add(Location => $redir);
$r->status(REDIRECT);
$r->send_http_header;

my $headers_out = $r->headers_out;
foreach (keys %$headers_out) {
warn "$_=$headers_out->{$_}";
}

return OK;

The warn produces the following:

Set-Cookie=userSession=test; domain=.domain.org; path=/; expires=Mon, 
25-Mar-2002 03:30:43 GMT at /path/to/script.pm line 326.
Location=/r/common/loginWelcome at /path/to/script.pm line 326.
Connection=close at /path/to/script.pm line 326.
Transfer-Encoding=chunked at /path/to/script.pm line 326.
Content-Type=text/html at /path/to/script.pm line 326.

Am I doing something wrong???

-Jesse Stay

On Saturday 23 March 2002 06:43 pm, Eric Frazier wrote:
> Strong suggestion. Look at an existing cookie that works in IE whatever,
> copy it, then look at the header that Apache::Cookie is making.
> This oop cookie crap really bugs me since a cookie is just a stupid header
> line, not that big of a deal to parse, or write by hand.
> Abscraction is for things that make good objects and that are HARD, cookies
> in my opinon don't fit into that category.
> I strongly bet it has to do with the expire date, also look at the docs,
> and the code itself under the expires sub. I haven't done e com crap for a
> while now, but I had lots of trouble getting IE to get it right. Remember
> Netscape invented the cookie, then IE had to go and tweak with it.
>
>
> Eric
>
> At 09:21 PM 3/23/02 -0500, Jesse and Rebecca Stay wrote:
> >I guess in particular, does anyone know of any known issues with
> >Apache::Cookie and IE6.0 (or any other versions)?
> >
> >On Saturday 23 March 2002 07:09 pm, Jesse and Rebecca Stay wrote:
> >> Here is the code I use (in this particular case it is being used with a
> >> redirect, but it doesn't work in any case.):
> >>
> >>
> >>my $cookieContent = Apache::Cookie->new(
> >>  $r,
> >>  -name=> 'userSession',
> >>  -value   => $cookieValue,
> >>  -expires => '+365d');
> >>
> >>$cookieContent->bake();
> >>
> >> $r->headers_out->set(Location => $redir);
> >> $r->status(REDIRECT);
> >> $r->send_http_header;
> >> return OK;
> >>
> >> I tried expires => '+1Y', but that didn't work either.  Adding the
> >> domain doesn't do anything either.
> >>
> >> On Saturday 23 March 2002 06:44 pm, Frank Wiles wrote:
> >> > On Sat, 23 Mar 2002 18:52:14 -0500 Jesse and Rebecca Stay
> >>
> >> <[EMAIL PROTECTED]> wrote:
> >> > > Has anyone had any issues in getting cookies to work with IE using
> >> > > mod_perl? I have tried using both CGI::Cookie and Apache::Cookie,
> >> > > and in both instances it works just fine under Netscape, but on IE
> >> > > it doesn't even try to set the cookie.  Any ideas?
> >> >
> >> >What are you expire times on your cookies? We ran into a situation
> >> > where I work that all of the Windows machines were in the wrong time
> >> > zone and with a 2 hour expire, IE would not set the cookie because it
> >> > thought it was already expired.  Netscape would however set the cookie
> >> > anyway.
> >> >
> >> >This may not be your problem, but it may be something to think
> >> > about.
> >> >
> >> >  -
> >> >Frank Wiles <[EMAIL PROTECTED]>
> >> >http://frank.wiles.org
> >> >  -
>
> http://www.kwinternet.com/eric
> (250) 655 - 9513 (PST Time Zone)



Re: Cookies and IE in mod_perl

2002-03-23 Thread Jesse and Rebecca Stay

I guess in particular, does anyone know of any known issues with 
Apache::Cookie and IE6.0 (or any other versions)?

On Saturday 23 March 2002 07:09 pm, Jesse and Rebecca Stay wrote:
> Here is the code I use (in this particular case it is being used with a
> redirect, but it doesn't work in any case.):
>
>
>my $cookieContent = Apache::Cookie->new(
>  $r,
>  -name=> 'userSession',
>  -value   => $cookieValue,
>  -expires => '+365d');
>
>$cookieContent->bake();
>
> $r->headers_out->set(Location => $redir);
> $r->status(REDIRECT);
> $r->send_http_header;
> return OK;
>
> I tried expires => '+1Y', but that didn't work either.  Adding the domain
> doesn't do anything either.
>
> On Saturday 23 March 2002 06:44 pm, Frank Wiles wrote:
> > On Sat, 23 Mar 2002 18:52:14 -0500 Jesse and Rebecca Stay
>
> <[EMAIL PROTECTED]> wrote:
> > > Has anyone had any issues in getting cookies to work with IE using
> > > mod_perl? I have tried using both CGI::Cookie and Apache::Cookie, and
> > > in both instances it works just fine under Netscape, but on IE it
> > > doesn't even try to set the cookie.  Any ideas?
> >
> >What are you expire times on your cookies? We ran into a situation
> > where I work that all of the Windows machines were in the wrong time zone
> > and with a 2 hour expire, IE would not set the cookie because it thought
> > it was already expired.  Netscape would however set the cookie anyway.
> >
> >This may not be your problem, but it may be something to think about.
> >
> >  -
> >Frank Wiles <[EMAIL PROTECTED]>
> >http://frank.wiles.org
> >  -



Be carefull with apache 1.3.24

2002-03-23 Thread Pedro Melo Cunha

Hi,

a bit of history: I read on the documentation the new mod_proxy feature
called ProxyIOBufferSize which allows for even better handling of lasrge
mod_perl httpd's. This babby, and another little patch that also made it
(closing the backend connection as soon as possible) allows for me to
have a split of 100 modproxy process for only 10 backend mod_perl
process... neat! :) (BTW, using this and mod_gzip, and you can save a
bundle instead of buying those nice redline boxes :)

the problem is that it's only available on 1.3.24 (at the time, 2 or 3
days ago, it wasnt available yet), so I used the CVS version.

Looking at the change log, they mention a bug that multiple set-cookie's
will fail (only the last one will be sent to the client, the proxy will
"eat" the others). And it was true... The problem is that 1.3.24 final
also has that bug: only the last set-cookie will reach your browser.

This was a show-stopper for my application. So I sat down, read the
proxy code, and made a patch to solve the bug. I then sent the patch to
the apache bug database (i really hate gnats ;), but they drop it (as a
duplicate). I admit i could not attach my patch to the existing bug
report on this subject (I said I hated gnat's :). So my patch did not
made it the 1.3.24...

Anyway, I attached here. Maybe someone here can push it into apache for
the next release, and in the meantime you can use it, if you want.

I also attach a cgi that set's two cookies, to demonstrate the problem.

Best regards,

PS: mod_perl totally rocks... serving well over 70.000.000 pageviews
with mason...
-- 
Pedro Melo Cunha - <[EMAIL PROTECTED]>
Novis Telecom, S.A. - Dir. Rede - ISP 
Edifício Novis - Estrada da Outurela, 118 - 2795-606 Carnaxide
tel:  +351 21 0104340 - fax: +351 21 0104301


Index: proxy_http.c
===
RCS file: /home/cvspublic/apache-1.3/src/modules/proxy/proxy_http.c,v
retrieving revision 1.88
diff -u -r1.88 proxy_http.c
--- proxy_http.c21 Mar 2002 11:38:03 -  1.88
+++ proxy_http.c22 Mar 2002 01:21:39 -
@@ -136,6 +136,20 @@
 return url;
 }
 
+
+/* copies header key/value into table p if it's a cookie header.
+ * this is a callback function for a ap_table_do below.
+ */
+int ap_proxy_copy_cookie_headers(void *p, const char *key, const char *value)
+{
+table *d = (table *)p;
+
+if (!strcasecmp(key, "Set-Cookie") || !strcasecmp(key, "Set-Cookie2"))
+  ap_table_add(d, key, value);
+
+return 1;
+}
+
 /*
  * This handles http:// URLs, and other URLs using a remote proxy over http
  * If proxyhost is NULL, then contact the server directly, otherwise
@@ -529,8 +543,20 @@
 ap_proxy_write_headers(c, ap_pstrcat(p, "HTTP/1.1 ", r->status_line, NULL), 
resp_hdrs);
 }
 
-/* Setup the headers for our client from upstreams response-headers */
+/* Setup the headers for our client from upstreams response-headers.
+ * We use resp_hdrs to keep all the Set-Cookie and Set-Cookie2 headers,
+ * and then call ap_overlap_table, because it keep's only the last one.
+ * The we copy all the cookies back.
+*/
+ap_table_do(ap_proxy_copy_cookie_headers, resp_hdrs, r->headers_out, NULL);
+
 ap_overlap_tables(r->headers_out, resp_hdrs, AP_OVERLAP_TABLES_SET);
+
+ap_table_unset(r->headers_out, "Set-Cookie");
+ap_table_unset(r->headers_out, "Set-Cookie2");
+
+ap_table_do(ap_proxy_copy_cookie_headers, r->headers_out, resp_hdrs, NULL);
+
 /* Add X-Cache header - be careful not to obliterate any upstream headers */
 ap_table_mergen(r->headers_out, "X-Cache",
   ap_pstrcat(r->pool, "MISS from ",


#!/usr/local/bin/perl -w

use CGI qw( :standard );
use CGI::Cookie;

my $c1 = new CGI::Cookie(-name=>'ID',-value=>123456);
my $c2 = new CGI::Cookie(-name=>'preferences',
 -value=>{ font => Helvetica, size => 12 });

print header(-cookie=>[$c1,$c2]);

print "Done";



Re: Cookies and IE in mod_perl

2002-03-23 Thread Jesse and Rebecca Stay

Here is the code I use (in this particular case it is being used with a 
redirect, but it doesn't work in any case.):


   my $cookieContent = Apache::Cookie->new(
 $r,
 -name=> 'userSession',
 -value   => $cookieValue,
 -expires => '+365d');

   $cookieContent->bake();

$r->headers_out->set(Location => $redir);
$r->status(REDIRECT);
$r->send_http_header;
return OK; 

I tried expires => '+1Y', but that didn't work either.  Adding the domain 
doesn't do anything either.

On Saturday 23 March 2002 06:44 pm, Frank Wiles wrote:
> On Sat, 23 Mar 2002 18:52:14 -0500 Jesse and Rebecca Stay 
<[EMAIL PROTECTED]> wrote:
> > Has anyone had any issues in getting cookies to work with IE using
> > mod_perl? I have tried using both CGI::Cookie and Apache::Cookie, and in
> > both instances it works just fine under Netscape, but on IE it doesn't
> > even try to set the cookie.  Any ideas?
>
>What are you expire times on your cookies? We ran into a situation where
>I work that all of the Windows machines were in the wrong time zone
>and with a 2 hour expire, IE would not set the cookie because it thought
>it was already expired.  Netscape would however set the cookie anyway.
>
>This may not be your problem, but it may be something to think about.
>
>  -
>Frank Wiles <[EMAIL PROTECTED]>
>http://frank.wiles.org
>  -



Fw: Re: Cookies and IE in mod_perl

2002-03-23 Thread Frank Wiles

On Sat, 23 Mar 2002 18:52:14 -0500 Jesse and Rebecca Stay <[EMAIL PROTECTED]> wrote:

> Has anyone had any issues in getting cookies to work with IE using mod_perl?  
> I have tried using both CGI::Cookie and Apache::Cookie, and in both instances 
> it works just fine under Netscape, but on IE it doesn't even try to set the 
> cookie.  Any ideas?

   What are you expire times on your cookies? We ran into a situation where
   I work that all of the Windows machines were in the wrong time zone 
   and with a 2 hour expire, IE would not set the cookie because it thought
   it was already expired.  Netscape would however set the cookie anyway. 

   This may not be your problem, but it may be something to think about. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 -





Re: AddModule mod_perl.c

2002-03-23 Thread John Kolvereid

Hi Ged,
Which Guide?  Please advise.  Thanks.
John Kolvereid

--- Ged Haywood <[EMAIL PROTECTED]> wrote:
> Hi there,
> 
> On Sat, 23 Mar 2002, John Kolvereid wrote:
> 
> >I am trying to install/configure mod_perl.  I
> think
> > it is installed but not quite sure.
> 
> It's in the Guide. (How do I know if mod_perl is
> installed?)
> 
> > According to the mod_perl Reference Guide the line
> >  AddModule mod_perl.c
> > should be added to my httpd.conf, otherwise
> mod_perl
> > is not activated.
> 
> I think you'd better have a more careful look at
> that Guide.  You only
> need that in your config if you have mod_perl built
> as a DSO (Dynamic
> Shared Object) which means that Apache starts
> without trhe mod_perl
> module and then loads it later when it reads the
> line
> 
>   AddModule mod_perl.c
> 
> in httpd.conf.
> 
> > when I include the line and try
> > to load any page into my browser I get the msg:
> >   The document contained no data
> 
> Something isn't working right.  :)  Could be all
> sorts of things.
> Read the file mod_perl/SUPPORT to begin with.  Post
> the information
> requested in there.
> 
> 73,
> Ged.
> 


__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/



Cookies and IE in mod_perl

2002-03-23 Thread Jesse and Rebecca Stay

Has anyone had any issues in getting cookies to work with IE using mod_perl?  
I have tried using both CGI::Cookie and Apache::Cookie, and in both instances 
it works just fine under Netscape, but on IE it doesn't even try to set the 
cookie.  Any ideas?

-Jesse Stay



Re: AddModule mod_perl.c

2002-03-23 Thread Ged Haywood

Hi there,

On Sat, 23 Mar 2002, John Kolvereid wrote:

>I am trying to install/configure mod_perl.  I think
> it is installed but not quite sure.

It's in the Guide. (How do I know if mod_perl is installed?)

> According to the mod_perl Reference Guide the line
>  AddModule mod_perl.c
> should be added to my httpd.conf, otherwise mod_perl
> is not activated.

I think you'd better have a more careful look at that Guide.  You only
need that in your config if you have mod_perl built as a DSO (Dynamic
Shared Object) which means that Apache starts without trhe mod_perl
module and then loads it later when it reads the line

  AddModule mod_perl.c

in httpd.conf.

> when I include the line and try
> to load any page into my browser I get the msg:
>   The document contained no data

Something isn't working right.  :)  Could be all sorts of things.
Read the file mod_perl/SUPPORT to begin with.  Post the information
requested in there.

73,
Ged.




Re: Problems installing on Solaris 8

2002-03-23 Thread Ged Haywood

Hi all,

 Wayne Pascoe <[EMAIL PROTECTED]> writes:
> > [8:37am]# httpd -l
> > Compiled-in modules:
> >   http_core.c
> >   mod_so.c
> >   mod_perl.c
> > suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec

I didn't think I'd been dreaming.

> As a matter of principle, I tend not to mix static and dynamic.

Me too.

> where I'm unsure, I go all static and build distinct binaries.

Me too.  But if you go all dynamic it's quicker to pull modules out,
and you can change the order they're loaded which is important in some
cases.  Pity my Solaris box isn't with me (1,000 miles away) or I'd
ask you to send me your config. and try to repeat your problem.

Come to think of it I did ask, anyway...

On 23 Mar 2002, Dave Hodgkinson wrote:
> Wayne Pascoe <[EMAIL PROTECTED]> writes:
> > Dave Hodgkinson <[EMAIL PROTECTED]> writes:
> > > Ged Haywood <[EMAIL PROTECTED]> writes:
> > > > Post your httpd.conf?

73,
Ged.




Re: Performace...

2002-03-23 Thread Perrin Harkins

> Im curious as to the difference in performance when using perl scripts
with
> Apache::Registry or writing complete Apache Modules in Perl that
conform to
> the API?

Check the list archives for benchmarks by Joshua Chamas.  Note that
there are other reasons to use handlers instead of Registry, which you
will also find in the archives.

- Perrin




Re: Performace...

2002-03-23 Thread Geoffrey Young



John Von Essen wrote:

> Im curious as to the difference in performance when using perl scripts with
> Apache::Registry or writing complete Apache Modules in Perl that conform to
> the API?


straight mod_perl handlers are faster than Apache::Registry, but they lack some 
of the convenience that you might be looking for in an application that has lots 
of dynamic components.

you might be interested in Joshua Chamas' ongoing benchmark project:

[EMAIL PROTECTED]">http://mathforum.org/epigone/modperl/sercrerdprou/[EMAIL PROTECTED]
http://www.chamas.com/bench/

he has the results from a benchmark of Apache::Registry and plain handlers, as 
well as comparisons between HTML::Mason, Embperl, and other templating engines.

HTH

--Geoff







Performace...

2002-03-23 Thread John Von Essen

Im curious as to the difference in performance when using perl scripts with
Apache::Registry or writing complete Apache Modules in Perl that conform to
the API?

-jve




Re: mod_perl developers cookbook... a kitchen hand asks... doh!

2002-03-23 Thread Per Einar Ellefsen

At 17:30 23.03.2002 +, Jeff wrote:
>Just Curious of Hither Green writes:
>
>So, I am working my way through, and get to page 83 which has a little
>spellette:
>
>sub handler {
>   my $r = shift;
>   print STDERR $r->as_string();
>   return OK;
>}
>
>looks easy peasy - but
>
>1) OK ->  Bareword "OK" not allowed while "strict subs" in use
>well, that's easy to fix - I must be missing a 'use' [which one??]
>I assume OK is 1 - ie TRUE
>
>2) error log: Subroutine handler redefined at xxx line 1
>
>This is interesting - probably because PerlHandler Apache::Registry so
>kitchen whizzes, tell me please, exactly what knead I put in my
>httpd.conf instead of Apache::Registry?

You must have taken this subroutine out of context. There are a certain 
number of things which must appear for an Apache handler to work:

package Apache::Whatever;

You need to have that line to uniquely identify your module. If you use the 
name Apache::Whatever, your handler must be named Whatever.pm and be placed 
in your @INC search path under Apache/
This is probably the reason for your number 2 problem: you must have used 
the same package name twice. Or not used a package name at all.

use Apache::Constants;

This imports the constants like OK, DECLINED, etc... You can also specify 
them explicitly:
use Apache::Constants qw(OK DECLINED);

I hope this helps you out.

-- 

Per Einar Ellefsen
[EMAIL PROTECTED]




Re: mod_perl developers cookbook... a kitchen hand asks... doh!

2002-03-23 Thread Geoffrey Young


> 
> "OK" is a constant for the HTTP return code 200.  


close.  OK is 0, which is different from HTTP_OK which is 200.

--Geoff




Re: mod_perl developers cookbook... a kitchen hand asks... doh!

2002-03-23 Thread Geoffrey Young



Jeff wrote:

 > Just Curious of Hither Green writes:
 >
 > I feel like a right tit for asking this...
 >
 > I already have mod_perl et al running, including my persistent DB connections
 >  etc etc, but following gourmet cookery advice on this list induced me to
 > buy a copy of the mod_perl Developers Cookbook... and yes, my nails were
 > rather short after the week it took my Amazon to deliver said arcane tome
 > unto my abode.


I hope you enjoy it and that you didn't bite to the quick...


 >
 > So, I am working my way through, and get to page 83 which has a little spellette:
 >

 >
 > sub handler { my $r = shift; print STDERR $r->as_string(); return OK; }
 >
 > looks easy peasy - but
 >
 > 1) OK ->  Bareword "OK" not allowed while "strict subs" in use well, that's
 > easy to fix - I must be missing a 'use' [which one??] I assume OK is 1 - ie
 >  TRUE


OK is actually 0, but is better used as

use Apache::Constants qw(OK);

as to avoid any real value behind the OK constant.  see recipe 3.12 for more 
details about this notation.


 >
 > 2) error log: Subroutine handler redefined at xxx line 1


well, you have to put handler() in a package first... depending on which package
you put it in, it might redefine something that already exists.


you're coming up against something I struggled with throughout the book.  lots 
of our examples use handler snippets instead of the complete handler.  this is 
because I thought doing this

package Cookbook::Foo;

use Apache::Constants qw(:common);
use strict;

sub handler {
  ...
}

1;

wasted lots of space - in this particular instance the other cruft is longer 
than the code we were illustrating :)

so I basically took the point of view that for shortish stuff enforcing the 
handler() meme was good enough, and the package stuff could be reinforced 
elsewhere.  and there's always the eagle book in addition to our stuff.

I hope that as you read through the rest of the book things start solidifying...

HTH

--Geoff




Re: mod_perl developers cookbook... a kitchen hand asks... doh!

2002-03-23 Thread Ade Olonoh

 
> 1) OK ->  Bareword "OK" not allowed while "strict subs" in use
>well, that's easy to fix - I must be missing a 'use' [which one??]
>I assume OK is 1 - ie TRUE

"OK" is a constant for the HTTP return code 200.  Add:

use Apache::Constants ':common';

to the top of your prog. and it should work.


> 2) error log: Subroutine handler redefined at xxx line 1

Are you using Apache::StatINC?


--Ade.



mod_perl developers cookbook... a kitchen hand asks... doh!

2002-03-23 Thread Jeff

Just Curious of Hither Green writes: 

I feel like a right tit for asking this...

I already have mod_perl et al running, including my persistent DB
connections etc etc, but following gourmet cookery advice on this list
induced me to buy a copy of the mod_perl Developers Cookbook... and yes,
my nails were rather short after the week it took my Amazon to deliver
said arcane tome unto my abode.

So, I am working my way through, and get to page 83 which has a little
spellette:

sub handler {
  my $r = shift;
  print STDERR $r->as_string();
  return OK;
}

looks easy peasy - but

1) OK ->  Bareword "OK" not allowed while "strict subs" in use
   well, that's easy to fix - I must be missing a 'use' [which one??]
   I assume OK is 1 - ie TRUE

2) error log: Subroutine handler redefined at xxx line 1

This is interesting - probably because PerlHandler Apache::Registry so
kitchen whizzes, tell me please, exactly what knead I put in my
httpd.conf instead of Apache::Registry?

Thanks a munch!

Jeff





AddModule mod_perl.c

2002-03-23 Thread John Kolvereid

Hi,
   I am trying to install/configure mod_perl.  I think
it is installed but not quite sure.  According to the
mod_perl Reference Guide the line
 AddModule mod_perl.c
should be added to my httpd.conf, otherwise mod_perl
is not activated.  Yet when I include the line and try
to load any page into my browser I get the msg:
  The document contained no data
  Try again later, or contact the server's
administrator

If I comment out the line then all is well again.  Any
ideas.  Please advise.  Thanks.

  John Kolvereid

__
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/



Re: Problems installing on Solaris 8

2002-03-23 Thread Dave Hodgkinson

Wayne Pascoe <[EMAIL PROTECTED]> writes:

> Dave Hodgkinson <[EMAIL PROTECTED]> writes:
> 
> > Ged Haywood <[EMAIL PROTECTED]> writes:
> > 
> > > Something very wrong there.  Do you have squeaky clean source trees?
> > > I'd be tempted to erase the lot and start again.  What's the compiler?
> > > Post your httpd.conf?  Have you built other (older) versions of Apache
> > > and mod_perl on the same OS?
> > 
> > httpd -l 
> > 
> > should verify what modules really are linked in.
> 
>   [8:37am]# httpd -l
> Compiled-in modules:
>   http_core.c
>   mod_so.c
>   mod_perl.c
> suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec

As a matter of principle, I tend not to mix static and dynamic. Recent
redhats have been good anough to go all dynamic, where I'm unsure, I
go all static and build distinct binaries.

Not a solution, but an approach...

-- 
Dave Hodgkinson, Wizard for Hire http://www.davehodgkinson.com
Editor-in-chief, The Highway Starhttp://www.thehighwaystar.com
   Interim Technical Director, Web Architecture Consultant for hire



Re: PerlModule hell - questions and comments

2002-03-23 Thread Kee Hinckley

At 7:04 PM +0800 3/23/02, Stas Bekman wrote:
>If all you want to do is to be able to load the module only during 
>the restart use in startup.pl:
>
>   if ($Apache::Server::ReStarting) {
>   require "My::Sensitive::Module";
>   }

No, the module has to be loaded during both phases, other wise the 
configuration file syntax extensions it adds won't be loaded.  The 
sequence is:

1. Module loads
2. On load, module registers as an Apache module
3. On the second parse of the config file, apache asks module to unload
4. Perl module unregisters itself
5. Module isn't reloaded (because perl modules get loaded only once)
6. Apache module doesn't get reloaded
7. Config file parse fails with syntax errors

You would think that I could just skip step #4, but as far as I can 
tell that leaves stale pointers around, at least on some 
platforms/configurations.  It also doesn't seem proper in general.

The only work-around I have is to add an  section that calls 
the initialization manually.  That works, but one would hope that 
Perl modules could be treated as first-class Apache modules with 
extra magic in the config file.

BTW.  I thought that startup.pl was only called once, so your 
suggestion would only work inside a  directive anyway?
-- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
[EMAIL PROTECTED]

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.



Re: Problems installing on Solaris 8

2002-03-23 Thread Dave Hodgkinson

Ged Haywood <[EMAIL PROTECTED]> writes:

> Something very wrong there.  Do you have squeaky clean source trees?
> I'd be tempted to erase the lot and start again.  What's the compiler?
> Post your httpd.conf?  Have you built other (older) versions of Apache
> and mod_perl on the same OS?

httpd -l 

should verify what modules really are linked in.

-- 
Dave Hodgkinson, Wizard for Hire http://www.davehodgkinson.com
Editor-in-chief, The Highway Starhttp://www.thehighwaystar.com
   Interim Technical Director, Web Architecture Consultant for hire



Re: Problems installing on Solaris 8

2002-03-23 Thread Ged Haywood

Hi there,

On 23 Mar 2002, Wayne Pascoe wrote:

> Ged Haywood <[EMAIL PROTECTED]> writes:
> 
> > Have you tried sompiling static instead of DSO?
> 
> This is a static build.

Sorry, I've deleted the original message.  Why did I think it wasn't?
I must be having a very bad day today.

> if I compile Apache with mod_perl, then mod_auth_db, mod_proxy and
> mod_negotiation all stop working. If I compile Apache without
> mod_perl then they continue to work just fine.

Something very wrong there.  Do you have squeaky clean source trees?
I'd be tempted to erase the lot and start again.  What's the compiler?
Post your httpd.conf?  Have you built other (older) versions of Apache
and mod_perl on the same OS?

73,
Ged.




Re: PerlModule hell - questions and comments

2002-03-23 Thread Stas Bekman

Kee Hinckley wrote:
> At 4:18 PM -0500 3/22/02, Perrin Harkins wrote:
> 
>> Modules loaded with PerlModule and PerlRequire are not supposed to be 
>> loaded again the second time.  I seem to remember that they are loaded 
>> again when using DSO though, so if you're using DSO you may want to 
>> recompile as static.  Also, if you have PerlFreshRestart on that will 
>> cause a reload.
> 
> 
> If all you were doing was loading a normal Perl module, the single load 
> would be fine.  The catch is that in this case we are loading a Perl 
> module which in turn is registering an Apache module.  The Apache module 
> is being *unloaded* prior to the second pass through the config file.  
> The only way that it will be reloaded is if the Perl module is reloaded 
> on the second pass as well.

If all you want to do is to be able to load the module only during the 
restart use in startup.pl:

   if ($Apache::Server::ReStarting) {
   require "My::Sensitive::Module";
   }


-- 


__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com





Re: Asia To USA Shipping Rates

2002-03-23 Thread Ask Bjoern Hansen

On Mon, 18 Mar 2002, Geoffrey Young wrote:

> [EMAIL PROTECTED] wrote:
> > 
> > We have a full collection of wholesale freight rate calculators at
> 
> Aaaahhh!! Ask, anybody, make it stop!!!

Wow. The lusers had actually subscribed that address to be able to 
post.

I'll do what I can to make it stop.

 - ask




Re: [ANNOUNCE] The New "mod_perl" logo - results now in...

2002-03-23 Thread Ask Bjoern Hansen

On Sat, 16 Mar 2002 [EMAIL PROTECTED] wrote:

[...]
> To make things thing even more complicated I agree the need of a name
> with a sounding image, which will help mod_perl to grow into corporate
> computing (our future jobs).
> 
> Recently I had a discussion with a Java programmer, who said that
> mod_perl is a try to save the obsolete language Perl. His argument was
> that only Java programmers are searched, especially here in Europe.
> 
> So I see three requirements:
>  - Having a name and logo which tells the truth,
>it's Perl and it was good.
>  - The name should defer to Perl, should be it's own brand.
>  - The sounding must be stronger then API

Please go back to the marketing people and tell them to smoke 
somewhere else.

 o) mod_perl is the perl apache module. Apache modules are called 
mod_foo.c.

 o) It is "just" an interface to the Apache API.

 o) We've had this discussion several times before; I even had to 
check the year on the postings to be sure that I was not 
replying to an old thread.  Please stop.
 

 - ask 

-- 
ask bjoern hansen, http://ask.netcetera.dk/ !try; do();
more than a billion impressions per week, http://valueclick.com





Re: 'Pinning' the root apache process in memory with mlockall

2002-03-23 Thread Bill Marrs

At 10:53 PM 3/22/2002, Stas Bekman wrote:
>top and libgtop use the same source of information, so it has nothing to 
>do with these tools.

'top' has the ability to display SWAP on a per-process basis (you have to 
change the defaults to see it, but it's there).

I didn't find this per-process SWAP value in Gtop.pm anywhere.

If GTop.pm had it, I could fix GTopLimit's bug.

-bill




Re: Problems installing on Solaris 8

2002-03-23 Thread Wayne Pascoe

Ged Haywood <[EMAIL PROTECTED]> writes:

> Hi there,
> 
> On 23 Mar 2002, Wayne Pascoe wrote:
> 
> > Why does mod_perl need ssl and crypto ? Just curious...
> 
> It doesn't.  Have you tried sompiling static instead of DSO?  There
> have been DSO problems on Solaris (and elsewhere :) in the past but I
> thought they were mostly put to bed now.

This is a static build. mod_perl seems to compile ok actually. It's
just that if I compile Apache with mod_perl, then mod_auth_db,
mod_proxy and mod_negotiation all stop working. If I compile Apache
without mod_perl then they continue to work just fine.  

-- 
- Wayne Pascoe
 | I laugh in the face of danger...
[EMAIL PROTECTED]   | Then I run and hide until it goes away!
http://www.molemanarmy.com   | 



Re: Apache and Perl with Virtual Host [OT]

2002-03-23 Thread Ged Haywood

Hi again,

Oh, rats, I'm sorry, I shouldn't have sent that.  I'm not sure that
it's your 'Options' settings at all.  Have you got the right execute
permisions on the directories/files that you're trying to get Apache
to search and/or execute?  Have you got anything in the error_log?

By way of further apology, if you'd care to reply to me privately
we'll get it running for you off-list as it's not a mod_perl issue.

73,
Ged.

--

On Sat, 23 Mar 2002, Ged Haywood wrote:

> Hi there,
> 
> On Fri, 22 Mar 2002, Matt Phelps wrote:
> 
> [snip,snip]
> > Okay, this is still giving me problems. Here is my config. I've
> > tried several things and still nothing. For some reason I can't get
> > cgi scripts to run under any virtual webs, but the default web.
> 
> What's a 'web'?  I think you mean 'host'.  (It helps if we all speak
> the same language, especially if we are using a search engine... :)
> 
> > I do have mod_perl installed.
> 
> Oh, all right then... :)
> 
> > I'm sure it's got to be something so simple.
> 
> I think it's called 'reading the documentation'... :)
> 
> > 
> > DocumentRoot /var/www/html
> > ServerName www2.zeetec.net
> > Options +ExecCGI
> > Alias /host/ /webhome/host/
> > Alias /cgi-bin/ /var/www/cgi-bin/
> > ScriptAlias /cgi-bin/ /var/www/cgi-bin
> > 
> > SetHandler perl-script
> > PerlHandler Apache::Registry
> > PerlSendHeader On   
> > Options +ExecCGI
> > 
> > 
> > AllowOverride None
> > Options None   <--- This removes 'ExecCGI' from your Options
> > Order allow,deny
> > Allow from all
> > 
> > 
> 
> Check the Apache docs about the behaviour of the 'Options' directive.
> 
> 73,
> Ged.
> 
> 




Re: Problems installing on Solaris 8

2002-03-23 Thread Ged Haywood

Hi there,

On 23 Mar 2002, Wayne Pascoe wrote:

> Why does mod_perl need ssl and crypto ? Just curious...

It doesn't.  Have you tried sompiling static instead of DSO?  There
have been DSO problems on Solaris (and elsewhere :) in the past but I
thought they were mostly put to bed now.

73,
Ged.