The legacy that I inherited from the "crazy" perl guy always has these lines
of codes

      print "Status: 302 Moved Temporarily\n";
      print "Location: http://www.whatever.com\n\n";;

I made a quick fix to my CGIServlet

                                ...
                        } else if (line.indexOf(":") >= 0) {
                                // PQ: quick fix for 302 redirect
                                if (line.substring(0,
line.indexOf(":")).trim().compareToIgnoreCase("STATUS")==0 &&
line.indexOf("302")>0) {
                                        response.setStatus(302);
                            } else {
                            response.addHeader
                                (line.substring(0,
line.indexOf(":")).trim(),
                                line.substring(line.indexOf(":") +
1).trim());
                            }
                        } else {
                                ...

I am not sure if the above code applies to any one else so I am reluctant to
patch Tomcat.
 

-----Original Message-----
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: September 28, 2004 2:37 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat cgi NPH support


From: Phillip Qin [mailto:[EMAIL PROTECTED] 
> I am curious why NPH support is so difficult to implement in
> CgiServlet?

Just because something isn't done, it doesn't necessarily mean it is
difficult. A number of 'extra' servlets provided with Tomcat (CGI, webDAV,
etc) are not 100% complete. It all comes down to who wants/needs to do the
development for the bits that are missing.

> Is is OK that I simply add a conditional check, i.e. if line contains 
> HTTP/1.1 302 then setStatus(302)?

That sounds like parsing the header to me. Given "NPN"="Non-parsed headers"
that doesn't feel right. I had always assumed that NPN support would involve
passing the output from the script directly to the client but haven't really
given it any great amount of thought.

As ever, patches are always welome ;)

Mark



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


!DSPAM:4159af8d171121566911362!

Reply via email to