You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ten-Hung Chu <tc...@chicagosystemsgroup.com> on 2002/07/04 21:18:07 UTC

mod_webapp returns improper HTTP header (Apache 2 + Tomcat 4)

I am using Apache 2.0.39 with Tomcat 4.0.4 through mod_webapp (1.2.0-dev).
The connection works fine except getting to the welcome-file on tomcat. I
can request the file directly like /examples/jsp/index.html but requesting
/examples/jsp/ results in a 302 temporary moved page. Looking at the
response headers I found that mod_webapp returns an incorrect header

----- correct HTTP header while accessing tomcat directly through port 8080
# lynx -head -dump http://my.host.nowhere:8080/examples/jsp/
HTTP/1.1 302 Moved Temporarily
Content-Type: text/html
Date: Thu, 04 Jul 2002 18:46:07 GMT
Location: http://my.host.nowhere:8080/examples/jsp/index.html
Server: Apache Tomcat/4.0.4 (HTTP/1.1 Connector)
Connection: close

----- correct HTTP header while accessing tomcat through mod_webapp
# lynx -head -dump http://my.host.nowhere/examples/jsp/
HTTP/1.1 Moved Temporarily
Date: Thu, 04 Jul 2002 18:45:59 GMT
Server: Apache/2.0.39 (Unix) mod_ssl/2.0.39 OpenSSL/0.9.6b
mod_webapp/1.2.0-dev
Content-Type: text/html; charset=ISO-8859-1
Location: http://my.host.nowhere/examples/jsp/index.html
Connection: close

----- correct HTTP header while accessing tomcat through mod_webapp
# lynx -head -dump http://my.host.nowhere/examples/jsp/index.html
HTTP/1.1 OK
Date: Thu, 04 Jul 2002 18:45:48 GMT
Server: Apache/2.0.39 (Unix) mod_ssl/2.0.39 OpenSSL/0.9.6b
mod_webapp/1.2.0-dev
Content-Type: text/html;charset=UTF-8
Connection: close


As shown above, accessing through mod_webapp result in a HTTP header without
status code (first line of the header). Therefore web browser does not know
to redirect to the welcome-file page. If accessing directly through port
8080 the header does contain the status code.

Did I do something wrong? How can I fix this?

Following is my configuration,

# Solaris 2.8

# ./httpd -l
Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_include.c
  mod_log_config.c
  mod_env.c
  mod_setenvif.c
  mod_ssl.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_cgi.c
  mod_negotiation.c
  mod_dir.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_so.c
# ./httpd -v
Server version: Apache/2.0.39
Server built:   Jun 28 2002 15:15:31

# java -version
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)

Here is how I build mod_webapp
Using jakarta-tomcat-connectors-4.0.4-src
cd in webapp source directory
./support/buildconf.sh CC=/usr/local/bin/gcc
./configure --with-apxs=/usr/local/apache2/bin/apxs
/usr/local/bin/make

Additional packages used for building mod_webapp
gnu make-3.79.1 , m4-1.4, autoconf-2.53


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[PATCH] Re: mod_webapp returns improper HTTP header (Apache 2 + Tomcat 4)

Posted by "Andrew T. Veliath" <an...@usa.net>.
 .........----------------==================----
..--==-  Thu, 4 Jul 2002 14:18:07 -0500,
..--==-  Ten-Hung Chu (TC) discussed:

 TC)  I am using Apache 2.0.39 with Tomcat 4.0.4 through mod_webapp (1.2.0-dev).
 TC)  The connection works fine except getting to the welcome-file on tomcat. I
 TC)  can request the file directly like /examples/jsp/index.html but requesting
 TC)  /examples/jsp/ results in a 302 temporary moved page. Looking at the
 TC)  response headers I found that mod_webapp returns an incorrect header

Hi,

I had made the following change to get the webapp connector in 4.0.4
release working properly with Apache 2.0.39.

--- orig/jakarta-tomcat-connectors-4.0.4-src/webapp/apache-2.0/mod_webapp.c	Mon Jun 10 23:48:08 2002
+++ jakarta-tomcat-connectors-4.0.4-src/webapp/apache-2.0/mod_webapp.c	Sat Jun 22 12:25:05 2002
@@ -305,7 +305,7 @@
     request_rec *req=(request_rec *)r->data;
 
     if (status !=NULL && status[0]!='\0')
-        req->status_line=apr_pstrdup(req->pool,status);
+	req->status_line=apr_psprintf(req->pool,"%d %s",req->status,status);
 }

Regards, 
Andrew

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[PATCH] Re: mod_webapp returns improper HTTP header (Apache 2 + Tomcat 4)

Posted by "Andrew T. Veliath" <an...@usa.net>.
 .........----------------==================----
..--==-  Thu, 4 Jul 2002 14:18:07 -0500,
..--==-  Ten-Hung Chu (TC) discussed:

 TC)  I am using Apache 2.0.39 with Tomcat 4.0.4 through mod_webapp (1.2.0-dev).
 TC)  The connection works fine except getting to the welcome-file on tomcat. I
 TC)  can request the file directly like /examples/jsp/index.html but requesting
 TC)  /examples/jsp/ results in a 302 temporary moved page. Looking at the
 TC)  response headers I found that mod_webapp returns an incorrect header

Hi,

I had made the following change to get the webapp connector in 4.0.4
release working properly with Apache 2.0.39.

--- orig/jakarta-tomcat-connectors-4.0.4-src/webapp/apache-2.0/mod_webapp.c	Mon Jun 10 23:48:08 2002
+++ jakarta-tomcat-connectors-4.0.4-src/webapp/apache-2.0/mod_webapp.c	Sat Jun 22 12:25:05 2002
@@ -305,7 +305,7 @@
     request_rec *req=(request_rec *)r->data;
 
     if (status !=NULL && status[0]!='\0')
-        req->status_line=apr_pstrdup(req->pool,status);
+	req->status_line=apr_psprintf(req->pool,"%d %s",req->status,status);
 }

Regards, 
Andrew

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>