Thanks Perrin. Our production environment is running mod_perl 1 and apache 1.3 that comes with Oracle 9iAS. Based on the deadlines, the plans to upgrade have been moved to a future date.
I have narrowed down the problem. Below is the Perl script/module that should invoke a servlet for every request it recieves using Perl Sockets. What I am seeing is that the perl module is invoking the servlet for some requests and for some it does not (i.e. does NOT write GET / HTTP 1.0 on the socket stream). This is very random. It does invoke it for 4-5 times and then stops and invokes again. Sometimes the first request itself fails. I am not really sure what I can do to debug it further. I would appreciate any pointers. The data from the Apache log is also present at the bottom. package Apache::Proxy; use strict; use Apache::Constants qw(OK DONE REDIRECT DECLINED); use Apache::Log(); use Socket; use CGI; use CGI::Cookie; $Apache::Proxy::VERSION = "1.00"; sub handler { my $r = shift; my ( $log ) = $r->log; $log->error("1. Inside Handler."); my $uri = $r->uri; $log->error("2. Requested URI ==> $uri"); my %cookies = CGI::Cookie->fetch($r); my $token = $cookies{'ums_token'}->value; chomp($token); $log->error("3. SSO TOKEN ==> $token"); my $redirectHost = $r->dir_config('redirectHost'); my $redirectPort = $r->dir_config('redirectPort'); #Invoke the servlet URL my $url='http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken =3243-sfsdf-88dsff-fds324-sfsdf2'; $url=~m/http\:\/\/([^\:^\/]*)(?:\:(\d+))?\/(.*)/; my $host = $1; my $port = $2; #$port = 80 unless($port); my $file = '/'.$3; my $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto); my $sin = sockaddr_in($port, inet_aton($host)); connect(SOCK, $sin) || die "Connect failed: $!\n"; my $old_fh = select(SOCK); $|=1; select($old_fh); #print SOCK "GET $file HTTP/1.0\n"; print SOCK "GET /SecurityServices/SSOProxyServlet?ssotoken=3243-sfsdf-88dsff-fds324-sfsd f2 HTTP/1.0\n"; print SOCK "Accept: */*\n"; print SOCK "User-Agent: hcat/1.0\n\n"; my $header = <SOCK>; $log->error("3. Proxy URL ==> $url"); my $content; my $out; while($content = <SOCK>) { $out .= $content; last if ($content =~ /^\015?\012?$/); } $log->error("3aa. The response header line ==>$out"); my $nosignal = 1; my $result=''; my $out1; # Back to line by line mode. while (defined($out1 = <SOCK>) and $nosignal) { $result = $result . $out1; } chomp($result); close(SOCK); $log->error("3cc. The response body ==>$result"); #my $result = $body; $log->error("3. SSO RESULT ==> $username"); my $redirectSignal = 0; if($result =~ /INVALID/i){ $redirectSignal = 1; }if($username eq ''){ $redirectSignal=1; } else { $redirectSignal = 0; } #Check the status if ($redirectSignal > 0){ my $url1 = 'http://'.$redirectHost.':'.$redirectPort.'/JSP/reLogin.jsp?USERNAME=TMI LLS&SSOTokenID='.$token; $r->content_type('text/html'); $r->headers_out->set('Location' => $url1); $r->status(Apache::Constants::REDIRECT); return Apache::Constants::REDIRECT; } return DECLINED; } 1; # modules must return true LOG Data... My comments are enclosed in <<>>. [Wed Nov 15 16:03:43 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:03:43 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/asut0002.htm [Wed Nov 15 16:03:43 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:44 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:44 2006] [error] [client 38.118.10.237] 3a. out1 ==> TMILLS [Wed Nov 15 16:03:44 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:03:44 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:03:44 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> TMILLS [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/excess.htm [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 3a. out1 ==> TMILLS [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:03:47 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> TMILLS [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/asex2010.htm [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 3a. out1 ==> [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:03:49 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> <<Did not invoke here>> [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/asut0002.htm [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 3a. out1 ==> TMILLS [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:03:55 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> TMILLS [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/agree.htm [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 3a. out1 ==> [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:03:58 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> <<Did not invoke here>> [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/asut0002.htm [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 3a. out1 ==> TMILLS [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:04:02 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> TMILLS [Wed Nov 15 16:04:04 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:04:04 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/toolbar.htm [Wed Nov 15 16:04:04 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:04:05 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:04:05 2006] [error] [client 38.118.10.237] 3a. out1 ==> [Wed Nov 15 16:04:05 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:04:05 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:04:05 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> <<Did not invoke here>> [Wed Nov 15 16:04:08 2006] [error] [client 38.118.10.237] 1. Inside Handler. [Wed Nov 15 16:04:08 2006] [error] [client 38.118.10.237] 2. Requested URI ==> /snflwr_doc_html/asut0002.htm [Wed Nov 15 16:04:08 2006] [error] [client 38.118.10.237] 3. SSO TOKEN ==> 3243-sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:04:09 2006] [error] [client 38.118.10.237] 3. Proxy URL ==> http://38.118.10.23:8247/SecurityServices/SSOProxyServlet?ssotoken=3243- sfsdf-88dsff-fds324-sfsdf2 [Wed Nov 15 16:04:09 2006] [error] [client 38.118.10.237] 3a. out1 ==> TMILLS [Wed Nov 15 16:04:09 2006] [error] [client 38.118.10.237] 3b. out2 ==> [Wed Nov 15 16:04:09 2006] [error] [client 38.118.10.237] 3c. out3 ==> [Wed Nov 15 16:04:09 2006] [error] [client 38.118.10.237] 3. SSO RESULT ==> TMILLS Thanks Sumit > -----Original Message----- > From: Perrin Harkins [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 15, 2006 10:57 AM > To: Sumit Shah > Cc: modperl@perl.apache.org > Subject: Re: Basic Mod_Perl 1 and Apache 1.3 Issue: Unable to > get the requested page. > > Sumit Shah wrote: > > Thanks Perrin. I was able to figure out the problem. It had > to do with > > running Apache as a service versus standalone. If I run it as a > > service the code works as is and returns the requested > page. But if I > > run it as a service on Win2K it does not return the page. > > Well, I'm confused, because the code you showed us will never > return a page of any kind. If you got a page from that code, > something is wrong. > That probably would mean it's not running your code at all. > > And I have to repeat that you should not try to build > anything important on Windows with mod_perl 1. Use mod_perl > 2 and apache 2. They have good support for Windows. > > - Perrin >