view tango/example/networking/homepage.d @ 358:051f5b550d9c trunk

[svn r379] Fix slice assigns of the form T[] = T when T is a typedef. Fixes run/a/array_initialization_20_B, D, F, H.
author ChristianK
date Mon, 14 Jul 2008 12:39:23 +0200
parents 1700239cab2e
children
line wrap: on
line source


private import  tango.io.Console;

private import  tango.net.http.HttpClient,
                tango.net.http.HttpHeaders;

/*******************************************************************************

        Shows how to use HttpClient to retrieve content from the D website
        
*******************************************************************************/

void main()
{
        auto client = new HttpClient (HttpClient.Get, "http://www.digitalmars.com/d/intro.html");

        // open the client and get the input stream
        auto input = client.open;
        scope (exit)
               client.close;
        
        // display returned content on console
        if (client.isResponseOK)
            Cout.stream.copy (input);
        else
           Cout ("failed to return the D home page");  

        // flush the console
        Cout.newline;
}