Open pfgithub opened 11 months ago
Same here in Clemson University, but this is an issue with Zig's tls support. More specifically, Zig's stdlib does not implement TLS 1.2. Thus, it will fail on eduroam.
Related: https://github.com/ziglang/zig/issues/14172
Also, if you really want to use std.http.Client
, I suggest you hook it up to an http proxy running locally on your machine (like tinyproxy), to get around this problem until the TLS 1.2 is supported.
Edit: It's most likely that eduroam doesn't support TLS 1.3, but this is a sample size of 2.
Here's a workaround bun + fish script to download packages recursively from a build.zig.zon file until this is fixed
// dnlpkg.ts
import {mkdirSync, readFileSync} from "fs";
process.chdir(process.env.HOME + "/.cache/zig/p");
async function downloadFromZon(zon: string) {
const file = Bun.file(zon);
let filetext;
try {
filetext = await file.text();
}catch(e) {
return;
}
const fline = filetext.split("\n");
let urlv = null;
for(const line of fline) {
if(line.includes('.url = ')) {
const urltxt = line.match(/".+"/);
if(urltxt == null) throw new Error("no urltxt");
const urlparsed = JSON.parse(urltxt[0]);
if(urlv != null) throw new Error("previous url had no hash");
urlv = urlparsed;
}else if(line.includes('.hash = ')) {
const urltxt = line.match(/".+"/);
if(urltxt == null) throw new Error("no hashtxt");
const hashparsed = JSON.parse(urltxt[0]);
if(urlv == null) throw new Error(".hash field above .url field");
await exec(["fish", __dirname + "/dnlpkg.fish", urlv, hashparsed]);
urlv = null;
await downloadFromZon(hashparsed + "/build.zig.zon");
}
}
if(urlv != null) throw new Error("missed url: " + urlv);
}
await downloadFromZon(Bun.argv[2]);
async function exec(cmd) {
const res = Bun.spawnSync(cmd, {stdio: ["inherit", "pipe", "inherit"]});
if(res.exitCode !== 0) {
console.log(cmd, res);
process.exit(1);
}
return new TextDecoder().decode(res.stdout);
}
// dnlpkg.fish
if [ ! -d $argv[2] ]
rm -f dnl.tar.gz
rm -rf dnl
mkdir -p dnl
wget $argv[1] -O dnl.tar.gz
tar -xvf dnl.tar.gz --strip-components=1 -C dnl
mv dnl $argv[2]
rm -f dnl.tar.gz
rm -rf dnl
echo "completed download "$argv[2] 1>&2
else
echo "already downloaded "$argv[2] 1>&2
end
bun dnlpkg.ts build.zig.zon
Zig Version
0.12.0-dev.415+5af5d87ad (mac aarch64, windows 10, Linux 5.15.90.1-microsoft-standard-WSL2)
Steps to Reproduce and Observed Behavior
The http client is broken on UofT eduroam wifi but works fine with a hotspot from my phone.
Expected Behavior