Location: redirection

2004-11-15 Thread Lisa Soto
Hi, 

We're using perl within tomcat 4.1.27. The perl scripts run all right,
but the redirections don't work at all. 

If I run the script on the command line, it returns a proper Location:
directive, but it doesn't seem to show up in the web browser and/or
affect its reaction. 

Any ideas? 

Thanks,
Lisa 
-- 
Lisa Soto
[EMAIL PROTECTED]
(631) 344-2009
Systems Administrator
ITD Unix Services


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Location: redirection

2004-11-15 Thread Phillip Qin
Please refer to my previous post regarding hack into the CGIServlet.

-Original Message-
From: Lisa Soto [mailto:[EMAIL PROTECTED] 
Sent: November 15, 2004 3:24 PM
To: [EMAIL PROTECTED]
Subject: Location: redirection


Hi, 

We're using perl within tomcat 4.1.27. The perl scripts run all right, but
the redirections don't work at all. 

If I run the script on the command line, it returns a proper Location:
directive, but it doesn't seem to show up in the web browser and/or affect
its reaction. 

Any ideas? 

Thanks,
Lisa 
-- 
Lisa Soto
[EMAIL PROTECTED]
(631) 344-2009
Systems Administrator
ITD Unix Services


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4199105e51622011559358!


RE: Location: redirection

2004-11-15 Thread Shapira, Yoav

Hi,

We're using perl within tomcat 4.1.27. The perl scripts run all right,
but the redirections don't work at all.

Using an external mechanism (such as a CGI perl scripts in your case)
for redirection in Tomcat is tricky at best, and doomed to failure at
worst.  The reason is that the script is not really part of the servlet
request/response pipeline.  Rather, it is invoked as an exec by a Tomcat
servlet (in your case, the CGI servlet that ships with Tomcat, I
assume).

That servlet can easily do a response redirect or request forward, but
the script cannot.

Accordingly, if you stick with the script at all, modify it to return
the redirection URL, and have the servlet (a custom extension to the CGI
Servlet that ships with Tomcat probably) read and act upon this URL by
doing the redirection.

Yoav



This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged.  This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else.  If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Location: redirection

2004-11-15 Thread Phillip Qin
The redirect has to be done in inner class CGIRunner of servlet CGIServlet.
Tomcat 4.1.30/5.0.28 do not handle redirect. You have to modify method run,
in while (isRunning) add your own handling. Our cgi scripts have Status
302 for redirection, so I added header check below

if (line.startsWith(HTTP)) {
//TODO: should set status codes (NPH support)
/*
 * response.setStatus(getStatusCode(line));
 */
} else if (line.indexOf(:) = 0) {
String header =
line.substring(0, line.indexOf(:)).trim();
String value =
line.substring(line.indexOf(:) +
1).trim(); 
// PQ: quick fix for 302 redirect
if
(header.trim().compareToIgnoreCase(STATUS)==0  line.indexOf(302)-1) {
log(runCGI(my): status code=302);
response.setStatus(302);
} else {
response.addHeader(header , value);
if
((header.toLowerCase().equals(content-type))

(!value.toLowerCase().startsWith(text))) {
isBinaryContent = true;
}
}
} else {
log(runCGI: bad header line \ + line + \);
}

I know it's ugly.


-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: November 15, 2004 3:31 PM
To: Tomcat Users List
Subject: RE: Location: redirection



Hi,

We're using perl within tomcat 4.1.27. The perl scripts run all right, 
but the redirections don't work at all.

Using an external mechanism (such as a CGI perl scripts in your case) for
redirection in Tomcat is tricky at best, and doomed to failure at worst.
The reason is that the script is not really part of the servlet
request/response pipeline.  Rather, it is invoked as an exec by a Tomcat
servlet (in your case, the CGI servlet that ships with Tomcat, I assume).  

That servlet can easily do a response redirect or request forward, but the
script cannot.

Accordingly, if you stick with the script at all, modify it to return the
redirection URL, and have the servlet (a custom extension to the CGI Servlet
that ships with Tomcat probably) read and act upon this URL by doing the
redirection.

Yoav



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4199125452166270918065!