I was wondering if there was an elegant way to suppress devel output on xmlrpc.php without hacking blog api. Any ideas or pointers are appreciated!

Comments

moshe weitzman’s picture

Any page that returns a content type of text/xml in its http header will not get any junk appended. Thats what I hope would happen here. Hope that gives a pointer. See devel_shutdown_real().

thepanz’s picture

Version: 6.x-1.8 » 6.x-1.x-dev
Category: feature » bug
Priority: Normal » Major

Following (http://drupal.org/node/742706#comment-3931628) I've further checked the devel_shutdown_real() function and its headers checks.
The issue here is that xmlrpc.php returns "Content-Type: text/html; charset=utf-8", breaking the XMLRPC call (tested also with the example_xmlrpc module). I think that Drupal is returning the xmlrpc POST call as html instead of XML (in the headers). For this reason I'm changinh this "feature request" into a "bug report" (with major priority).

Cheers

thepanz’s picture

StatusFileSize
new1.92 KB

I found out the issue core: the xmlrpc.php is setting HTTP headers using PHP header() function and not drupal_set_header() (see xmlrpc_server_output() function http://api.drupal.org/api/drupal/includes--xmlrpcs.inc/function/xmlrpc_s...). The latter is the one checked in Devel module.

My patch fixes this issue not editing xmlrpc.php, but checking instead the real HTTP headers sent.
It uses a PHP5 function, and falls back to drupal_get_headers if not on PHP5 environment.

Also the Content-Types have been edited: it's now an inclusive (html and xhtml contentes) list of allowed content types.

Regards

thepanz’s picture

Status: Active » Needs review
moshe weitzman’s picture

Status: Needs review » Closed (works as designed)

thanks for the patch. i tried inclusive for a while and that worked poorly. instead, please patch core to use drupal_set_header()

thepanz’s picture

Status: Closed (works as designed) » Active

I think that the "exclusive" filter is a bit complex to manage to exclude a full range of different Content-Types, in fact you're excluding well-format xHTML ("application/xhtml+xml") from the display of shutdown data.

I've re-opened this issue to move it to the Drupal projec. Even if I don't know how long will it take to be fixed, leaving the Drupal6+Devel combination to a XMLRPC fault :(

Regards

thepanz’s picture

Project: Devel » Drupal core
Version: 6.x-1.x-dev » 6.x-dev
Component: devel » xml-rpc system
Priority: Major » Normal
StatusFileSize
new788 bytes

Following Moshe suggestion, I'm providing a Drupal xml-rpc system patch for this issue, allowing xmlrpc sub-system to use drupal_set_header() function instead PHP header().

Regards

thepanz’s picture

Title: devel query log display breaking blog api xmlrpc » Xmlrpc system do not uses drupal_set_headers (issue from Devel module)
Status: Active » Needs review
fgm’s picture

Issue summary: View changes
  1. +++ xmlrpcs.inc	12 Jan 2011 14:11:14 -0000
    @@ -109,10 +109,10 @@
       $xml = '<?xml version="1.0"?>'."\n". $xml;
    

    This should also have the utf8 encoding.

  2. +++ xmlrpcs.inc	12 Jan 2011 14:11:14 -0000
    @@ -109,10 +109,10 @@
    +  drupal_set_header('Content-Type: text/xml');
    

    This should also add the utf8 charset.

fgm’s picture

Status: Needs review » Needs work

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.