locked
WebDAV: Forcing Time-out value for the Lock RRS feed

  • Question

  • User2147142726 posted

    Is there a way to force/set/override value of the time-out for locks in the WebDAV?

    I have found that the lock timeout is set by the client and it can be set to infinite.

    If the client do not release/unlock locked resource then it will remain locked until w3wp process is restarted.

    This is exactly what I am trying to avoid. Is it possible to set value for the time-out (for locks) on the server side?

    Tuesday, January 25, 2011 5:57 AM

Answers

  • User1138193213 posted

    Unfortunately, no - there is no option to configure the lock timeout. The only lock provider that we ship with IIS is "webdav_simple_lock," which is a simple lock implementation with no configurable options.

    However - it should be possible for you to override the lock provider by writing an HTTP module that inspects incoming LOCK requests and returns an error when the value is not within your defined parameters. That being said, I'm not sure if you would simply return an HTTP 200 response indicating that you ignored the request, or an HTTP 412 error stating that the request failed because one of the parameters is incorrect, or an HTTP 403 error, or something else. You'd have to check the WebDAV RFC for that.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, January 25, 2011 2:08 PM
  • User1138193213 posted

    You can't create a lock provider for the WebDAV module - there are no extensibility interfaces to do so.

    What you can do is one of the following, in order from easiest to the most difficult:

    • You can configure your application pool recycling in such a way that infinite LOCK requests are irrelevant.
    • You can write your own HTTP module that simply inspects incoming LOCK requests and rejects what it does not find acceptable.
    • You can write your own LOCK handler. This would be an HTTP module that handles all LOCK/UNLOCK requests. This is not advisable because the scope of the module would be quite large, and off the top of my head I'm not sure how that would work with the other built-in WebDAV commands to which you can pass a lock token, such as the MOVE command.

    Those are the only ideas that I would consider viable options. You could write your own WebDAV module, but this is discouraged because the scope of the module would be huge, and you would need to find a way to integrate your WebDAV module into the request filtering architecture.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, January 26, 2011 3:04 PM

All replies

  • User2147142726 posted

     Recently, I have found following discussion http://forums.iis.net/p/1165488/1936198.aspx#1936198 where Robert McMurray replied

    ... in your original question you asked if there was a way to configure a timeout on the server, and there isn't. But that said, the server will attempt to honor the timeout that the client has requested ...

     and this was 2010-03-04 06:52, is this has been changed since?

    I am looking for a way to override/limit (or if nothing else is possible to reject) lock requests if they do not have acceptable timeout value.

    Tuesday, January 25, 2011 7:33 AM
  • User1138193213 posted

    Unfortunately, no - there is no option to configure the lock timeout. The only lock provider that we ship with IIS is "webdav_simple_lock," which is a simple lock implementation with no configurable options.

    However - it should be possible for you to override the lock provider by writing an HTTP module that inspects incoming LOCK requests and returns an error when the value is not within your defined parameters. That being said, I'm not sure if you would simply return an HTTP 200 response indicating that you ignored the request, or an HTTP 412 error stating that the request failed because one of the parameters is incorrect, or an HTTP 403 error, or something else. You'd have to check the WebDAV RFC for that.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, January 25, 2011 2:08 PM
  • User2147142726 posted

     Thank You for your response.

    I would like to read more about the lock providers to investigate option of writing custom lock provider, could you please direct me to some articles about it?

    For now I am narrowing list of the client application which will use WebDAV folders to investigate configuration options for them so they will never request lock with the infinite timeout.

    Thank You again. 

    Wednesday, January 26, 2011 11:15 AM
  • User1138193213 posted

    You can't create a lock provider for the WebDAV module - there are no extensibility interfaces to do so.

    What you can do is one of the following, in order from easiest to the most difficult:

    • You can configure your application pool recycling in such a way that infinite LOCK requests are irrelevant.
    • You can write your own HTTP module that simply inspects incoming LOCK requests and rejects what it does not find acceptable.
    • You can write your own LOCK handler. This would be an HTTP module that handles all LOCK/UNLOCK requests. This is not advisable because the scope of the module would be quite large, and off the top of my head I'm not sure how that would work with the other built-in WebDAV commands to which you can pass a lock token, such as the MOVE command.

    Those are the only ideas that I would consider viable options. You could write your own WebDAV module, but this is discouraged because the scope of the module would be huge, and you would need to find a way to integrate your WebDAV module into the request filtering architecture.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, January 26, 2011 3:04 PM
  • User2147142726 posted

     Hello again and thank you for complete answer.

    As you have already sad there are several ways to achieve prevention/control of lock requests with undesired timeout values.

    In my case the first one ( ... configure application pool for recycling ... ) does not match my needs due to the fact that two users may request a document trough WebDAV at the same time with desire to change-it. One of them will get the lock while other may choose to open document and wait for the document to be released. If the the one which acquired lock does not release it like expected then the file will not be available for changing and the recycling will not take place (at least one user is connected and restarting will destroy its session, etc.)

     The second one ( ... HTTP module that simply inspects incoming LOCK requests  ... ) sounds more appropriate and it requires more effort (some references/projects/code samples would be great, but not to be too greedy this information is very useful too)

    The third one (... write your own LOCK handler ...) is not impossible, I guess, but it is to currently to distant for me.

    Thank you again, yours instructions where very helpful.

    Best Regards.

    Thursday, January 27, 2011 3:42 AM