hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Bouhier (MC/ECM)" <Christophe.Bouh...@ericsson.com>
Subject RE: redirect returning 200(ok)?
Date Fri, 28 Jan 2005 10:27:46 GMT
This is getting more and more interresting. 

With followRedirects off, I get a new location claiming to be an .mp3. 
I initiate a new GET method to get the file, but it turns out to be a text/html. 
The response status is 200OK, so no redirect. However the HTML (See below) has a 
redirect in the meta data: src="http://sinergy-networks.com/klitekture/downloads/LOD_live_croma04.mp3"

I pressume HTTPClient would not be able to interpret that, as this would the job of an HTML
parser like Internet
Explorer right? 

Thanks, Still in learning mode. 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"  
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Klitekture Records</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="minimal,sutekh,techno,mikael stavostrand,luis ortiz,klik,label,house,
minimal house, experimental">
<meta name="robots" content="index,nofollow">
<meta name="description" content="Klitekture is a record label based in Barcelona(Spain)
especializaed in minimal techno and weirdness">
<meta name="generator" content="Domain Direct Forwarding">
</head>
<frameset framespacing="0" rows="100%,*" cols="100%" frameborder="no" border="0">
<frame name="DDIRECTXYZZY2" scrolling="auto" src="http://sinergy-networks.com/klitekture/downloads/LOD_live_croma04.mp3"
noresize>
<frame name="DDIRECTXYZZY" scrolling="no" noresize>
  <noframes>
<h1><a href="http://sinergy-networks.com/klitekture/downloads/LOD_live_croma04.mp3">www.klitekture.com</a></h1>
<p>Please <a href="http://sinergy-networks.com/klitekture/downloads/LOD_live_croma04.mp3">click
here</a> to view the non-framed version.</p>
    <hr>
<p>Klitekture is a record label based in Barcelona(Spain) especializaed in minimal techno
and weirdness</p>
</noframes>
</frameset>
</html>



-----Original Message-----
From: Christophe Bouhier (MC/ECM) 
Sent: Friday, January 28, 2005 5:31 PM
To: 'HttpClient User Discussion'
Subject: RE: redirect returning 200(ok)?


Hi Roland, 

Thanks for the superfast reply. Turning of auto-redirect solved the issue. 
It introduced another problem tough. The content-length in the original location is set,
but not in the re-direct location. 

/ Christophe


-----Original Message-----
From: Roland Weber [mailto:ROLWEBER@de.ibm.com]
Sent: Friday, January 28, 2005 5:12 PM
To: HttpClient User Discussion
Subject: Re: redirect returning 200(ok)?


Hi Christophe,

> I have this URL which is treated as a redirect by Internet Explorer,
> but when passed to
> HTTP client returns a 200 OK. For sure this link is a redirect, but 
> I would expect a  3xx code, 
> to get the new location (And file name). 

HttpClient handles some redirects automatically. If you don't want
that, use HttpMethod.setFollowRedirects(false)

> How do I get the redirect location/URL from a 200OK? 

You don't ;-)

> Is it it possible to debug and see the HTTP response? 
> 
You can enable the wire log. For instructions, see
http://jakarta.apache.org/commons/httpclient/logging.html


hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message