mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-30 14:08:31 -07:00
Fix varinterval panic if request IH is not provided
This commit is contained in:
committed by
Lawrence, Rendall
parent
9122aefdd7
commit
239a642bfc
@@ -172,7 +172,7 @@ func NewFrontend(logic frontend.TrackerLogic, provided Config) (*Frontend, error
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.HTTPSAddr == "" || f.tlsCfg == nil {
|
||||
if (cfg.HTTPSAddr == "") != (f.tlsCfg == nil) {
|
||||
return nil, errors.New("must specify both https_addr, tls_cert_path and tls_key_path")
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ func TestWriteError(t *testing.T) {
|
||||
for _, tt := range table {
|
||||
t.Run(fmt.Sprintf("%s expecting %s", tt.reason, tt.expected), func(t *testing.T) {
|
||||
r := httptest.NewRecorder()
|
||||
err := WriteError(r, bittorrent.ClientError(tt.reason))
|
||||
require.Nil(t, err)
|
||||
WriteError(r, bittorrent.ClientError(tt.reason))
|
||||
require.Equal(t, r.Body.String(), tt.expected)
|
||||
})
|
||||
}
|
||||
@@ -38,8 +37,7 @@ func TestWriteStatus(t *testing.T) {
|
||||
for _, tt := range table {
|
||||
t.Run(fmt.Sprintf("%s expecting %s", tt.reason, tt.expected), func(t *testing.T) {
|
||||
r := httptest.NewRecorder()
|
||||
err := WriteError(r, bittorrent.ClientError(tt.reason))
|
||||
require.Nil(t, err)
|
||||
WriteError(r, bittorrent.ClientError(tt.reason))
|
||||
require.Equal(t, r.Body.String(), tt.expected)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user