forked from TrueCloudLab/lego
hurricane: only treat first word of response body as response code (#1409)
This commit is contained in:
parent
1227bb9f10
commit
25322628e4
2 changed files with 5 additions and 2 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -80,7 +81,9 @@ func (c *Client) UpdateTxtRecord(domain string, txt string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func evaluateBody(body string, hostname string) error {
|
func evaluateBody(body string, hostname string) error {
|
||||||
switch body {
|
words := strings.SplitN(body, " ", 2)
|
||||||
|
|
||||||
|
switch words[0] {
|
||||||
case codeGood:
|
case codeGood:
|
||||||
return nil
|
return nil
|
||||||
case codeNoChg:
|
case codeNoChg:
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestClient_UpdateTxtRecord(t *testing.T) {
|
||||||
expected: assert.NoError,
|
expected: assert.NoError,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: codeNoChg,
|
code: codeNoChg + ` "0123456789abcdef"`,
|
||||||
expected: assert.NoError,
|
expected: assert.NoError,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue