You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Jean-Philippe Courson <co...@noos.fr> on 2002/01/17 12:09:45 UTC

UserQuota : Webfolders and PUT method

Hi,



Webfolders seems to have a nasty way of doing PUT requests :


The context :

Here is what you can see in webdav_access_log :

"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 404 607
"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 201
"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
"HEAD /b2web/jumal/private/NSTALL.TXT HTTP/1.1" 200 -

Adding some debug code, I realized that webfolders were
-> firstly doing a PUT request to create an empty file
    (contentLength was defined but equal to 0)
-> only then performing a PUT request with the file's content.

I'm pretty sure of this behaviour. The only thing I can't really
understand is why second PUT returns 204 ? Are log writtings
synchronized ?


Implications :

When we receive a PUT request that would exhaust user quota :
-> the first PUT request is accepted (contentLength is ok)
-> the second one is rejected (contentLength is too big)


Result :

All refused upload requests are ending by an empty file creation.
And you can even lost a file that was having the same name but was
ligther.


Does anybody have ideas on how we could avoid these problems ?


JP


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: UserQuota supported !

Posted by Dirk Verbeeck <di...@pandora.be>.
Hi JP

Will need some more time to look at this.
I'll also do some testing on the webfolders issue.
What version are you using ?


Dirk



Jean-Philippe Courson wrote:
> You will find enclosed UserQuotaContentInterceptor implementation.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


UserQuota supported !

Posted by Jean-Philippe Courson <co...@noos.fr>.
Hi,

You will find enclosed UserQuotaContentInterceptor implementation.

There are 2 new files :

org.apache.slide.content.UserQuotaContentInterceptor.java
Quota Interceptor class

org.apache.slide.content.InsufficientStorageException.java
The exception it raises

And I've patched 5 others files :

org.apache.slide.webdav.method.WebdavMethod.java
Added InsufficientStorageException processing
(returns SC_INSUFFICIENT_STORAGE (507) status code)

org.apache.slide.content.ContentInterceptor.java
Made it abstract.
Added postRemoveContent method
Added some exceptions to throws clause

org.apache.slide.common.Content.java
Added InsufficientStorageExceptions to some throws clause

org.apache.slide.common.ContentImpl.java
Added postRemoveContent constant and calls.
Added some exceptions to throws clause
Added some revisionDescriptor(s) retreiving before calls
to invokeContentInterceptors()

org.apache.slide.common.XMLUnmarshaler.java
Added two InsufficientStorageException catchs


Usage guide :

Add to the <namespace><configuration> part of Domain.xml file :

<content-interceptor 
class="org.apache.slide.content.UserQuotaContentInterceptor"/>
<parameter name="allowUnknownSizeContent">false</parameter>
<parameter name="allowQuotaToBeExceeded">false</parameter>

This contentInterceptor has 2 parameters :
1) allowUnknownSizeContent :
    Allows to process requests with null contentLength header
2) allowQuotaToBeExceeded :
    If set to true : Allow users to exceed their quota with ONE file.
    If set to false : Do not allow users to exceed their quota at all.
                 This implies empty files creation when quota is exceeded
                 (See my email : UserQuota : Webfolders and PUT method).

User quota MUST be a protected property of the users's node (need to be 
done during user creation).

User should have write permission on its own node.


Improvements :

How could I add my 2 parameters to <content-interceptor> tag rather than
putting them as namespace parameters ?

Would it be possible to retreive these parameters without having to pass 
   a NamespaceConfig object as arguments to pre/post methods ?

If not, would it be possible to add this object to contentInterceptor
constructor ?

Is there a may to avoid to pass to pre/post methods the contentHelper as
argument ?

Finally, what could be done better than it is in my code ?


All remarks are welcome


JP

Re: UserQuota : Webfolders and PUT method

Posted by Torgeir Veimo <to...@vertech.no>.
Jean-Philippe Courson wrote:
> Hi,
> 
> 
> 
> Webfolders seems to have a nasty way of doing PUT requests :
> 
> 
> The context :
> 
> Here is what you can see in webdav_access_log :
> 
> "HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 404 607
> "PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 201
> "HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
> "PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
> "HEAD /b2web/jumal/private/NSTALL.TXT HTTP/1.1" 200 -
> 
> Adding some debug code, I realized that webfolders were
> -> firstly doing a PUT request to create an empty file
>    (contentLength was defined but equal to 0)
> -> only then performing a PUT request with the file's content.
> 
> I'm pretty sure of this behaviour. The only thing I can't really
> understand is why second PUT returns 204 ? Are log writtings
> synchronized ?
> 
> 
> Implications :
> 
> When we receive a PUT request that would exhaust user quota :
> -> the first PUT request is accepted (contentLength is ok)
> -> the second one is rejected (contentLength is too big)
> 
> 
> Result :
> 
> All refused upload requests are ending by an empty file creation.
> And you can even lost a file that was having the same name but was
> ligther.
> 
> 
> Does anybody have ideas on how we could avoid these problems ?

