Redirection issue with drupal_http_request
Hi, I recently came across this issue when drupal_http_request reported error (-1002 - missing schema) for the following URL: http://feedproxy.google.com/~r/variety/news/film/~3/ksODaiUYe-U/VR1118022938 This URL redirects twice. For the first time, it returns the location: http://www.variety.com/article/VR1118022938?categoryid=3762&cs=1&nid=2564&ut... with 302 code. This URL when requested returns the Location: /article/VR1118022938.html?categoryid=3762&cs=1&nid=2564&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+variety%2Fnews%2Ffilm+%28Variety+-+Film+News%29 with 302 code. As the drupal_http_request requests the location, a missing schema error is reported. Whereas the browser, and the following test site: http://www.rexswain.com/cgi-bin/httpview.cgi, correctly returns the content of the page. Is drupal_http_request missing some recommended functionality? -- Regards, Nitin Kumar Gupta http://publicmind.in/blog/
On 08/14/2010 08:39 PM, nitin gupta wrote:
Hi,
I recently came across this issue when drupal_http_request reported error (-1002 - missing schema) for the following URL:
http://feedproxy.google.com/~r/variety/news/film/~3/ksODaiUYe-U/VR1118022938
This URL redirects twice. For the first time, it returns the location: http://www.variety.com/article/VR1118022938?categoryid=3762&cs=1&nid=2564&ut...
with 302 code.
This URL when requested returns the Location: /article/VR1118022938.html?categoryid=3762&cs=1&nid=2564&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+variety%2Fnews%2Ffilm+%28Variety+-+Film+News%29
with 302 code.
As the drupal_http_request requests the location, a missing schema error is reported. Whereas the browser, and the following test site: http://www.rexswain.com/cgi-bin/httpview.cgi, correctly returns the content of the page.
Is drupal_http_request missing some recommended functionality?
-- Regards, Nitin Kumar Gupta http://publicmind.in/blog/
drupal_http_request is not missing any standard functionality; it expects the location field to contain an absolute URI and that is what the standard specifies. However, this is a frequently encountered quirk, and a workaround might do some good there. From the HTTP/1.1 RFC: Location: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. [...] *The field value consists of a single absolute URI.* Location = "Location" ":" absoluteURI An example is: Location: http://www.w3.org/pub/WWW/People.html -- Arancaytar XMPP: arancaytar.ilyaran@gmail.com / ICQ: 282026638 / AIM: arancaytar42
Yes, I have encountered this a few times. Apparently, it's not the Drupal is wrong, but the the redirector is wrong - the URL is always suppoed to be absolute. I have always had to handle my own redirect loop to get around this. It would be nice if Drupal recognized this as common practice. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: nitin gupta I recently came across this issue when drupal_http_request reported error (-1002 - missing schema) for the following URL: http://feedproxy.google.com/~r/variety/news/film/~3/ksODaiUYe-U/VR1118022938 This URL redirects twice. For the first time, it returns the location: http://www.variety.com/article/VR1118022938?categoryid=3762&cs=1&nid=2564&ut... with 302 code. This URL when requested returns the Location: /article/VR1118022938.html?categoryid=3762&cs=1&nid=2564&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+variety%2Fnews%2Ffilm+%28Variety+-+Film+News%29 with 302 code. As the drupal_http_request requests the location, a missing schema error is reported. Whereas the browser, and the following test site: http://www.rexswain.com/cgi-bin/httpview.cgi, correctly returns the content of the page. Is drupal_http_request missing some recommended functionality? -- Regards, Nitin Kumar Gupta http://publicmind.in/blog/
participants (3)
-
Arancaytar Ilyaran -
nan wich -
nitin gupta