ReceiveHTTPFile to memory, HTTP and HTTPS support

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
greyhoundcode
Enthusiast
Enthusiast
Posts: 112
Joined: Sun Dec 30, 2007 7:24 pm

ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by greyhoundcode »

I suspect I might be a lone voice so far as this request goes - but who knows? If I don't post it then we'll never know ...

Is there the possibility of adapting ReceiveHTTPFile() (or augmenting it with a related procedure) so that we can stream the file into a block of memory rather than saving it directly to disk?

Even better, with support for secure connections. Would this benefit anyone else?
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by Seymour Clufley »

It would benefit me. For example, loading an image from the Internet could be done with that command and then CatchImage().
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
jamirokwai
Enthusiast
Enthusiast
Posts: 796
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by jamirokwai »

Hi greyhoundcode,

+1

Yes... It'd be a great function.
Regards,
JamiroKwai
kandl
User
User
Posts: 11
Joined: Sat Apr 11, 2009 6:54 am

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by kandl »

you can do that with curl

http://www.megaupload.com/?d=P020OM3A
jamirokwai
Enthusiast
Enthusiast
Posts: 796
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by jamirokwai »

kandl wrote:you can do that with curl

http://www.megaupload.com/?d=P020OM3A
Hi kandl,

most probably, yes... :-)
I did find the libcurl on my mac (/usr/lib/libcurl.dylib), but can't try your example because of some windows-specific-things.

All in all, it would be great to have a native ReceiveHTTPFile to memory like suggested! And HTTPS/SSL throughout whole PB :P
Regards,
JamiroKwai
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by USCode »

jamirokwai wrote:All in all, it would be great to have a native ReceiveHTTPFile to memory like suggested! And HTTPS/SSL throughout whole PB :P
I'm glad you suggested the ReceiveHTTPFile to memory feature, I was thinking the exact same thing awhile back would be handy for security reasons.
I suspect the SSL thing is already on Fred/Freak's to-do list but not sure where it's at on that list, priority-wise ...
User avatar
greyhoundcode
Enthusiast
Enthusiast
Posts: 112
Joined: Sun Dec 30, 2007 7:24 pm

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by greyhoundcode »

There are some useful snippets on the forum that achieve pretty much what I have requested but where they are either Windows specific or if they are x-platform do not offer HTTPS support. Still great bits of code though, and all credit to the guys who took the time to write and share them. For instance see this thread:

http://www.purebasic.fr/english/viewtopic.php?t=24101&postdays=0&postorder=asc&start=0

Ace work, but I would still feel happier and more confident with something that is a de facto part of the Pure Basic language.

For what it's worth, just my twopence worth and all that, but apps increasingly tend to be - and perhaps need to be - "connected". Stuff like this is easy in C# which of course sits atop the .Net framework, and I'm sure the appeal for so many of us here is PB's compactness as compared to massive libraries like that, but, anyway, hope this request might be considered.

Cheers,

Greyhound
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by DoubleDutch »

It would be handy to also have proxy support to all the new network libs (http, ftp and mail).
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
greyhoundcode
Enthusiast
Enthusiast
Posts: 112
Joined: Sun Dec 30, 2007 7:24 pm

Re: ReceiveHTTPFile to memory, HTTP and HTTPS support

Post by greyhoundcode »

Something I enjoy in PHP (very different language I know) is that files can be opened not just when they are on the local file system but via any supported protocols/wrappers - HTTP(S), FTP(S) and the list goes on. Best of all, you can register your own stream wrapper if you are inclined to add support for some other method.

Only mentioning it as an illustration of what works in other languages - certainly not saying, "This is how it should be done," or anything like that.
jamirokwai wrote:
kandl wrote:you can do that with curl http://www.megaupload.com/?d=P020OM3A
...I did find the libcurl on my mac (/usr/lib/libcurl.dylib), but can't try your example because of some windows-specific-things. All in all, it would be great to have a native ReceiveHTTPFile to memory like suggested! And HTTPS/SSL throughout whole PB :P
:)
Post Reply