A workaround would be not to deny the write at the point the user 
exceeds his quota, but on the next put. You'd do this by setting a 
exceeded_quota flag when exceeding, and check this flag on the next put.



-- 
-Torgeir


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: UserQuota : Webfolders and PUT method

Posted by Remy Maucherat <re...@apache.org>.
> Hi,
> Here is what you can see in webdav_access_log :
>
> "HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 404 607
> "PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 201
> "HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
> "PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
> "HEAD /b2web/jumal/private/NSTALL.TXT HTTP/1.1" 200 -
>
> Adding some debug code, I realized that webfolders were
> -> firstly doing a PUT request to create an empty file
>     (contentLength was defined but equal to 0)
> -> only then performing a PUT request with the file's content.
>
> I'm pretty sure of this behaviour. The only thing I can't really
> understand is why second PUT returns 204 ? Are log writtings
> synchronized ?

If the resource already exists, PUT returns 204 as the success code.
Otherwise, it's 201 (created).

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: UserQuota : Webfolders and PUT method

Posted by Jean-Philippe Courson <co...@noos.fr>.
>>Hi,
>>
>>
>>
>>Webfolders seems to have a nasty way of doing PUT requests :
>>
>>
>>The context :
>>
>>Here is what you can see in webdav_access_log :
>>
>>"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 404 607
>>"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 201
>>"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
>>"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
>>"HEAD /b2web/jumal/private/NSTALL.TXT HTTP/1.1" 200 -
>>
>>Adding some debug code, I realized that webfolders were
>>-> firstly doing a PUT request to create an empty file
>>   (contentLength was defined but equal to 0)
>>-> only then performing a PUT request with the file's content.
>>
>>I'm pretty sure of this behaviour. The only thing I can't really
>>understand is why second PUT returns 204 ? Are log writtings
>>synchronized ?
>>
>>
>>Implications :
>>
>>When we receive a PUT request that would exhaust user quota :
>>-> the first PUT request is accepted (contentLength is ok)
>>-> the second one is rejected (contentLength is too big)
>>
>>
>>Result :
>>
>>All refused upload requests are ending by an empty file creation.
>>And you can even lost a file that was having the same name but was
>>ligther.
>>
> 
> waitaminute. if the first HEAD request doesn't return 404 but rather 
> 200/204 (i.e. a resource does already exist at the requested URI), 
> does web-folders STILL create an empty file ??


I've not checked contentLength headers but there are 2 PUT requests in

this case too.

Here is what you can see in webdav_access_log :

"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
"PROPFIND /b2web/jumal/private/INSTALL.TXT HTTP/1.1" "PUT 
/b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -


> if yes, that would be very evil IMHO. imagine a webdav-server with 
> auto-versioning. you'd get one extra revision (the empty file) for 
> every actual change made.


Effectivelly :-(

I am using webfolders version that is included with IE5. I don't know
if this behaviour has been changed later or with window$ XP

JP

 
> -chris
> ________________________________________________________________
> cmlenz at gmx.de



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: UserQuota : Webfolders and PUT method

Posted by Christopher Lenz <cm...@gmx.de>.
17.01.2002 12:09:45, Jean-Philippe Courson <co...@noos.fr> wrote:

>Hi,
>
>
>
>Webfolders seems to have a nasty way of doing PUT requests :
>
>
>The context :
>
>Here is what you can see in webdav_access_log :
>
>"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 404 607
>"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 201
>"HEAD /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 200 -
>"PUT /b2web/jumal/private/INSTALL.TXT HTTP/1.1" 204 -
>"HEAD /b2web/jumal/private/NSTALL.TXT HTTP/1.1" 200 -
>
>Adding some debug code, I realized that webfolders were
>-> firstly doing a PUT request to create an empty file
>    (contentLength was defined but equal to 0)
>-> only then performing a PUT request with the file's content.
>
>I'm pretty sure of this behaviour. The only thing I can't really
>understand is why second PUT returns 204 ? Are log writtings
>synchronized ?
>
>
>Implications :
>
>When we receive a PUT request that would exhaust user quota :
>-> the first PUT request is accepted (contentLength is ok)
>-> the second one is rejected (contentLength is too big)
>
>
>Result :
>
>All refused upload requests are ending by an empty file creation.
>And you can even lost a file that was having the same name but was
>ligther.

waitaminute. if the first HEAD request doesn't return 404 but rather 
200/204 (i.e. a resource does already exist at the requested URI), 
does web-folders STILL create an empty file ??

if yes, that would be very evil IMHO. imagine a webdav-server with 
auto-versioning. you'd get one extra revision (the empty file) for 
every actual change made.

>
>
>Does anybody have ideas on how we could avoid these problems ?
>
>
>JP
>
>
>--
>To unsubscribe, e-mail:   <mailto:slide-dev-
unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:slide-dev-
help@jakarta.apache.org>
>
>

-chris
________________________________________________________________
cmlenz at gmx.de



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>