Skip to content

http: InvalidChunk on browser/src/http/client.zig:1394 #510

@krichprollsch

Description

@krichprollsch

When I request https://huggingface.co/models using the PR #509 I get a crash with InvalidChunk error on browser/src/http/client.zig:1394.

I need #509 b/c the server doesn't return any Content-type header.

If I debug the `

$ zig build run -- fetch --dump https://huggingface.co/models
debug(cli): Fetch mode: url https://huggingface.co/models, dump true
debug(browser): start js env
debug(browser): setup global env
debug(polyfill): load polyfill-fetch: undefined
debug(browser): inspector context created
debug: Inspector contextCreated called
debug(browser): starting GET https://huggingface.co/models
info(browser): GET https://huggingface.co/models 200
info(browser): no content-type HTTP header
debug(browser): header content-type: text/html; charset=utf-8
debug(browser): parse html with charset utf-8
error(cli): 'https://huggingface.co/models' fetching error (error.InvalidChunk)

error: InvalidChunk
/home/pierre/wrk/browser/src/http/client.zig:1394:21: 0x1a7fdd0 in readChunkSize (lightpanda)
                    return error.InvalidChunk;
                    ^
/home/pierre/wrk/browser/src/http/client.zig:1332:39: 0x1a80895 in process (lightpanda)
                    const next_size = try readChunkSize(header);
                                      ^
/home/pierre/wrk/browser/src/http/client.zig:1249:38: 0x1a8183e in process (lightpanda)
                inline else => |*br| return br.process(data),
                                     ^
/home/pierre/wrk/browser/src/http/client.zig:1042:38: 0x1a46fa2 in process (lightpanda)
            const ok, const result = try br.process(data);
                                     ^
/home/pierre/wrk/browser/src/http/client.zig:1519:24: 0x1a46d2f in processData (lightpanda)
        const result = try self._reader.process(data);
                       ^
/home/pierre/wrk/browser/src/http/client.zig:1505:17: 0x1a486f9 in next (lightpanda)
            if (try self.processData()) |data| {
                ^
/home/pierre/wrk/browser/src/netsurf/netsurf.zig:2186:16: 0x1a48a6b in parseData__anon_411839 (lightpanda)
        while (try reader.next()) |data| {
               ^
/home/pierre/wrk/browser/src/netsurf/netsurf.zig:2145:5: 0x1a49034 in documentHTMLParse__anon_411776 (lightpanda)
    try parseData(parser.?, reader);
    ^
/home/pierre/wrk/browser/src/browser/browser.zig:437:26: 0x1a4fe9f in loadHTMLDoc__anon_411740 (lightpanda)
        const html_doc = try parser.documentHTMLParse(reader, ccharset);
                         ^
/home/pierre/wrk/browser/src/browser/browser.zig:414:13: 0x1a52157 in navigate (lightpanda)
            try self.loadHTMLDoc(&response, mime.charset orelse "utf-8", aux_data);
            ^
/home/pierre/wrk/browser/src/main.zig:117:21: 0x1a57606 in main (lightpanda)
                    return err;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions