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: | "Francois Piette [ICS & Midware]" (francois.piet..@overbyte.be) |
| Date: | Tue, 27 Jun 2006 11:56:37 |
> > > 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.