This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29315 - API validation with HTML5 and JSON output includes headers in content
Summary: API validation with HTML5 and JSON output includes headers in content
Status: NEW
Alias: None
Product: HTML Checker
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Michael[tm] Smith
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-30 10:51 UTC by R
Modified: 2015-11-30 10:51 UTC (History)
0 users

See Also:


Attachments

Description R 2015-11-30 10:51:38 UTC
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"
      }
  }