Re: PerlSendHeader On
[ Please keep it on the list ... ] Bleicke Holm wrote: [Thu Mar 20 11:16:40 2003] [notice] Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.1.2 mod_perl/1.26 mod_perl/1.26 configured -- resuming normal operations [Thu Mar 20 11:16:40 2003] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache/suexec) [Thu Mar 20 11:16:40 2003] [info] Server built: Nov 5 2002 06:43:12 [Thu Mar 20 11:16:40 2003] [notice] Accept mutex: sysvsem (Default: sysvsem) Looks OK to me... It should not show mod_perl/1.26 twice in that line. What happens if you just take your working cgi-bin part and change the SetHandler and add PerlHandler so it runs through mod_perl? It doesn't work anymore... (I added PerlSendHeader On, too) Do you have any ScriptAlias statements in your conf file? Have you tried changing from "Options ExecCGI" to "Options +ExecCGI"? I think you should try to strip down the conf file as far as you possibly can and then post the whole thing here. There may be something else that you defined somewhere which is interfering with mod_perl. - Perrin
Re: PerlSendHeader On
Bleicke Holm wrote: Also, make sure that mod_perl is actually running by checking the error_log as described in the docs. For the time being there is no error message at all dans the error_log. I was actually referring to this: http://perl.apache.org/docs/1.0/guide/install.html#How_can_I_tell_whether_mod_perl_is_running_ What happens if you just take your working cgi-bin part and change the SetHandler and add PerlHandler so it runs through mod_perl? - Perrin
Re: PerlSendHeader On
Perrin Harkins wrote: > > Bleicke Holm wrote: > > I continue to get returned the source-code. Searching the doc and faqs > > it looks as if I should turn on PerlSendHeader. But that's already done! > > Make sure the file is executable by the user that the server is running > as. I've checked that one. It was world-executable. To be sure I changed the user that the server is running as to the one owning the test script and the directory it lives in. No go! A parent directory actually was a symlink, I've changed that, too: still no way... > Also, make sure that mod_perl is actually running by checking the > error_log as described in the docs. > For the time being there is no error message at all dans the error_log. I'll try and see if I can get things more verbose. Thanks for your answer anyway, Bleicke
Re: PerlSendHeader On
Bleicke Holm wrote: I am quite desperately trying to get mod_perl working. I continue to get returned the source-code. Searching the doc and faqs it looks as if I should turn on PerlSendHeader. But that's already done! Make sure the file is executable by the user that the server is running as. Also, make sure that mod_perl is actually running by checking the error_log as described in the docs. - Perrin
PerlSendHeader On
Hi, I am quite desperately trying to get mod_perl working. I continue to get returned the source-code. Searching the doc and faqs it looks as if I should turn on PerlSendHeader. But that's already done! Also ExecCGI should be activated for the location. In summary: http://foot/cgi-bin/test.pl works http://foot/cgi-perl/test.pl DOESN'T Here's my VirtualHost section: User holm Group users ServerName foot LogLevel debug DocumentRoot /var/www/foot/httpdocs ServerAdmin [EMAIL PROTECTED] ErrorLog /var/log/apache/foot-error.log TransferLog /var/log/apache/foot-access.log Alias /cgi-bin/ /var/www/foot/cgi-bin/ Alias /cgi-perl/ /var/www/foot/cgi-bin/ PerlModule Apache::PerlRun #deny from all SetHandler perl-script PerlHandler Apache::PerlRun Options ExecCGI PerlSendHeader On SetHandler cgi-script Options ExecCGI AddType application/x-httpd-php .php php_admin_value open_basedir /var/www/foot/httpdocs/ Anyone can help me out with this??? Cheers, Bleicke
Re: PerlSendHeader and $r->header_out
Rafiq Ismail (ADMIN) wrote: > Hi People With Functioning Brain Cells, > > I'm having a brief period of grief, which I'm sure I've been through > before. > > I have this situation where I set a cookie using: > $r->header_out('Set-Cookie'=>$cookie); > > Now this is all fine, however I'm having a major problem in getting my > header into the right place. Have you tried using Apache::Cookie or CGI::Cookie? If these work for you, either stick to them or look at how their work. __ 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
PerlSendHeader and $r->header_out
Hi People With Functioning Brain Cells, I'm having a brief period of grief, which I'm sure I've been through before. I have this situation where I set a cookie using: $r->header_out('Set-Cookie'=>$cookie); Now this is all fine, however I'm having a major problem in getting my header into the right place. If I call $r->send_http_header right after my $r->header_out(set_stuff) directive, and then call $r->print("page contents"), I get: page_contents HTTP_HEADERS DISPLAYED HERE (INCLUDING COOKIE HEADER) Now, I experimented with PerlSendHeader being set to On, whilst disabling the call to $r->send_http_header, yet it then appears to give me a header which doesn't include the cookie header: HTTP/1.1 200 OK Date: Thu, 25 Jul 2002 13:01:12 GMT Server: Apache/1.3.20 (Linux/SuSE) PHP/4.0.6 mod_perl/1.26 Transfer-Encoding: chunked Content-Type: text/html Any idea what is going on? I'd like to just send_http_header with the headers appearing on top of my page. It appears to do things in the wrong order. There is no duplication of headers either. If anyone can help and would fancy flying me out, I'll even buy you a beer. :) My content handler returns the result of another method called within the same module. This method is passed the request object, which in turn it uses to send the headers and print the page. This seems 'sensible' to me; so why is it not working?? Many Thanks, Fiq "We're so wonderfully wonderfully wonderfully Wonderfully pretty Oh you know that I'd do anything for you We should have each other to tea, huh? We should have each other with cream Then curl up by the fire And sleep for awhile It's the grooviest thing It's the perfect dream" - The Cure, "Love Cats."
Re: PerlSendHeader
Thanks, Tom. Yep, this does the job just fine and allows me to send the Content-type later: print "HTTP/1.1 OK\n"; Is ignoring PerlSendHeader considered a feature? ;) -gm On Tue, 20 Nov 2001, Tom Mornini wrote: > This took me a LONG time to deal with when I was new to mod_perl... > > Apache::Registry tries to be smart regardless of PerlSendHeader. > > If it doesn't see "HTTP/1.x OK" first, out come the headers. > > Two options: > $r->response(200); > $r->send_http_header('text/html') > > or print the HTTP line... > > On Tuesday, November 20, 2001, at 04:17 PM, Gregor Mosheh wrote: > > > > > I need mod_perl to not send the Content-type header when a program is > > run. Despite the "Off" value of the "PerlSendHeader" variable in > > httpd.conf, the header is still being sent. > > > > This test program still sends an extraneous Content-type header: > >print "Content-type: text/html\n\n"; > >print "Hello World\n"; > > > > Here's the relevant portion of the httpd.conf: > > # mod_perl initialization > > PerlRequire /usr/local/apache-dev/ultraform-lib/startup.pl > > PerlModule Apache::DBI DBD::mysql > > #PerlSetEnv key value > > PerlTaintCheck Off > > PerlWarn On > > PerlFreshRestart On > > PerlSetVar UndefOnReload On > > PerlSendHeader Off > > > > AllowOverride None > > Options ExecCGI > > Order allow,deny > > Allow from all > > SetHandler perl-script > > PerlHandler Apache::Registry > > PerlSendHeader Off > > > > > > > > > > -- > > Gregor Mosheh, B.S. http://www.blackangel.net/ > > > >As we enjoy great advantages from inventions of others, we > >should be glad of an opportunity to serve others by any > >invention of ours; and this we should do freely and generously. > > -- Benjamin Franklin > > > > > > > -- > -- Tom Mornini > -- InfoMania Printing & Prepress > -- Gregor Mosheh, B.S. http://www.blackangel.net/ As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. -- Benjamin Franklin
PerlSendHeader
I need mod_perl to not send the Content-type header when a program is run. Despite the "Off" value of the "PerlSendHeader" variable in httpd.conf, the header is still being sent. This test program still sends an extraneous Content-type header: print "Content-type: text/html\n\n"; print "Hello World\n"; Here's the relevant portion of the httpd.conf: # mod_perl initialization PerlRequire /usr/local/apache-dev/ultraform-lib/startup.pl PerlModule Apache::DBI DBD::mysql #PerlSetEnv key value PerlTaintCheck Off PerlWarn On PerlFreshRestart On PerlSetVar UndefOnReload On PerlSendHeader Off AllowOverride None Options ExecCGI Order allow,deny Allow from all SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader Off -- Gregor Mosheh, B.S. http://www.blackangel.net/ As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. -- Benjamin Franklin
please disregard this: [bug] PerlSendHeader On doesn't parse octal\r\n
shame on me, at some point I've commented out perlsendheader on :( everything is fine... sorry about that... must be a jetlag On Sat, 31 Mar 2001, Stas Bekman wrote: > While verifying the correctness of the example in the book: > > print "Content-type: text/plain\012\015\012\015"; > > (which is the only truly correct way to send headers without using Apache > Perl API according to HTTP RFC) > > with PerlSendHeader On (registry) I've learned that the parsing code fails > to recognize the end of headers, since it expects \n\n or \r\n\r\n... > > I thought those are equivalent and can be used interchangeably: > > % perl -le 'print "OK" if "\012" eq "\n"' > OK > % perl -le 'print "OK" if "\015" eq "\r"' > OK > > This is under perl-5.6.1-PATCH2 > > May be it has something to do with underlying XS layer? > > _ > Stas Bekman JAm_pH -- Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide http://perl.apache.org/guide > mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ > http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ > > _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
[bug] PerlSendHeader On doesn't parse octal \r\n
While verifying the correctness of the example in the book: print "Content-type: text/plain\012\015\012\015"; (which is the only truly correct way to send headers without using Apache Perl API according to HTTP RFC) with PerlSendHeader On (registry) I've learned that the parsing code fails to recognize the end of headers, since it expects \n\n or \r\n\r\n... I thought those are equivalent and can be used interchangeably: % perl -le 'print "OK" if "\012" eq "\n"' OK % perl -le 'print "OK" if "\015" eq "\r"' OK This is under perl-5.6.1-PATCH2 May be it has something to do with underlying XS layer? _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Update: Re: PerlSendHeader Off & socket persistence (was Re:question: usingApache for non-HTML messages)
On Mon, 2 Oct 2000, B. Burke wrote: > Why would the lack of a $r->send_http_header call cause socket persistence > to go away? I was under the impression that $r->send_http_header only affected > what was sent to the client, but appearantly it affects Apache's socket handling > as well. because send_http_header calls set_keepalive underneath, set_keepalive sets the flags so apache will keep the connection open. try the patch below and add $r->set_keepalive to your code. > 2) how can I make apache stop printing the outbound message size on each response what headers exactly is your client sending? you must be somehow triggering chunked encoding. Index: src/modules/perl/Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.114 diff -u -r1.114 Apache.xs --- src/modules/perl/Apache.xs 2000/09/28 19:28:33 1.114 +++ src/modules/perl/Apache.xs 2000/10/02 21:23:28 @@ -937,6 +937,10 @@ send_http_header(r); mod_perl_sent_header(r, 1); +void +set_keepalive(r) +Apache r + #ifndef PERL_OBJECT int
Re: Update: Re: PerlSendHeader Off & socket persistence (was Re:question: usingApache for non-HTML messages)
Why would the lack of a $r->send_http_header call cause socket persistence to go away? I was under the impression that $r->send_http_header only affected what was sent to the client, but appearantly it affects Apache's socket handling as well. When I don't use $r->send_http_header, my sockets are dying after Apache's response to the 1st query...dying from the apache side, not the client side. I have my test client hard-coded to keep the socket open and send keepalives on every request. Since I don't want the server to send headers, but I want socket persistence, I'm in a bind. I've tried tracing through the apache source and commenting out stuff I don't need (manually removing headers, the ugly way). However I cannot find the code segiment that prints the outbound hexidecimal message size (which I also want to remove), so I'm stuck for the moment. It seems I need to know 1 of 2 things: 1) How do you keep sockets open when $r->send_http_header isn't used 2) how can I make apache stop printing the outbound message size on each response Any help will be appreciated! Brian Doug MacEachern wrote: > On Thu, 28 Sep 2000, B. Burke wrote: > > > Once I changed how I was printing the header from the script, the socket > > persistence > > worked with PerlSendHeader Off. So I guess I solved my problem although I don't > > really > > know why. > > because CGI.pm will trigger a call to $r->send_http_header, regardless of > PerlSendHeader settings. whereas: "print Content-type: text/html\n\n"; > will not, unless PerlSendHeader is On.
Re: Update: Re: PerlSendHeader Off & socket persistence (was Re:question: usingApache for non-HTML messages)
On Thu, 28 Sep 2000, B. Burke wrote: > Once I changed how I was printing the header from the script, the socket > persistence > worked with PerlSendHeader Off. So I guess I solved my problem although I don't > really > know why. because CGI.pm will trigger a call to $r->send_http_header, regardless of PerlSendHeader settings. whereas: "print Content-type: text/html\n\n"; will not, unless PerlSendHeader is On.
Update: Re: PerlSendHeader Off & socket persistence (was Re: question: usingApache for non-HTML messages)
> what is your test client? I wrote a command line client that just sends/receives basic messages for testing. I have been opening a socket and sending this: GET /perl/myscript HTTP/1.1 Connection: Keep-Alive Host: myhost.mydomain.com\n\n It worked as expected - I was able to keep the socket open and send & receive multiple messages. When I set PerlSendHeader to Off, the socket closed after the 1st query. I finally had success with socket persistence when I tried using CGI to print the header by replacing this: print "Content-type: text/html\n\n"; with this: print header(); Once I changed how I was printing the header from the script, the socket persistence worked with PerlSendHeader Off. So I guess I solved my problem although I don't really know why. Brian Doug MacEachern wrote: > On Wed, 27 Sep 2000, B. Burke wrote: > > > When I set PerlSendHeader to Off in my perl.conf it doesn't send headers, > > which > > is good. The bad part is that it seems to break socket persistence for some > > reason. > > When I have PerlSendHeader set to On, I can open a socket with my test client, > > > > and make multiple queries on the same socket. > > what is your test client? apache will close the connection after the > first request, unless keep-alive is maintained between client/server.
Re: PerlSendHeader Off & socket persistence (was Re: question: usingApache for non-HTML messages)
On Wed, 27 Sep 2000, B. Burke wrote: > When I set PerlSendHeader to Off in my perl.conf it doesn't send headers, > which > is good. The bad part is that it seems to break socket persistence for some > reason. > When I have PerlSendHeader set to On, I can open a socket with my test client, > > and make multiple queries on the same socket. what is your test client? apache will close the connection after the first request, unless keep-alive is maintained between client/server.
PerlSendHeader Off & socket persistence (was Re: question: using Apache for non-HTML messages)
When I set PerlSendHeader to Off in my perl.conf it doesn't send headers, which is good. The bad part is that it seems to break socket persistence for some reason. When I have PerlSendHeader set to On, I can open a socket with my test client, and make multiple queries on the same socket. Any ideas to help me keep the socket open? Thanks, Brian Doug MacEachern wrote: > On Mon, 25 Sep 2000, B. Burke wrote: > > > I've been able to basically remove the response headers by removing the > > functionality > > of ap_sen_header_field() before compiling Apache, but it would be nice to > > you don't have to remove anything, just don't call $r->send_http_header > and make sure PerlSendHeader is configured to Off, then Apache will not > send any headers.
perlSendHeader On/Off: the difference!
perlSendHeader On / Off -- what's the real difference? i finally figured it out, after seeing many 'server errors' on one hand, and http headers cluttering up the html output to the browser on the other... i have a perl script test.npl and a symbolic link to it `ln -s test.npl test.pl` so that the same code will be called whether it's *.pl or *.npl... and in httpd.conf, Options +ExecCGI SetHandler perl-script PerlSendHeader On PerlHandler Apache::PerlRun Options +ExecCGI SetHandler perl-script PerlSendHeader Off PerlHandler Apache::PerlRun so any script named *.pl runs with perlSendHeader ON; any script named *.npl runs with perlSendHeader OFF. here's the relevant code from the top of the script: my $eol = "\015\012"; my $mod = scalar localtime( $seen{$path} ||= (stat $path)[9] ); my $span = 60*60*24; print "HTTP/1.1 200 OK",$eol if $0 =~ /\.npl$/ # if PERLSENDHEADER == OFF, say 'HTTP/...' ; print "Content-Type: text/html",$eol, "Last-Modified: ",$mod,$eol, "Date: ",scalar(localtime),$eol, "Expires: ",scalar(localtime(time+$span)),$eol, $eol ; print "" and the script behaves identically, whether called as *.npl or *.pl, with no server error (missing headers) and no http clutter at the top of html output (extra headers). thus i conclude that (aside from the internals revealed at http://perl.apache.org/faq/mod_perl_cgi.html#The_script_runs_but_the_headers_ ) PERLSENDHEADER ON makes mod_perl generate the initial 'HTTP' intro, and that's that. yes? no? do i win a prize? -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Their is five errers in this sentance.
Re: PerlSendHeader
"Benjamin Reed" <[EMAIL PROTECTED]> writes: > I've turned off PerlSendHeader, but no matter what I do, it seems that I'm > already getting headers before I ever print anything. If you turn PerlSendHeader off, you are responsible for sending the headers yourself. In the Apache API, and mod_perl's incarnation of it, sending the headers is achieved by calling $r->send_http_header, after having set the header values using calls such as $r->content_type("text/html"). Read 'perldoc Apache' to see all the stuff that you can put into the headers in this way. With PerlSendHeader on, mod_perl emulates mod_cgi by slurping up the initial non-blank lines from your output and doing the above for you, behind the scenes. > I have the following in my httpd.conf: > > ---(snip!)--- > Alias /perl/ /home/httpd/perl/ > > SetHandler perl-script > PerlHandler Apache::Registry > PerlSendHeader Off > Options Indexes ExecCGI > > ---(snip!)--- > > If I have a script called /home/httpd/perl/index.pl with only the following: > > ---(snip!)--- > $|++; > print < Content-type: text/html > > Hi. > END > ---(snip!)--- That should be use Apache; my $r = Apache::Request; $r->content_type('text/html'); $r->send_http_header; $r->print('Hi.'); -- Frank Cringle, [EMAIL PROTECTED] voice: (+49 2304) 467101; fax: 943357
PerlSendHeader
I've turned off PerlSendHeader, but no matter what I do, it seems that I'm already getting headers before I ever print anything. I have the following in my httpd.conf: ---(snip!)--- Alias /perl/ /home/httpd/perl/ SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader Off Options Indexes ExecCGI ---(snip!)--- If I have a script called /home/httpd/perl/index.pl with only the following: ---(snip!)--- $|++; print <http://defiance.dyndns.org/
Re: Q: PerlSendHeader
On Thu, 23 Mar 2000, Jaime Teng wrote: > Hi, > > Is there a setting that changes what mod_perl prints when > the "PerlSendHeader On" is used? no, with 'PerlSendHeader On', mod_perl feeds headers into $r->headers_out, then calls ap_send_http_header(), much like mod_cgi does. ap_send_http_headers() is hardwired to send certain headers, such as Server:, Connection:, etc., see http_protocol.c > for whatever reasons, my scripts are not being accepted by > some browsers simply because mod_perl is sending some > unknown/unsupported headers. > > One of these header is the "Connection: close". eh? this is standard http/1.1, even if the browser doesn't understand it, it should just ignore it. please describe what you mean by 'not being accepted'?