[Httpunit-develop] Content Type Problem (where does HTTPUNIT look for this?)
Brought to you by:
russgold
From: John H. <joh...@ur...> - 2005-10-21 18:12:34
|
Hello I have searched the archives and although some similar questions were=20 asked, about Content-Type, I don't believe the current question has been=20 addressed. I work on an application that checks the content type of a document=20 before proceeding, because I only care about HTML. On this site, http://www.comune.perugia.it/, you can notice a strange=20 thing: two different META tags give two different Content-Types. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ...... <html> <head> <META http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-885= 9-1"> <title>Portale Comune di Perugia</title> <meta http-equiv=3D"Content-Type" content=3D"xml; charset=3Diso-8859-1"> <meta name=3D"author" content=3D"Citta in internet"> ....... However, that shouldn't really matter, because the server returns the=20 correct headers ("text/html"), as I can see when I log the headers: newResponse :: 'http://www.comune.perugia.it/' newResponse :: port =3D '-1' Connection url:: http://www.comune.perugia.it/ Sending:: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; IE=20 19 ed.2012) Connection url:: http://www.comune.perugia.it/ Header:: HTTP/1.0 200 OK Header:: Date: Fri, 21 Oct 2005 08:33:17 GMT Header:: Server: Microsoft-IIS/6.0 Header:: X-Powered-By: ASP.NET Header:: Content-Length: 9421 Header:: Content-Type: text/html Header:: Set-Cookie: WWW%5................. Header:: Set-Cookie: WWW%5FC................ Header:: Set-Cookie: ASPSESSIONI................ Header:: Cache-Control: No-Cache Header:: X-Cache: MISS from proxy.xxxx.xxxxx.com Header:: Proxy-Connection: keep-alive ..... BUT, when I try getContentType() for the web dialog response, it=20 gives me "Content Type : xml" , that is, it appears that this method is=20 actually picking up what the META tags in the page tell it, and NOT what=20 the server returns. Is this possible? I can make a solution for my=20 problem, but maybe I don't need to (if there is a way to tell HttpUnit=20 to let the server's headers override anything picked up in the METAs=20 that are returned). Any comments, clich=E9s or commentary gratefully accepted, Sincerely, John --=20 __________________________________________ URBILOG "For a more accessible web" 80 rue d'I=E9na Web: www.urbilog.com Lille =09 France Tel: +33 3 28 55 21 30 59000 Fax: +33 3 28 55 21 31 __________________________________________ |