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
2 changes: 2 additions & 0 deletions fsthttp/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ func (req *Request) sendWithGuestCache(ctx context.Context, backend string) (*Re
req.CacheOptions.OverrideKey = ""
}

options.Backend(backend)

// force the lookup to await in the host, retrieving any errors synchronously
cacheHandle, err := fastly.HTTPCacheTransactionLookup(req.abi.req, &options)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions internal/abi/fastly/hostcalls_noguest.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ type HTTPCacheLookupOptions struct{}
func (HTTPCacheLookupOptions) OverrideKey(key string) {
}

func (HTTPCacheLookupOptions) Backend(backend string) {
}


func HTTPCacheIsRequestCacheable(req *HTTPRequest) (bool, error) {
return false, fmt.Errorf("not implemented")
}
Expand Down
8 changes: 8 additions & 0 deletions internal/abi/fastly/httpcache_guest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ func (o *HTTPCacheLookupOptions) OverrideKey(key string) {
o.mask |= httpCacheLookupOptionsFlagOverrideKey
}

func (o *HTTPCacheLookupOptions) Backend(backend string) {
b := []byte(backend)
buf := prim.NewReadBufferFromBytes(b)
o.opts.backendPtr = prim.ToPointer(buf.Char8Pointer())
o.opts.backendLen = buf.Len()
o.mask |= httpCacheLookupOptionsFlagBackend
}

type HTTPCacheWriteOptions struct {
mask httpCacheWriteOptionsMask
opts httpCacheWriteOptions
Expand Down
3 changes: 3 additions & 0 deletions internal/abi/fastly/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1824,13 +1824,16 @@ const (
type httpCacheLookupOptions struct {
overrideKeyPtr prim.Pointer[prim.Char8]
overrideKeyLen prim.Usize
backendPtr prim.Pointer[prim.Char8]
backendLen prim.Usize
}

type httpCacheLookupOptionsMask prim.U32

const (
httpCacheLookupOptionsFlagReserved httpCacheLookupOptionsMask = 1 << 0
httpCacheLookupOptionsFlagOverrideKey httpCacheLookupOptionsMask = 1 << 1
httpCacheLookupOptionsFlagBackend httpCacheLookupOptionsMask = 1 << 2
)

type (
Expand Down
Loading