From 3423027f5cae97539c2b48fc02aca0323a41f10a Mon Sep 17 00:00:00 2001 From: wangzhuowei Date: Fri, 26 Jul 2024 18:41:46 +0800 Subject: [PATCH] fix: FromHTTPHeader add stale --- cloud/metainfo/http.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cloud/metainfo/http.go b/cloud/metainfo/http.go index 5d90ac83..835903f8 100644 --- a/cloud/metainfo/http.go +++ b/cloud/metainfo/http.go @@ -84,8 +84,10 @@ func FromHTTPHeader(ctx context.Context, h HTTPHeaderCarrier) context.Context { // inherit from exist ctx node persistent := newKVStore() transient := newKVStore() + stale := newKVStore() sliceToMap(nd.persistent, persistent) sliceToMap(nd.transient, transient) + sliceToMap(nd.stale, stale) // insert new kvs from http header h.Visit(func(k, v string) { @@ -104,14 +106,15 @@ func FromHTTPHeader(ctx context.Context, h HTTPHeaderCarrier) context.Context { }) // return original ctx if no invalid key in http header - if (persistent.size() + transient.size()) == 0 { + if (persistent.size() + transient.size() + stale.size()) == 0 { return ctx } // make new kvs - nd = newNodeFromMaps(persistent, transient, nil) + nd = newNodeFromMaps(persistent, transient, stale) persistent.recycle() transient.recycle() + stale.recycle() ctx = withNode(ctx, nd) return ctx }