mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-05 00:44:12 +08:00
Check if digest algo is supported in setting module
This commit is contained in:
parent
d1a53f7d6a
commit
65016b2664
|
@ -61,9 +61,6 @@ func NewClient(user *user_model.User, pubID string) (c *Client, err error) {
|
||||||
return
|
return
|
||||||
} else if err = containsRequiredHTTPHeaders(http.MethodPost, setting.Federation.PostHeaders); err != nil {
|
} else if err = containsRequiredHTTPHeaders(http.MethodPost, setting.Federation.PostHeaders); err != nil {
|
||||||
return
|
return
|
||||||
} else if !httpsig.IsSupportedDigestAlgorithm(setting.Federation.DigestAlgorithm) {
|
|
||||||
err = fmt.Errorf("unsupported digest algorithm: %s", setting.Federation.DigestAlgorithm)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
algos := make([]httpsig.Algorithm, len(setting.Federation.Algorithms))
|
algos := make([]httpsig.Algorithm, len(setting.Federation.Algorithms))
|
||||||
for i, algo := range setting.Federation.Algorithms {
|
for i, algo := range setting.Federation.Algorithms {
|
||||||
|
@ -85,8 +82,8 @@ func NewClient(user *user_model.User, pubID string) (c *Client, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c = &Client{
|
c = &Client{
|
||||||
clock: clock,
|
clock: clock,
|
||||||
client: &http.Client{
|
client: &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
Proxy: proxy.Proxy(),
|
Proxy: proxy.Proxy(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
|
|
||||||
package setting
|
package setting
|
||||||
|
|
||||||
import "code.gitea.io/gitea/modules/log"
|
import (
|
||||||
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
|
||||||
|
"github.com/go-fed/httpsig"
|
||||||
|
)
|
||||||
|
|
||||||
// Federation settings
|
// Federation settings
|
||||||
var (
|
var (
|
||||||
|
@ -26,5 +30,8 @@ var (
|
||||||
func newFederationService() {
|
func newFederationService() {
|
||||||
if err := Cfg.Section("federation").MapTo(&Federation); err != nil {
|
if err := Cfg.Section("federation").MapTo(&Federation); err != nil {
|
||||||
log.Fatal("Failed to map Federation settings: %v", err)
|
log.Fatal("Failed to map Federation settings: %v", err)
|
||||||
|
} else if !httpsig.IsSupportedDigestAlgorithm(Federation.DigestAlgorithm) {
|
||||||
|
log.Fatal("unsupported digest algorithm: %s", Federation.DigestAlgorithm)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user