[Bug 29315] New: API validation with HTML5 and JSON output includes headers in content

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29315

            Bug ID: 29315
           Summary: API validation with HTML5 and JSON output includes
                    headers in content
           Product: HTML Checker
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: General
          Assignee: mike+validator@w3.org
          Reporter: bugmezilla@harakirimail.com
        QA Contact: www-validator-cvs@w3.org
  Target Milestone: ---

Hi everyone,

It seems that the JSON output is leaking headers into the main content.

Headers such as:

  X-W3C-Validator-Recursion

are printed as part of the response causing programs to fail and complain about
invalid JSON.


Tested using the following content as test.html:

  <!DOCTYPE html>
  <html lang="en">
  <head>
    <title>title</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  </head>
  <body>

  </body>
  </html>


And the following curl command:

  curl -sF "uploaded_file=@test.html;type=text/html" -F output=json
http://validator.w3.org/check


The output I get is:

  Status: 302 Found
  Location: https://validator.w3.org/nu/?doc=test.html&out=json

  Content-Type: application/json; charset=UTF-8
  X-W3C-Validator-Recursion: 1
  X-W3C-Validator-Status: Valid
  X-W3C-Validator-Errors: 0
  X-W3C-Validator-Warnings: 1

  {
      "url": "test.html",
      "messages": [

            {


                "message": "The Content-Type was text/html. Using the HTML
parser.",
                "messageid": "html5",
                "explanation": "    <p class=\"helpwanted\">\n      <a\n       
href=\"feedback.html?uri=;errmsg_id=html5#errormsg\"\n\ttitle=\"Suggest
improvements on this error message through our feedback channels\" \n     
>&#x2709;</a>\n    </p>\n",
                "type": "info"
            },

            {


                "message": "Using the schema for HTML with SVG 1.1, MathML 3.0,
RDFa 1.1, and ITS 2.0 support.",
                "messageid": "html5",
                "explanation": "    <p class=\"helpwanted\">\n      <a\n       
href=\"feedback.html?uri=;errmsg_id=html5#errormsg\"\n\ttitle=\"Suggest
improvements on this error message through our feedback channels\" \n     
>&#x2709;</a>\n    </p>\n",
                "type": "info"
            }

          ],
      "source": {
          "encoding": "utf-8",
          "type": "text/html"
      }
  }

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Monday, 30 November 2015 10:51:41 UTC