Re: idHTTP problems (Indy 10 and Delphi 7 Ent)

Giganews Newsgroups
Subject: Re: idHTTP problems (Indy 10 and Delphi 7 Ent)
Posted by:  Remy Lebeau (Indy Team) (no.spam@no.spam.com)
Date: Wed, 7 Mar 2007

"Peter Maddin" <petermadd…@aapt.net.au> wrote in message
news:611CFA92901DE340petermadd…@aapt.net.au...

> I can no longer use the component to do additional  gets.
> I get an exception.

Please be more specific.  What does your code look like?  What
exception is being raised exactly?

> Also once I post a file to the server, it remains open and I
> cannot delete the local file just uploaded.

Are you freeing the TIdMultiPartFormDataStream?  The file is not
released until the cooresponding TIdFormDataField in the
TIdMultipartFormDataStream.FFields collection is freed.

>  From experimenting, if I use post to upload another file, I
> can then delete the previous local file.

Again, please show your actual code.

> Is there a way to force idHTTP to close the file.

Free the stream after posting it.

> Also I have a problem with using a get to trigger a file delete
> on the IIS server.  The server gets two get requests to delete
> the file. One of which suceeds and the other fails. I cannot see
> how this occurs.

The only way would be if the server is sending a redirect reply back
for the first request, or if authorization was needed.  Use a packet
sniffer, such as Ethereal, to verify that.

> I am considering creating an instance of IdHTTP just prior to each
get
> or post and freeing that instance after it has completed its task or
an
> exception has occured. This might well fix the most recently
uploaded
> file remaining open

TIdHTTP has nothing to do with the openness of the files being
uploaded.  That is all inside of TIdMultipartFormDataStream only.

> or getting two delete requests from what appears to be a single get
call.

Recreating the TIdHTTP object each time will not address that issue.
The only time TIdHTTP sends multiple requests is when the server tells
it to.

> 1. Use get to check the server is alive (returns simple web page)
> 2. Use get to return a list of files to be downloaded (returned as a
> simple page)

Why do step #1 at all?  You could just download your list directly and
check for any errors.

> Step 6 sometimes results in the get request being handled by
> two instances of the isapi dll (logging within this dll writes out
> the thread id of the isapi dll instance).

Like I said, a packet sniffer will tell you why that is happening.

> Step 7 A DeleteFile on the local acknowledgement file just posted
fails
> 100% of the time. Previously posted files can be deleted.

You are probably not freeing the TIdMultipartFormDataStream before
deleting the file, or are not giving the OS enough time to finish
fully releasing the file.

Gambit

Replies

In response to

idHTTP problems (Indy 10 and Delphi 7 Ent) posted by Peter Maddin on Wed, 07 Mar 2007