MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / do_GET

Method do_GET

test/test_browser.py:110–128  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

108 s.sendheaders([("Access-Control-Allow-Headers", "Range")], 0)
109
110 def do_GET(s):
111 # CORS preflight makes OPTIONS requests which we need to account for.
112 expectedConns = 22
113 s.num_get_connections += 1
114 assert s.num_get_connections < expectedConns
115
116 if s.path == '/':
117 s.sendheaders()
118 elif not support_byte_ranges:
119 s.sendheaders()
120 s.wfile.write(data)
121 else:
122 start, end = s.headers.get("range").split("=")[1].split("-")
123 start = int(start)
124 end = int(end)
125 end = min(len(data) - 1, end)
126 length = end - start + 1
127 s.sendheaders([], length)
128 s.wfile.write(data[start:end + 1])
129
130 return HTTPServer(('localhost', 11111), ChunkedServerHandler)
131

Callers

nothing calls this directly

Calls 5

sendheadersMethod · 0.80
splitMethod · 0.80
getMethod · 0.65
minFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected