Make sure HTTP request Date in GMT
This commit is contained in:
parent
d749f8ff4f
commit
08eebffb0e
|
@ -11,6 +11,7 @@ import (
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
@ -106,7 +107,7 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error)
|
||||||
}
|
}
|
||||||
req.Header.Add("Content-Type", ActivityStreamsContentType)
|
req.Header.Add("Content-Type", ActivityStreamsContentType)
|
||||||
req.Header.Add("Accept-Charset", "utf-8")
|
req.Header.Add("Accept-Charset", "utf-8")
|
||||||
req.Header.Add("Date", fmt.Sprintf("%s UTC", time.Now().UTC().Format(time.RFC1123)))
|
req.Header.Add("Date", strings.ReplaceAll(time.Now().UTC().Format(time.RFC1123), "UTC", "GMT"))
|
||||||
|
|
||||||
signer, _, err := httpsig.NewSigner(c.algs, c.digestAlg, c.postHeaders, httpsig.Signature, httpsigExpirationTime)
|
signer, _, err := httpsig.NewSigner(c.algs, c.digestAlg, c.postHeaders, httpsig.Signature, httpsigExpirationTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -96,7 +96,7 @@ func Person(ctx *context.APIContext) {
|
||||||
ctx.Resp.Header().Add("Content-Type", "application/activity+json")
|
ctx.Resp.Header().Add("Content-Type", "application/activity+json")
|
||||||
ctx.Resp.WriteHeader(http.StatusOK)
|
ctx.Resp.WriteHeader(http.StatusOK)
|
||||||
binary, _ = json.Marshal(jsonmap)
|
binary, _ = json.Marshal(jsonmap)
|
||||||
ctx.Resp.Write(binary)
|
_, _ = ctx.Resp.Write(binary)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersonInbox function
|
// PersonInbox function
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/activitypub"
|
"code.gitea.io/gitea/modules/activitypub"
|
||||||
|
@ -50,7 +51,7 @@ func fetch(iri *url.URL) (b []byte, err error) {
|
||||||
req := httplib.NewRequest(iri.String(), http.MethodGet)
|
req := httplib.NewRequest(iri.String(), http.MethodGet)
|
||||||
req.Header("Accept", activitypub.ActivityStreamsContentType)
|
req.Header("Accept", activitypub.ActivityStreamsContentType)
|
||||||
req.Header("Accept-Charset", "utf-8")
|
req.Header("Accept-Charset", "utf-8")
|
||||||
req.Header("Date", fmt.Sprintf("%s UTC", time.Now().UTC().Format(time.RFC1123)))
|
req.Header("Date", strings.ReplaceAll(time.Now().UTC().Format(time.RFC1123), "UTC", "GMT"))
|
||||||
resp, err := req.Response()
|
resp, err := req.Response()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue