Esempio n. 1
0
// AddPropStatus adds the status of a given property.
func (m *MultiStatus) AddPropStatus(href string, found, missing []Any) {
	r := multiResponse{Href: wp.URLEncode(href)}
	if len(found) > 0 {
		r.Props = append(r.Props, multiProp{
			Prop:       prop{Any: found},
			PropStatus: "HTTP/1.1 200 OK",
		})
	}
	if len(missing) > 0 {
		r.Props = append(r.Props, multiProp{
			Prop:       prop{Any: missing},
			PropStatus: "HTTP/1.1 404 Not Found",
		})
	}
	m.Response = append(m.Response, r)
}
Esempio n. 2
0
func (l *lock) toXML() string {
	l.m.Lock()
	defer l.m.Unlock()
	ds := strconv.Itoa(l.depth)
	if l.depth < 0 {
		ds = "infinity"
	}

	t := (l.duration - time.Since(l.modified)) / time.Second
	return fmt.Sprintf(`
<activelock>
  <locktype><write/></locktype>
  <lockscope><exclusive/></lockscope>
  <depth>%s</depth>
  <owner>%s</owner>
  <timeout>Second-%d</timeout>
  <locktoken><href>%s</href></locktoken>
  <lockroot><href>%s</href></lockroot>
</activelock>`, ds, l.owner, t, l.token, wp.URLEncode(l.path))
}
Esempio n. 3
0
// AddStatus adds a status of a given HREF.
func (m *MultiStatus) AddStatus(href string, err error) {
	m.Response = append(m.Response, multiResponse{
		Href:   wp.URLEncode(href),
		Status: err.Error(),
	})
}