Closed krichprollsch closed 2 months ago
The issue happens only with a xhr conn via TLS. w/o TLS, the same code doesn't panic.
$ zig build get -- http://127.0.0.1:1234/xhr/index.html --dump
debug(browser): starting GET http://127.0.0.1:1234/xhr/index.html
info(browser): GET http://127.0.0.1:1234/xhr/index.html http.Status.ok
debug(browser): header content-type: text/html; charset=utf-8
debug(browser): parse html with charset utf-8
debug(browser): start js env
debug(browser): setup global env
debug(xhr): http.Method.GET http://127.0.0.1:1234/get.json
debug(browser): eval inline undefined
info(xhr): http.Method.GET http://127.0.0.1:1234/get.json http.Status.ok
debug(xhr): dispatch progress event: loadstart
debug(xhr): dispatch progress event: progress
debug(xhr): dispatch progress event: load
debug(xhr): dispatch progress event: loadend
debug(browser): wait: OK
<!DOCTYPE html>
<html><head>
</head>
<body>
<pre id="response">{
"args": {},
"headers": {
"Accept": [
"*/*"
],
"Host": [
"httpbin.io"
],
"User-Agent": [
"curl/8.5.0"
]
},
"origin": "213.41.108.198:57515",
"url": "http://httpbin.io/get"
}
</pre>
<script type="text/javascript">
const xhr = new XMLHttpRequest();
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
document.getElementById('response').textContent = xhr.responseText;
} else {
console.log('The request failed!');
}
};
xhr.onerror = function () {
console.log('There was an error!');
};
xhr.open('GET', 'http://127.0.0.1:1234/get.json');
xhr.send();
</script>
</body></html>