WebDAV: Ignore Reason-Phrase in status line #2281

This commit is contained in:
Rodrigo 2018-04-30 14:15:24 +02:00 committed by Nick Craig-Wood
parent 3116249692
commit b7d2048032
1 changed files with 3 additions and 3 deletions

View File

@ -65,8 +65,8 @@ type Prop struct {
Modified Time `xml:"DAV: prop>getlastmodified,omitempty"`
}
// Parse a status of the form "HTTP/1.1 200 OK",
var parseStatus = regexp.MustCompile(`^HTTP/[0-9.]+\s+(\d+)\s+(.*)$`)
// Parse a status of the form "HTTP/1.1 200 OK" or "HTTP/1.1 200"
var parseStatus = regexp.MustCompile(`^HTTP/[0-9.]+\s+(\d+)`)
// StatusOK examines the Status and returns an OK flag
func (p *Prop) StatusOK() bool {
@ -75,7 +75,7 @@ func (p *Prop) StatusOK() bool {
return true
}
match := parseStatus.FindStringSubmatch(p.Status[0])
if len(match) < 3 {
if len(match) < 2 {
return false
}
code, err := strconv.Atoi(match[1])