Terminologist
Terminologist

Reputation: 1003

My WEBDAV PROPFIND response isn't accepted by windows explorer

I'm implementing a WebDAV server but am hitting a problem with the proposed client (Windows 7 explorer). In windows I'm browsing to \server\public\container, which my server wants to present as a folder containing two files so I'm receiving the following request:

PROPFIND /public/container HTTP/1.1
Connection: Keep-Alive
User-Agent: Microsoft-WebDAV-MiniRedir/6.1.7601
Depth: 1
translate: f
Content-Length: 0
Host: devsys:4511

My response is:

HTTP/1.1 207 Multi-Status
Server: MyServer 2.12
Date: Mon, 08 Sep 14 17:57:50 -0000
Host: server.somewhere.com
Content-Type: text/xml; charset="utf-8"
Content-Length: 2901

<d:multistatus xmlns:d="DAV:">
  <d:response>
    <d:href>/public/container</d:href>
    <d:propstat>
      <d:prop>
        <d:creationdate>2014-09-05T19:00:00Z</d:creationdate>
        <d:displayname>container</d:displayname>
        <d:resourcetype>
          <d:collection/>
        </d:resourcetype>
        <d:supportedlock>
          <d:lockentry>
            <d:lockscope>
              <d:exclusive/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
          </d:lockentry>
          <d:lockentry>
            <d:lockscope>
              <d:shared/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
          </d:lockentry>
        </d:supportedlock>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/public/container/myFile1</d:href>
    <d:propstat>
      <d:prop>
        <d:getcontenttype>text/plain</d:getcontenttype>
        <d:getcontentlength>375</d:getcontentlength>
        <d:getetag>"1410198520"</d:getetag>
        <d:creationdate>2014-09-05T19:00:00Z</d:creationdate>
        <d:displayname>myFile1</d:displayname>
        <d:getlastmodified>05 Sep 2014 19:00:00 GMT</d:getlastmodified>
        <d:resourcetype/>
        <d:supportedlock>
          <d:lockentry>
            <d:lockscope>
              <d:exclusive/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
          </d:lockentry>
          <d:lockentry>
            <d:lockscope>
              <d:shared/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
          </d:lockentry>
        </d:supportedlock>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/public/container/myFile2</d:href>
    <d:propstat>
      <d:prop>
        <d:getcontenttype>text/plain</d:getcontenttype>
        <d:getcontentlength>375</d:getcontentlength>
        <d:getetag>"1410198523"</d:getetag>
        <d:creationdate>2014-09-05T19:00:00Z</d:creationdate>
        <d:displayname>myFile2</d:displayname>
        <d:getlastmodified>05 Sep 2014 19:00:00 GMT</d:getlastmodified>
        <d:resourcetype/>
        <d:supportedlock>
          <d:lockentry>
            <d:lockscope>
              <d:exclusive/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
          </d:lockentry>
          <d:lockentry>
            <d:lockscope>
              <d:shared/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
          </d:lockentry>
        </d:supportedlock>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Windows kindly gives the error \myserver\public\container is not accessible. You might not have permission to use this network resource. Contact the administrator of the server to find out if you have access permissions. The parameter is incorrect.

It doesn't seem to give a clue what parameter it might be nor why it is incorrect. Can anyone spot the glaring mistake? Have I missed a property that Windows needs or have I simply done something wrong?

The server is in C so I have byte level control over the response.

Thanks - Rog

Upvotes: 1

Views: 2658

Answers (2)

Terminologist
Terminologist

Reputation: 1003

After first removing most of the properties on the grounds that one of them was providing the 'incorrect parameter' then adding them back slowly, it seems that Windows didn't like the 'getlastmodified' date, which I had as:

05 Sep 2014 19:00:00 GMT

Changing it to:

Fri, 05 Sep 2014 19:00:00 GMT

Works lovely.

Thanks for all your help - it helped clean the code!

Upvotes: 3

Julian Reschke
Julian Reschke

Reputation: 42075

Recommendation: test with multiple clients (such as Cyberduck).

The PROPFIND response above is incorrect; it has "multistatus" in no namespace, but it should be in the "DAV:" namespace.

Upvotes: 2

Related Questions