κΉ¨μ§ λ§ν¬κ° ν¬ν¨λ λλ ν 리λ₯Ό λμ΄νλ €κ³ νλ©΄ μ λ³΄κ° μλ μ€λ₯κ° λ°μν©λλ€.
$ cadaver webdav://localhost:5555/api/v1/content
dav:/api/v1/content/> ls etc
Listing collection `/api/v1/content/etc/': failed:
XML parse error at line 1: junk after document element
μ΄κ²μ webdav μλ²μμ μ»μ κ²μ λλ€.
2016/06/27 14:52:42 http: multiple response.WriteHeader calls
μ΄ μ€λ₯λ κΉ¨μ§ λ§ν¬ νμΌμ λν΄ statλ₯Ό νΈμΆνλ file.go [1]μμ λ°μνμ§λ§ webdav.go walkFn [2]μμ μ²λ¦¬λμ΄μΌ νλ€κ³ μκ°ν©λλ€.
λλ 무μμ μΈμ/λ°νν΄μΌ ν μ§ νμ μ΄ μμ§ μμ§λ§ μ΄ λ§ν¬κ° μ΄λ»κ²λ λμ΄μ§ κ²μΌλ‘ νμλ μ 체 λλ ν 리 λͺ©λ‘(μ: webdavλ λ΄ μκ°μ μ΄κ²μ λν΄ λΆμ΄μλ μ λ¨)μ μ»μ κ²μΌλ‘ μμν©λλ€.
[1] https://github.com/golang/net/blob/master/webdav/file.go#L779
[2] https://github.com/golang/net/blob/master/webdav/webdav.go#L527
/cc @simon3z
μ΄ λ¬Έμ κ° λ°μνμ΅λλ€. https://github.com/golang/net/blob/master/webdav/webdav.go#L557 μμ μ€λ₯κ° λ°μνλ©΄ nilμ λ°ννμ¬ λ‘컬μμ μμ νμ΅λλ€
λλ Apache ꡬνμΌλ‘ λμΌν μ¬μ© μ¬λ‘λ₯Ό ν μ€νΈνμΌλ©° κΉ¨μ§ μ¬λ³Όλ¦ λ§ν¬μ κ²½μ° μλμΌλ‘ μμ λ©λλ€.
μΆ©λΆν μ’μ ν΄κ²°μ±
μΈμ§λ λͺ¨λ₯΄κ² μ§λ§ μ€λμ νλλ ν리λ€.
λ€μμ μλͺ»λ μλ΅μ wireshark μΆμ μ
λλ€.
Host: 10.21.59.204
Depth: 1
Content-Type: application/xml
Apply-To-Redirect-Ref: T
Accept-Encoding: gzip, deflate
User-Agent: gvfs/1.28.2
Accept-Language: en-us, en;q=0.9
Connection: Keep-Alive
Content-Length: 235
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:creationdate/>
<D:displayname/>
<D:getcontentlength/>
<D:getcontenttype/>
<D:getetag/>
<D:getlastmodified/>
<D:resourcetype/>
</D:prop>
</D:propfind>HTTP/1.1 207 status code 207
Content-Type: text/xml; charset=utf-8
Date: Wed, 15 Mar 2017 09:00:40 GMT
Content-Length: 610
<?xml version="1.0" encoding="UTF-8"?><D:multistatus xmlns:D="DAV:"><D:response><D:href>/dav</D:href><D:propstat><D:prop><D:displayname></D:displayname><D:getlastmodified>Wed, 15 Mar 2017 08:59:55 GMT</D:getlastmodified><D:resourcetype><D:collection xmlns:D="DAV:"/></D:resourcetype></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat><D:propstat><D:prop><D:creationdate></D:creationdate><D:getcontentlength></D:getcontentlength><D:getcontenttype></D:getcontenttype><D:getetag></D:getetag></D:prop><D:status>HTTP/1.1 404 Not Found</D:status></D:propstat></D:response></D:multistatus>Internal Server Error
Webdav μ¬μμμλ λ€μκ³Ό κ°μ΄ λ§ν©λλ€.
allprop λ° propnameμ κ²½μ° principalμ
νΉμ μ¬μ°μ΄ μ‘΄μ¬νλμ§ μ¬λΆλ₯Ό μ κΆλ¦¬
μλ΅μμ μ‘°μ©ν μ μΈλμ΄μΌ ν©λλ€.
μ΄κ²μ΄ μ°λ¦¬μ μ¬μ© μ¬λ‘μ μ μ©λλμ§ λͺ¨λ₯΄κ² μ΅λλ€
κΉ¨μ§ λ§ν¬μ μ‘μΈμ€νλ κ²½μ° 4XX
μν μ½λκ° λ°νλμ΄μΌ νλ€κ³ μκ°ν©λλ€. νΉν κΆν λμ μΈλΆμ μ°κ²°λ λ§ν¬μ κ²½μ° 403 Forbidden
, λ§ν¬λ λ§ν¬μ κ²½μ° 404 Not Found
μ
λλ€. μ‘΄μ¬νμ§ μλ λμμκ².
νμ¬ μ€λ₯μ μν΄ λ°ν FileSystem.OpenFile
λλ File.Stat
μ μ μ‘ http.StatusInternalServerError
μ μμΈμ "HTTP : golang.org/x/net/webdav.(*Handlerμμ λΆνμν response.WriteHeader νΈμΆ) .ServeHTTP(webdav.go:74)"
https://golang.org/cl/249797 μμ μ΄ λ¬Έμ λ₯Ό μΈκΈ: webdav: ignore os.PathError in PROPFIND
κ°μ₯ μ μ©ν λκΈ
μ΄ λ¬Έμ κ° λ°μνμ΅λλ€. https://github.com/golang/net/blob/master/webdav/webdav.go#L557 μμ μ€λ₯κ° λ°μνλ©΄ nilμ λ°ννμ¬ λ‘컬μμ μμ νμ΅λλ€
λλ Apache ꡬνμΌλ‘ λμΌν μ¬μ© μ¬λ‘λ₯Ό ν μ€νΈνμΌλ©° κΉ¨μ§ μ¬λ³Όλ¦ λ§ν¬μ κ²½μ° μλμΌλ‘ μμ λ©λλ€.
μΆ©λΆν μ’μ ν΄κ²°μ± μΈμ§λ λͺ¨λ₯΄κ² μ§λ§ μ€λμ νλλ ν리λ€.
λ€μμ μλͺ»λ μλ΅μ wireshark μΆμ μ λλ€.
Webdav μ¬μμμλ λ€μκ³Ό κ°μ΄ λ§ν©λλ€.
μ΄κ²μ΄ μ°λ¦¬μ μ¬μ© μ¬λ‘μ μ μ©λλμ§ λͺ¨λ₯΄κ² μ΅λλ€