Files
vercel-labs--zerolang/conformance/native/pass/std-http-fetch.0
T
wehub-resource-sync e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:29:30 +08:00

33 lines
1.3 KiB
Plaintext

export c fn main() -> i32 {
let net: Net = std.net.host()
let client: HttpClient = std.http.client(net)
var response: [128]u8 = [0_u8; 128]
let request: Span<u8> = std.mem.span("GET ftp://example.invalid\n\n")
let result: HttpResult = std.http.fetch(client, request, response, std.time.ms(250))
if std.http.resultOk(result) {
return 99
}
if std.http.resultStatus(result) == 0 && std.http.resultBodyLen(result) == 0 && std.http.resultError(result) == std.http.errorUnsupportedProtocol() && std.http.responseLen(response) == 0 && std.http.responseHeadersLen(response) == 0 {
var invalid_response: [128]u8 = [0_u8; 128]
let invalid_request: Span<u8> = std.mem.span("GET http://example.invalid\nbad-header\n\n")
let invalid_result: HttpResult = std.http.fetch(client, invalid_request, invalid_response, std.time.ms(250))
if std.http.resultOk(invalid_result) {
return 24
}
if std.http.resultStatus(invalid_result) != 0 {
return 25
}
if std.http.resultBodyLen(invalid_result) != 0 {
return 26
}
if std.http.resultError(invalid_result) != std.http.errorInvalidRequest() {
return 27
}
if std.http.responseLen(invalid_response) != 0 {
return 28
}
return 23
}
return 98
}