Re: [Httplib2-discuss] Optional non-'redirect following'
Status: Beta
Brought to you by:
jcgregorio
From: Joe G. <jo...@bi...> - 2007-04-19 19:00:59
|
Rene, The 0.3.0 release of httplib2 adds a 'content-location' header to every response. That 'content-location' header contains the last URI in the redirect chain, which should be used on subsequent requests. Is that content-location not getting through back to the requester? -joe On 4/19/07, Rene Schmit <re...@pt...> wrote: > Hello, > > I use the library in a proxy to retrieve pages from the target servers. > > In this context, the automatic redirect following is no good, as the > browser will not know about the redirect. Consequently, further requests > will be sent to the wrong host, resulting in errors. > > My solution to the problem is to add a flag to the Http class, in the > constructor: > > self.ignore_redirects =3D False > > and to change this line > > if (self.follow_all_redirects or method in ["GET", "HEAD"]) or > response.status =3D=3D 303: > > to: > < if (not self.ignore_redirects) and (self.follow_all_redirects or > method in ["GET", "HEAD"]) or response.status =3D=3D 303: > > > Thus, the default behavior of the library remains unchanged, but gives > the calling code a chance to retrieve the 'raw' reply from the server. > > Does it make sense to add this feature to the library? What about > caching for those replies? > > Ren=E9 Schmit > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Httplib2-discuss mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/httplib2-discuss > --=20 Joe Gregorio http://bitworking.org |