I'm not sure when it started, but my generated feeds (4.5.2) are being output with a blank line before the XML prologue. This includes the main feed at node/feed and taxonomy feeds.

Most aggregators are liberal, so I'm not too worried about real-world breakage. But I've got users who are noobs, and when they follow my feed link in a browser they get a parsing error -- which I'd like to avoid.

I've looked at node_feed() in node.module and don't see any reason for this. I also can't find any other code that touches the RSS output. Any ideas?

Comments

Lou Quillio’s picture

Trailing linefeeds in my phptemplate tpl files, graciously donated by gEdit. Solved.

ShavenYak’s picture

I've got the same problem here, but on Drupal 4.6.3. I'm actually getting two newlines before the XML starts. I've checked my tpl files and removed the trailing linefeeds, but my RSS feeds are still messed up. Any ideas, anyone?

nathandigriz’s picture

This was fixed here:

http://www.hivemindz.com/hivemindz_site_and_download_problems_repaired

But the exact files where the code goes you will have to ask about.

At least it looks like the same problem.

ShavenYak’s picture

Thanks for the pointer. I figured out where to put the code myself once I read the blurb on hivemindz. I'll duplicate the info here to help out the next person who comes along looking....

The file you need to modify is includes/bootstrap.inc
Look for the drupal_page_header function and add two lines of code to the beginning so it looks like this:

/**
 * Set HTTP headers in preparation for a page response.
 */
function drupal_page_header() {
  $clean = ob_get_contents();
  ob_end_clean();

  if (variable_get('dev_timer', 0)) {
    timer_start();
  }

Disclaimer: it worked for me. Your mileage may vary. Not to be taken internally. Do not taunt Happy Fun Ball.