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

View File

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