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
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: 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
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
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 h1Hello World/h1\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 Directory /usr/local/apache-dev/cgi-bin AllowOverride None Options ExecCGI Order allow,deny Allow from all SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader Off /Directory -- 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
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 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)
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: 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.
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
"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/ Location /perl SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader Off Options Indexes ExecCGI /Location ---(snip!)--- If I have a script called /home/httpd/perl/index.pl with only the following: ---(snip!)--- $|++; print END; 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