Re: [BUG] invalid HTTP headers and HttpURLConnection.getContentType

* Philippe Le Hegaret wrote:
>http://www.health.wa.gov.au gives a "oops, internal error" message. I
>looked a little bit and it seems that the HttpURLConnection in Jigsaw
>does not like the HTTP Headers returned by the site:
>
>HTTP/1.1 200 OK
>Server: Microsoft-IIS/4.0
>Date: Fri, 12 Jul 2002 20:48:37 GMT
>Connection: close
>Set-Cookie:
>WEBTRENDS_ID=18.29.0.174-2134255200.29501925::B35165765B39CED9FD37CE3CEA870ED7; path=/; expires=Sat, 12-Jul-2003 20:48:37 GMT
>
>Content-type: text/html
>Page-Completion-Status: Normal
>Page-Completion-Status: Normal
>Set-Cookie: CFID=29773; expires=Sun, 27-Sep-2037 00:00:00 GMT; path=/; 
>Set-Cookie: CFTOKEN=76545204; expires=Sun, 27-Sep-2037 00:00:00 GMT;
>path=/; 
>
> 
>        
>
>
><html>
>[...]
>
>The blank line between the headers seems wrong to me ... 

Well, the lines after the first empty line are no headers, they are part
of the response body. A body that is sent even for HEAD requests
(implementations MUST NOT do that)...

>Error detail:
>
>[ERROR] http://www.health.wa.gov.au
>java.lang.NullPointerException
>        at org.w3c.www.protocol.http.HttpURLConnection.getContentType(HttpURLConnection.java:161)
>        at org.w3c.css.css.HTMLStyleSheetParser.<init>(HTMLStyleSheetParser.java:107)
>        at org.w3c.css.servlet.CssValidator.doGet(CssValidator.java:305)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
>        at org.w3c.jigsaw.servlet.ServletWrapper$ServletRunner.run(ServletWrapper.java:540)
>        at org.w3c.util.CachedThread.run(ThreadCache.java:87)

Something does not like the fact, that this response does not have a
Content-Type header. This is a bug. A response does not need to have a
Content-Type response header, this is discussed in section 7.2.1 of RFC
2616. The relevant line in HTMLStyleSheetParser.java is

  contentType = connection.getContentType();
  if (contentType == null) {
      contentType = "unknown";
  }

contentType should be set to "application/octet-stream" and treated as
such, but this wouldn't be helpful for the error message I guess. I
think the Validator should complain, that the response did not define
the content-type of the resource. However, I guess you are right and
this is a bug in Jigsaw providing the getContentType() method.

cc' to jigsaw@w3.org.

Received on Friday, 12 July 2002 17:16:39 UTC