On 4/27/2009 5:14 PM, Unknown W. Brackets wrote:
If you want both HTTP and FTP, it's definitely worth using a library for
it. There are a lot of options, but almost all of them are out of date I
suppose for 2.x...

I've always hated curl, but you might look at how hard it is to get/make
d headers for it. This might work fine for you.

Apparently Kenneth Bogert did some work on curl a while back. cURL happens to host it on their site so I'll give it a shot.

HTTP is relatively easy. You can see a sample in
dmd/samples/d/htmlget.d. This isn't exactly a right example, because it
completely ignores Transfer-Encoding, but if you search and replace
HTTP/1.1 with HTTP/1.0, it should be usable.... although the check for
</html> is an ugly hack and 100% wrong.

I'll take a look at it. I'm sure there is something there worth learning.

FTP is more work. You have to send and receive commands, so it's slower.
It's also worth maintaining state if you download more than one file
from the same server.

I have a library that does it, but unfortunately it's for 1.x. I'm
planning to update it, but I won't be able to for a little while. I
could explain what you need to do if you want to mess with the socket
stuff...

I'm virtually hopeless when it comes to these things so will happily accept assistance in whatever form I can get it. If you are willing to explain I will graciously accept the lesson.

But again, it's complicated enough it's not a good idea to do it
yourself imho unless you like reading RFCs (I do, but I'm a strange one.)

Can't say I have much fondness for RFCs but over time that might change. As for being a strange one... well I'm as strange as they come so I will not be passing judgment anytime soon.

-[Unknown]

Reply via email to