3

I'm using the views_rss module in Drupal 6. Whenever I build out a View using this plugin, the following header is sent in a template_preprocess function:

drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');

This seems to be ignored, as the page is ultimately sent with a text/html header. It seems that my header is getting appended, but text/html is either sent first or last (whichever is ultimately interpreted by the browser) and thus has no effect.

How can I force a non-text/html header for a page output in Drupal 6?

1
  • Can you using curl -I and give me an output of list headers? So i think in your site, you have other function output this header again, so the return headers have 2 'Content-Type' headers, that's the header come late will override the header come first. I guess you will have 2 headers like this: Content-Type: application/rss+xml; charset=utf-8 Content-Type: text/html; charset=UTF-8 Feb 14, 2014 at 6:51

1 Answer 1

0

I think you are too late in the template_preprocess hook. The views display will have set it's header already before your hook gets called.

To test my thought have a look at the return value of the function drupal_set_header. It shows you all headers sent before.

If I'm right: Try implementing a hook which is is called earlier (maybe even before execution of the view query). Then your header will have precedence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.