[fpc-pascal] Download file

Paul Davidson pdavidson at coraxnetworks.com
Thu Nov 17 22:55:05 CET 2005


The silly answer.  Construct an HTTP message according to IETF/W3C 
rules.

Better answer.  Assuming you have a socket connection open, the 
following should be included
in your message:

HTTP/1.0 200<crlf>
Connection: Close<crlf>
Content-length:<number of byte in Content: below, as ASCII string>
Content-type:<text/ascii, or something similar><crlf>
MIME-version:1.0<crlf>
<crlf>
<content>

The above should be in single string.
<crlf> means carriage return/line feed, or ASCII chars 10 and 13.
Content-type is important.  text/ASCII will work in most situations. 
Otherwise see MIME standards at http://www.ietf.org for more details.
Please note that is extra <crlf> after text headers.  This is to 
indicate that what follows is the data you want to transmit.

There are many other fields that can be added, depending on who is at 
other end of connection, but the ones above should work in most 
situation.  This is NOT ACID compliant.

See http://www.w3.org/Protocols/ for more details on HTTP.

On Nov 17, 2005, at 16:18, dhkblaszyk at zeelandnet.nl wrote:

> Question:
> I would like to download a file via HTTP, how can I achieve that in a
> platform independent way? What components to use and is there some code
> suited for dummy's available.
>
> Darius
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
P Davidson
Corax Networks Inc.
http://CoraxNetworks.com




More information about the fpc-pascal mailing list