[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

library for http/ftp requests

A.Leopold

12/4/2008 10:57:00 AM

hi,

which is a good library to work with
to enable downloading files / http pages in my project?

thanks,

leo
13 Answers

Sam

12/4/2008 12:02:00 PM

0

A.Leopold writes:

> hi,
>
> which is a good library to work with
> to enable downloading files / http pages in my project?

The only one I know of is W3C's libwww, but it's very old and is not
actively maintained.

However, http is not rocket science. Neither is ftp. Both are fairly simple
protocols to implement from the client side. If you start now, by this time
tomorrow you should have a bare-bones, but a working http and ftp client
code that you can proceed with.

maverik

12/4/2008 12:05:00 PM

0

On Dec 4, 1:57 pm, "A.Leopold" <andreas.leop...@himt.de> wrote:
> hi,
>
> which is a good library to work with
> to enable downloading files / http pages in my project?

There is no library (as a part of the C++ language or C++ standard)
that provide files / http pages / ... downloading.

Thomas J. Gritzan

12/4/2008 12:32:00 PM

0

Sam schrieb:
> A.Leopold writes:
>
>> hi,
>>
>> which is a good library to work with
>> to enable downloading files / http pages in my project?
>
> The only one I know of is W3C's libwww, but it's very old and is not
> actively maintained.

There's curl / libcurl, which is easy to use and seems to be actively
maintained.

--
Thomas

Sana

12/4/2008 2:12:00 PM

0

On Dec 4, 5:57 am, "A.Leopold" <andreas.leop...@himt.de> wrote:
> hi,
>
> which is a good library to work with
> to enable downloading files / http pages in my project?
>
> thanks,
>
> leo

I used POCO C++ libraries in the past.
http://pocopr...

/sana

sean_in_raleigh

12/4/2008 3:22:00 PM

0

On Dec 4, 7:32 am, "Thomas J. Gritzan" <phygon_antis...@gmx.de> wrote:
> There's curl / libcurl, which is easy to use and seems to be actively
> maintained.

There's also a C++ binding for libcurl:

http://rrette.com/textpattern/index.ph...

Sean

jason.cipriani@gmail.com

12/4/2008 10:32:00 PM

0

On Dec 4, 5:57 am, "A.Leopold" <andreas.leop...@himt.de> wrote:
> hi,
>
> which is a good library to work with
> to enable downloading files / http pages in my project?

I'm personally a big fan of curl. However, if you check out this page:

http://curl.haxx.se/libcurl/compet...

It contains a good list of alternatives. Of course the list is a bit
biased towards curl, but just ignore the spin. I do like curl though.
Releases are available for many platforms on their download page:

http://curl.haxx.se/dow...

Also you may have platform-specific options. For example, if you are
using C++ Builder (or RAD Studio), the VCL comes with some HTTP client
components. If ActiveX is an option, google for "activex http client",
a number of components come up.

HTH,
Jason

jason.cipriani@gmail.com

12/4/2008 10:36:00 PM

0

On Dec 4, 7:01 am, Sam <s...@email-scan.com> wrote:
> A.Leopold writes:
> > hi,
>
> > which is a good library to work with
> > to enable downloading files / http pages in my project?
>
> The only one I know of is W3C's libwww, but it's very old and is not
> actively maintained.
>
> However, http is not rocket science. Neither is ftp. Both are fairly simple
> protocols to implement from the client side. If you start now, by this time
> tomorrow you should have a bare-bones, but a working http and ftp client
> code that you can proceed with.

There are enough actively maintained and functional HTTP clients, with
support for non-trivial features such as compression, SSL, etc., out
there that reinventing the wheel here is not a good solution.

And while it may not be rocket science, per se, if you want to make a
conforming client, you have a 176-page standard to work through:

ftp://ftp.rfc-editor.org/in-notes/r...

Jason

Sam

12/4/2008 11:32:00 PM

0

jason.cipriani@gmail.com writes:

> And while it may not be rocket science, per se, if you want to make a
> conforming client, you have a 176-page standard to work through:
>
> ftp://ftp.rfc-editor.org/in-notes/r...

If all you need is a way to grab a document given its URL, using HTTP, you
do not need to waste time coding support for byte ranges, chunked encoding,
or 95% of the stuff described in that document. A basic, no-frills HTTP
client can be easily coded in a few dozen lines of code. Connect, GET,
Host:, blank line, read the response status, check the status code, read
until the first non-blank line, then keep reading your document until the
socket closes. Will work with any compliant HTTP server.


A.Leopold

12/5/2008 9:20:00 AM

0

dear all,

many thanks for the tips!

// leo



A.Leopold schrieb:
> hi,
>
> which is a good library to work with
> to enable downloading files / http pages in my project?
>
> thanks,
>
> leo

jason.cipriani@gmail.com

12/5/2008 6:33:00 PM

0

On Dec 4, 6:31 pm, Sam <s...@email-scan.com> wrote:
> jason.cipri...@gmail.com writes:
> > And while it may not be rocket science, per se, if you want to make a
> > conforming client, you have a 176-page standard to work through:
>
> >  ftp://ftp.rfc-editor.org/in-notes/r...
>
> If all you need is a way to grab a document given its URL, using HTTP, you
> do not need to waste time coding support for byte ranges, chunked encoding,
> or 95% of the stuff described in that document.

That's incorrect if the URL is arbitrary, of course. You *could* leave
out all of those feature if, say, you had full control over the HTTP
server, or you were able to safely make assumptions about how the
server will deliver a response (or if it does not matter if those
assumptions don't hold). Even then, grabbing curl and using it gives
you a full featured HTTP client in *less* than a few dozen lines of
code, and you don't have to have any knowledge of networking, etc, to
do it (e.g. perhaps *you* don't have a problem putting that together,
but there is a level of knowledge required when reinventing wheels
that isn't required when using code that somebody else is responsible
for). That's certainly more desirable than a client you've hacked
together, and probably poorly in haste.

In any case, the OP was specifically looking for a library to solve
the problem, advising a programmer to use their own poor
reimplementation of something that's been done dozens of times already
and maintained by a community of other programmers is never good
advice.

Jason

> A basic, no-frills HTTP
> client can be easily coded in a few dozen lines of code. Connect, GET,
> Host:, blank line, read the response status, check the status code, read
> until the first non-blank line, then keep reading your document until the
> socket closes. Will work with any compliant HTTP server.
>
>  application_pgp-signature_part
> < 1KViewDownload