On 11/03/11 17.33, Vladimir Panteleev wrote:
On Fri, 11 Mar 2011 17:20:38 +0200, Jonas Drewsen <jdrew...@nospam.com>
wrote:

writeln( Http.get("http://www.google.com";).content );

Does this return a string? What if the page's encoding isn't UTF-8?

Data should probably be returned as void[], similar to std.file.read.

Currently it returns a string, but should probably return void[] as you suggest.

Maybe the interface should be something like this to support misc. encodings (like the std.file.readText does):

class Http {
        struct Result(S) {
                S content;
                ...
        }
        static Result!S get(S = void[])(in string url);
        
}

Actually I just took a look at Andrei's std.stream2 suggestion and Http/Ftp... Transports would be pretty neat to have as well for reading formatted data.

I'll follow the newly spawned "Stream proposal" thread on this one :)

/Jonas

Reply via email to