Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/browser/browser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Types = @import("root").Types;
const parser = @import("netsurf");
const Loader = @import("loader.zig").Loader;
const Dump = @import("dump.zig");
const Mime = @import("mime.zig");
const Mime = @import("mime.zig").Mime;

const jsruntime = @import("jsruntime");
const Loop = jsruntime.Loop;
Expand Down Expand Up @@ -375,8 +375,10 @@ pub const Page = struct {
defer alloc.free(ct.?);

log.debug("header content-type: {s}", .{ct.?});
const mime = try Mime.parse(ct.?);
if (mime.eql(Mime.HTML)) {
var mime = try Mime.parse(alloc, ct.?);
defer mime.deinit();

if (mime.isHTML()) {
try self.loadHTMLDoc(req.reader(), mime.charset orelse "utf-8", auxData);
} else {
log.info("non-HTML document: {s}", .{ct.?});
Expand Down
Loading