W3C home > Mailing lists > Public > www-validator-css@w3.org > July 2002

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

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Fri, 12 Jul 2002 23:16:11 +0200
To: Philippe Le Hegaret <plh@w3.org>
Cc: Yves Lafon <ylafon@w3.org>, www-validator-css@w3.org, jigsaw@w3.org
Message-ID: <p3huiucr660alsp0ib5i4bi1d8m4d48j7t@4ax.com>

* 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 June 2012 00:14:11 GMT