summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/syntax/xmldecl/support/trickle.py
blob: f1ef785c94621a0c41d1e352cd8441bb30d59ab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import time

def main(request, response):
    response.add_required_headers = False # Don't implicitly add HTTP headers
    response.writer.write_status(200)
    response.writer.write_header("Content-Type", "text/html")
    response.writer.end_headers()

    for b in b'<?xml version="1.0" encoding="windows-1251"?':
        response.writer.write(bytes([b]))
        time.sleep(0.05)
    response.writer.write(b'>\n<p>Normal XML declation as slow byte-by-byte trickle</p>\n<p>Test: \xE6</p>\n<p>If &#x0436;, XML decl takes effect</p>')