mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-31 01:28:55 +00:00
remove cache revalidation stubs
This commit is contained in:
@@ -1562,8 +1562,6 @@ pub const Transfer = struct {
|
||||
rh.contentType(),
|
||||
if (conn.getResponseHeader("cache-control", 0)) |h| h.value else null,
|
||||
vary,
|
||||
if (conn.getResponseHeader("etag", 0)) |h| h.value else null,
|
||||
if (conn.getResponseHeader("last-modified", 0)) |h| h.value else null,
|
||||
if (conn.getResponseHeader("age", 0)) |h| h.value else null,
|
||||
conn.getResponseHeader("set-cookie", 0) != null,
|
||||
conn.getResponseHeader("authorization", 0) != null,
|
||||
|
||||
15
src/network/cache/Cache.zig
vendored
15
src/network/cache/Cache.zig
vendored
@@ -48,8 +48,6 @@ pub fn put(self: *Cache, metadata: CachedMetadata, body: []const u8) !void {
|
||||
|
||||
pub const CacheControl = struct {
|
||||
max_age: u64,
|
||||
must_revalidate: bool = false,
|
||||
immutable: bool = false,
|
||||
|
||||
pub fn parse(value: []const u8) ?CacheControl {
|
||||
var cc: CacheControl = .{ .max_age = undefined };
|
||||
@@ -65,10 +63,6 @@ pub const CacheControl = struct {
|
||||
return null;
|
||||
} else if (std.ascii.eqlIgnoreCase(directive, "no-cache")) {
|
||||
return null;
|
||||
} else if (std.ascii.eqlIgnoreCase(directive, "must-revalidate")) {
|
||||
cc.must_revalidate = true;
|
||||
} else if (std.ascii.eqlIgnoreCase(directive, "immutable")) {
|
||||
cc.immutable = true;
|
||||
} else if (std.ascii.eqlIgnoreCase(directive, "public")) {
|
||||
is_public = true;
|
||||
} else if (std.ascii.startsWithIgnoreCase(directive, "max-age=")) {
|
||||
@@ -103,11 +97,6 @@ pub const CachedMetadata = struct {
|
||||
stored_at: i64,
|
||||
age_at_store: u64,
|
||||
|
||||
// for If-None-Match
|
||||
etag: ?[]const u8,
|
||||
// for If-Modified-Since
|
||||
last_modified: ?[]const u8,
|
||||
|
||||
cache_control: CacheControl,
|
||||
/// Response Headers
|
||||
headers: []const Http.Header,
|
||||
@@ -144,8 +133,6 @@ pub fn tryCache(
|
||||
content_type: ?[]const u8,
|
||||
cache_control: ?[]const u8,
|
||||
vary: ?[]const u8,
|
||||
etag: ?[]const u8,
|
||||
last_modified: ?[]const u8,
|
||||
age: ?[]const u8,
|
||||
has_set_cookie: bool,
|
||||
has_authorization: bool,
|
||||
@@ -163,8 +150,6 @@ pub fn tryCache(
|
||||
.stored_at = timestamp,
|
||||
.age_at_store = if (age) |a| std.fmt.parseInt(u64, a, 10) catch 0 else 0,
|
||||
.cache_control = cc,
|
||||
.etag = if (etag) |e| try arena.dupe(u8, e) else null,
|
||||
.last_modified = if (last_modified) |lm| try arena.dupe(u8, lm) else null,
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{},
|
||||
};
|
||||
|
||||
12
src/network/cache/FsCache.zig
vendored
12
src/network/cache/FsCache.zig
vendored
@@ -263,8 +263,6 @@ test "FsCache: basic put and get" {
|
||||
.status = 200,
|
||||
.stored_at = now,
|
||||
.age_at_store = 0,
|
||||
.etag = null,
|
||||
.last_modified = null,
|
||||
.cache_control = .{ .max_age = 600 },
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{},
|
||||
@@ -315,8 +313,6 @@ test "FsCache: get expiration" {
|
||||
.status = 200,
|
||||
.stored_at = now,
|
||||
.age_at_store = 900,
|
||||
.etag = null,
|
||||
.last_modified = null,
|
||||
.cache_control = .{ .max_age = max_age },
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{},
|
||||
@@ -376,8 +372,6 @@ test "FsCache: put override" {
|
||||
.status = 200,
|
||||
.stored_at = now,
|
||||
.age_at_store = 900,
|
||||
.etag = null,
|
||||
.last_modified = null,
|
||||
.cache_control = .{ .max_age = max_age },
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{},
|
||||
@@ -418,8 +412,6 @@ test "FsCache: put override" {
|
||||
.status = 200,
|
||||
.stored_at = now,
|
||||
.age_at_store = 0,
|
||||
.etag = null,
|
||||
.last_modified = null,
|
||||
.cache_control = .{ .max_age = max_age },
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{},
|
||||
@@ -496,8 +488,6 @@ test "FsCache: vary hit and miss" {
|
||||
.status = 200,
|
||||
.stored_at = now,
|
||||
.age_at_store = 0,
|
||||
.etag = null,
|
||||
.last_modified = null,
|
||||
.cache_control = .{ .max_age = 600 },
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{
|
||||
@@ -559,8 +549,6 @@ test "FsCache: vary multiple headers" {
|
||||
.status = 200,
|
||||
.stored_at = now,
|
||||
.age_at_store = 0,
|
||||
.etag = null,
|
||||
.last_modified = null,
|
||||
.cache_control = .{ .max_age = 600 },
|
||||
.headers = &.{},
|
||||
.vary_headers = &.{
|
||||
|
||||
Reference in New Issue
Block a user