Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: check if a file accessible on a web server
| Subject: | Re: check if a file accessible on a web server |
| Posted by: | "York" (offi..@onlinebg.info) |
| Date: | Tue, 27 Jun 2006 13:08:02 |
Thanks Francois,
Now I have quite a wider understanding of most of the possible cases.
Having read what you decribed I think the "head" approach will work for me
because I put these files there and they are quite specific and the mime
type is also specific (It is a custom one). The files are not actually zip
but other custom ones. And finally I have control over the web server and I
put these files there but just wanted to make sure they are available.
Thanks a lot.
"Francois Piette [ICS & Midware]" <francois.piette@overbyte.be> wrote in
message news:44a10015@newsgroups.borland.com...
> > > > I wonder if this is a good way to check if a file is accessible on a
> web
> > > > server without getting it.
>
> > > The HEAD command will work with all static documents. But with some
> > > servers and dynamic documents, it doesn't work.
>
> > What I am actually trying to accomplish is to check if a specific file
of
> > type ".exe" or ".zip" is located
> > on the server. So I think this is going to work in this case, right?
>
> Seapking HTTP or "webserver", there is concept of a file. Only document.
> Even when your URL end with blablabla.zip, nothing in the HTTP say it is a
> zip file which will be sent by the server. And even nothing say it will be
a
> static file stored somewhere. Altough not usually done because of
confusion,
> nothing prevent the server to send back a HTML file (Side note: the HTTP
> request sent by the browser or HTTP component may include mime types which
> are accepted in the response, so the server may not be allowed to send
> html).
>
> Back to your URL ending with what looks like a zip file name: it is well
> possible that this URL is processed by a script (PHI, CGI, ISAPI, ASP,...)
> at server size which will dynbamically build your document (not your file
!
> Your document).
>
> When a server side script execute your request, i may happend that the
head
> command doesn't work. It depends on the scripting system implementation.
And
> if it works, it is likely that at server side the complete document is
> retrieved but only the answer header is sent back.
>
> This being said, most of the time and url ending with something like a zip
> file name (or othe file type) is simply mapped to a static file on the
> server and you'll have the head command work as expected.
>
> Sorry for my bad english... Hope my explanations are clear.
>
> --
> francois.piette@overbyte.be
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be