RE: Bogous HTTP headers from adaptor
RE: Bogous HTTP headers from adaptor
- Subject: RE: Bogous HTTP headers from adaptor
- From: <email@hidden>
- Date: Wed, 25 Feb 2004 13:40:42 +0100
- Thread-topic: Bogous HTTP headers from adaptor
Hi!
With a 2 digit port number I observe the following headers for the first 2 request:
awake - headers: {remote_host = ("10.1.4.63"); user-agent = ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); x
-webobjects-adaptor-version = ("Apache"); document_root = ("/usr/local/apache/htdocsTest"); server_name = ("uhura.bcl
.lu"); accept = ("image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd
.ms-excel, application/msword, */*"); unique_id = ("QDxuPAoBAVYAAG1xYRI"); remote_addr = ("10.1.4.63"); referer = ("h
ttp://uhura.bcl.lu:1076/cgi-bin/WebObjects/JavaMonitor.woa/wo/wCJAZ1q7nDgvEzGjbRMiUw/4.0.1.0"); remote_port = ("4638"
); x-webobjects-request-id = ("403c6ca500006d4000000000"); server_admin = ("[no address given]"); server_software = (
"Apache/1.3.9"); script_filename = ("/mbstest/WebObjects/MBSTableBuilder"); x-webobjects-request-method = ("GET"); ac
cept-encoding = ("gzip, deflate"); server_port = ("81"); host = ("uhura:81"); accept-language = ("en-us"); connection
= ("keep-alive"); }
awake - headers: {remote_host = ("10.1.4.63"); server_software = ("Apache/1.3.9"); cookie = ("wosid=null;"); document
_root = ("/usr/local/apache/htdocsTest"); server_name = ("uhura.bcl.lu", "uhura.bcl.lu"); unique_id = ("QDxuRAoBAVYAA
G3A5zk"); remote_addr = ("10.1.4.63"); x-webobjects-request-id = ("403c6ca500006d4000000000"); server_admin = ("[no a
ddress given]"); x-webobjects-request-method = ("GET"); x-webobjects-adaptor-version = ("Apache"); remote_port = ("46
46"); script_filename = ("/mbstest/WebObjects/MBSTableBuilder.woa/wa/com.webobjects.eodistribution._EOHTTPInitialActi
on/componentURL"); server_port = ("81", "81"); connection = ("keep-alive"); }
Things ARE looking better: the port number no longer gets clipped. Obviously it has only 2 digits to start with. WOAdaptorInfo also sees the port number as it is supposed to be.
Yet the "x-webobjects-server-port" key missing still from the header passed onto the application by the adaptor. This makes some of the WORequest methods return wrong results.
The workaround I resorted to is to use a crudely patched subclass of WORequest which I substitute for the actual request within the application class:
public WOResponse dispatchRequest(WORequest request)
{
return super.dispatchRequest(new Request(request));
}
The subclass overrides a 'hidden' method which obviously relies on the "x-webobjects-server-port" header:
public Request(WORequest request)
{
super(
request.method(),
request.uri(),
request.httpVersion(),
request.headers(),
request.content(),
request.userInfo());
}
public String _serverPort()
{
String serverPort = headerForKey("x-webobjects-server-port");
if (serverPort == null)
{
String string = headerForKey("server_port");
if (string != null)
{
StringTokenizer tokenizer = new StringTokenizer(string, "() ,\"");
if (tokenizer.hasMoreElements())
{
setHeader(tokenizer.nextToken(), "x-webobjects-server-port");
}
}
}
return super._serverPort();
}
Smells like multiple bugs to me.
Pierre.
-----Original Message-----
From: Pierre Bernard
Sent: Tuesday, February 24, 2004 6:02 PM
To: email@hidden; email@hidden
Subject: Bogous HTTP headers from adaptor
Hi!
I am seeing a problem on a deployed application. Methods generating complete URLs fail to properly do so: the generated URL omits the non standard port number. My belief is that this stems from the "x-webobjects-server-port" key missing from the header passed onto the application by the adaptor.
In an attempt to fix the promblem I wrote code to infers this header key should it be missing. Now I have two header keys to start from "server_port" and "host". Trouble is that "server_port" is just plain wrong. The port the Apache server is running on is 7070. Yet "server_port" a truncated value of 707. The "host" key comes in as savior. It includes both server name and port number.
Unfortunately the above is only true for the first request to my application. Subsequent requests (triggered from a JavaClient Webstart launch) do not include the "host" key. The value for "server_port" gets funnier too. It now is an array made of both the correct and the truncated value.
I see the same truncated port number on the WOAdaptorInfoPage. Yet the test-cgi script included with Apache has the correct value. This leads me to believe that the WebObjects adaptor - besides skipping "x-webobjects-server-port" - does something bad that truncates the value of the Apache generated "server_port" header value.
Yet I find it hard to believe that no one has had trouble running WebObjects application with a web server having a port number greater than 999. Well, the problem shows up only when generating comptlete URLs. Most dynamic elements rely on relative URLs only.
Sample header dictionaries as in Session.awake():
awake - headers: {remote_host = ("10.1.4.120"); user-agent = ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5
.0)"); x-webobjects-adaptor-version = ("Apache"); document_root = ("/usr/local/apache/htdocsTest"); server_nam
e = ("uhura.bcl.lu"); accept = ("*/*"); unique_id = ("QDtnOwoBAVYAABrmI4k"); remote_addr = ("10.1.4.120"); ref
erer = ("http://uhura.bcl.lu:1076/cgi-bin/WebObjects/JavaMonitor.woa/wo/LbBGRubNrGMFqR97dB4mKg/122.0.1.0"); re
mote_port = ("4020"); x-webobjects-request-id = ("4038172e0000056c000000d1"); server_admin = ("[no address giv
en]"); server_software = ("Apache/1.3.9"); script_filename = ("/mbstest/WebObjects/MBSTableBuilder.woa/1"); x-
webobjects-request-method = ("GET"); accept-encoding = ("gzip, deflate"); server_port = ("707"); host = ("uhur
a:7070"); accept-language = ("fr-lu,fr;q=0.5"); connection = ("keep-alive"); }
awake - headers: {remote_host = ("10.1.4.120"); server_software = ("Apache/1.3.9"); cookie = ("wosid=null;");
document_root = ("/usr/local/apache/htdocsTest"); server_name = ("uhura.bcl.lu", "uhura.bcl.lu"); unique_id =
("QDtnPwoBAVYAAGWJEtc"); remote_addr = ("10.1.4.120"); x-webobjects-request-id = ("4038172e0000056c0000011b");
server_admin = ("[no address given]"); x-webobjects-request-method = ("GET"); x-webobjects-adaptor-version =
("Apache"); remote_port = ("4028"); script_filename = ("/mbstest/WebObjects/MBSTableBuilder.woa/wa/com.webobje
cts.eodistribution._EOHTTPInitialAction/componentURL"); server_port = ("7070", "707"); connection = ("keep-ali
ve"); }
Pierre
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-deploy mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-deploy
Do not post admin requests to the list. They will be ignored.
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.