fix: expire header timezone (#1840)
Signed-off-by: Jim Ma <majinjing3@gmail.com>
This commit is contained in:
parent
3582a10b91
commit
1c24c3fc8c
|
|
@ -435,7 +435,8 @@ func (s *server) recursiveDownloadWithP2PMetadata(
|
||||||
// update url scheme
|
// update url scheme
|
||||||
purl.Scheme = source.ListMetadataScheme
|
purl.Scheme = source.ListMetadataScheme
|
||||||
// update cache expire time
|
// update cache expire time
|
||||||
urlMeta.Header[source.ListMetadataExpire] = time.Now().Add(s.cacheRecursiveMetadata).Format(source.ExpireLayout)
|
// The target format is GMT time, need convert to UTC time first
|
||||||
|
urlMeta.Header[source.ListMetadataExpire] = time.Now().Add(s.cacheRecursiveMetadata).UTC().Format(source.ExpireLayout)
|
||||||
|
|
||||||
rc, _, err := s.peerTaskManager.StartStreamTask(ctx, &peer.StreamTaskRequest{
|
rc, _, err := s.peerTaskManager.StartStreamTask(ctx, &peer.StreamTaskRequest{
|
||||||
URL: purl.String(),
|
URL: purl.String(),
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@
|
||||||
|
|
||||||
package source
|
package source
|
||||||
|
|
||||||
import "net/textproto"
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/textproto"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Range is different with HTTP Range, it's without "bytes=" prefix
|
// Range is different with HTTP Range, it's without "bytes=" prefix
|
||||||
|
|
@ -24,8 +27,8 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LastModifiedLayout = "Mon, 02 Jan 2006 15:04:05 GMT"
|
LastModifiedLayout = http.TimeFormat
|
||||||
ExpireLayout = "Mon, 02 Jan 2006 15:04:05 GMT"
|
ExpireLayout = http.TimeFormat
|
||||||
)
|
)
|
||||||
|
|
||||||
type ExpireInfo struct {
|
type ExpireInfo struct {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue