Regards,
Adrian Sutton.
Index: HttpMethodBase.java
===================================================================
RCS file: D:/cvs/EphoxEditLiveJava/source/applet/src/org/apache/commons/ httpclient/HttpMethodBase.java,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 HttpMethodBase.java
--- HttpMethodBase.java 22 Jun 2003 23:51:42 -0000 1.1.2.4
+++ HttpMethodBase.java 22 Jul 2003 06:11:32 -0000
@@ -2270,14 +2270,26 @@
+ "HttpConnection)");
addRequestHeaders(state, conn);
+ // Work around for an unusual bug in some IIS configurations which require
+ // the Host header to be provided before any other header.
+ if (getRequestHeader("Host") != null) {
+ writeRequestHeader(conn, getRequestHeader("Host"));
+ }
Header[] headers = getRequestHeaders();
for (int i = 0; i < headers.length; i++) {
- String s = headers[i].toExternalForm();
- if (Wire.enabled()) {
- Wire.output(s);
+ if (!headers[i].getName().equals("Host")) {
+ writeRequestHeader(conn, headers[i]);
}
- conn.print(s);
}
+ }
+
+ private void writeRequestHeader(HttpConnection conn, Header header)
+ throws IOException, HttpException {
+ String s = header.toExternalForm();
+ if (Wire.enabled()) {
+ Wire.output(s);
+ }
+ conn.print(s);
}
/**
On Tuesday, July 22, 2003, at 04:02 PM, Adrian Sutton wrote:
Here's an odd heads up for you. I've come across an IIS server which doesn't like:
>GET /eljconfig.xml HTTP/1.1
>User-Agent: test
// Note the server interrupts at this point without waiting for the rest of the request
<Content-HTTP/1.1 500 Server Error
<Server: Microsoft-IIS/5.0
<Date: Tue, 22 Jul 2003 05:50:21 GMT
<Content-Type: text/html
<Content-Length: 102
But likes:
>GET /eljconfig.xml HTTP/1.1 >Host: 216.144.36.166 >User-Agent: test
<200 OK ...
It appears that unless the Host header is the first header provided, the server returns a 500 response. No idea why or how they get IIS to do that, but I'll be creating a patch to add the Host header first for our use so if people would like it for HttpClient I can send it through.
And in case I haven't mentioned it before - I hate non-compliant servers....
Regards,
Adrian Sutton.
---------------------------------------------- Intencha "tomorrow's technology today" Ph: 38478913 0422236329 Suite 8/29 Oatland Crescent Holland Park West 4121 Australia QLD www.intencha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------- Intencha "tomorrow's technology today" Ph: 38478913 0422236329 Suite 8/29 Oatland Crescent Holland Park West 4121 Australia QLD www.intencha.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]