(s, extra=None, length=None)
| 81 | num_get_connections = 0 |
| 82 | |
| 83 | def sendheaders(s, extra=None, length=None): |
| 84 | length = length or len(data) |
| 85 | s.send_response(200) |
| 86 | s.send_header("Content-Length", str(length)) |
| 87 | s.send_header("Access-Control-Allow-Origin", "http://localhost:%s" % port) |
| 88 | s.send_header('Cross-Origin-Resource-Policy', 'cross-origin') |
| 89 | |
| 90 | s.send_header('Cache-Control', 'no-cache, no-store, must-revalidate, private, max-age=0') |
| 91 | s.send_header('Expires', '0') |
| 92 | s.send_header('Pragma', 'no-cache') |
| 93 | s.send_header('Vary', '*') # Safari insists on caching if this header is not present in addition to the above |
| 94 | |
| 95 | s.send_header("Access-Control-Expose-Headers", "Content-Length, Accept-Ranges") |
| 96 | s.send_header("Content-type", "application/octet-stream") |
| 97 | if support_byte_ranges: |
| 98 | s.send_header("Accept-Ranges", "bytes") |
| 99 | if extra: |
| 100 | for key, value in extra: |
| 101 | s.send_header(key, value) |
| 102 | s.end_headers() |
| 103 | |
| 104 | def do_HEAD(s): |
| 105 | s.sendheaders() |
no test coverage detected