Changes between Version 4 and Version 5 of HomepageExample
- Timestamp:
- 08/13/07 18:40:51 (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
HomepageExample
v4 v5 23 23 24 24 void main() 25 { 25 { 26 26 auto client = new HttpClient (HttpClient.Get, "http://www.digitalmars.com/d/intro.html"); 27 client.open ();28 27 28 // open the client and get the input stream 29 auto input = client.open; 30 scope (exit) 31 client.close; 32 33 // display returned content on console 29 34 if (client.isResponseOK) 30 {31 // extract content length32 int length = client.getResponseHeaders.getInt (HttpHeader.ContentLength, int.max);35 Cout.stream.copy (input); 36 else 37 Cout ("failed to return the D home page"); 33 38 34 // display response 35 client.read (&Cout.consume, length); 36 Cout.newline; 37 } 38 else 39 Cout ("failed to return the D home page").newline; 40 41 client.close(); 39 // flush the console 40 Cout.newline; 42 41 } 43 42 }}}