cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Locking a file on the Http Server

From: <man_at_tfhs.net>
Date: Fri, 24 Jun 2005 18:58:10 -0000

be careful with this type of solution. you need to make sure that the file
locks will be released if something bad happens to the first cgi program.

a better solution is perhaps to do locking or transactions in a database,
instead of on disk.

allan

On Fri, Jun 24, 2005, Ralph Mitchell <ralphmitchell_at_gmail.com> said:

> Off-hand I'd say you could set up a page or cgi-script on the server
> so that client A could fetch or post to that page/script, which would
> then create a lock file on the server. Client A grabs the file, does
> stuff, uploads it, whatever. When finished, client A posts/gets the
> unlock page. In the mean time, any other client trying to access the
> lock script/page gets a "busy signal" or spins until timing out.
> Lather, rinse, repeat, until client A releases the lock, at which time
> some other client finally gets access to the lock page.
>
> All server-side, where the file resides. I think that's the only way
> to go. The only curl involvement would be standard posting/getting
> pages. The tricky stuff would be server side in whatever language you
> care to use.
>
> Ralph Mitchell
>
>
> On 6/24/05, Haber, Orna <Orna.Haber_at_ca.com> wrote:
>>
>> The purpose behind the locking need is to avoid situation where more
>> than one client is try to modify the same file (at the same time).
>> Because of the file (sensitive) contents, it is important to wait until
>> one client finish updating the file before another client starts
>> updating it.
>> What is the best way to provide this locking (since curl is not the
>> answer)?
>> Thanks,
>> Orna
>>
>> -----Original Message-----
>> From: curl-library-bounces_at_cool.haxx.se
>> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Dan Fandrich
>> Sent: Friday, June 24, 2005 11:03 AM
>> To: libcurl development
>> Subject: Re: Locking a file on the Http Server
>>
>> On Fri, Jun 24, 2005 at 01:07:22PM -0400, Haber, Orna wrote:
>> > Yes. You got this right.
>> > My thought about using a shared object and provide a lock-function in
>> > order to create a cookie on the server machine or create a
>> > "lock"-key-value in the server's registry (DNS cache).
>> > Of course I have the problem of using the same shared object by
>> > processes running on different machines..(:-)
>> >
>> > -----Original Message-----
>> > From: curl-library-bounces_at_cool.haxx.se
>> > [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Ralph Mitchell
>> > Sent: Thursday, June 23, 2005 8:07 PM
>> > To: libcurl development
>> > Subject: Re: Locking a file on the Http Server
>> >
>> > Let me see if I got this straight - there's a file on a web server,
>> > and it's being access from multiple different clients. You want to
>> > lock it so that it can only be accessed by one client at a time. Is
>> > that right??
>> >
>> > If so, it sounds like something the web server needs to handle. The
>> > curl instances on different machine won't have a clue about locks on
>> > other machines.
>>
>> Is this really the requirement? I don't know what you're trying to do
>> with
>> this, but you must understand the potential for one requester to cause a
>> denial of service for the others. If you just want to modify a file
>> while
>> clients are downloading, it can be easily done on a *NIX server without
>> disrupting other clients from accessing the old version at the same
>> time.
>> If you're just trying to create a globally-unique value for each client,
>> there are ways of doing that without blocking, too. In any case, as
>> Ralph
>> has said, none of this involves curl.
>>
>> >>> Dan
>> --
>> http://www.MoveAnnouncer.com The web change of address
>> service
>> Let webmasters know that your web site has moved
>>
>>
>>
>>
>
>

-- 
Received on 2005-06-24