We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ddb85c4 + 00e46d7 commit 2bd2af1Copy full SHA for 2bd2af1
examples/client.rs
@@ -1,23 +1,28 @@
1
-#![feature(os, io)]
+#![feature(env, os, io)]
2
extern crate hyper;
3
4
-use std::os;
+use std::env;
5
use std::old_io::stdout;
6
use std::old_io::util::copy;
7
8
use hyper::Client;
9
10
fn main() {
11
- let args = os::args();
12
- match args.len() {
13
- 2 => (),
14
- _ => {
+ let url = match env::args().nth(1) {
+ Some(url) => url,
+ None => {
15
println!("Usage: client <url>");
16
return;
17
}
18
};
19
20
- let url = &*args[1];
+ let url = match url.to_str() {
21
22
+ println!("Url contains invalid unicode");
23
+ return;
24
+ }
25
+ };
26
27
let mut client = Client::new();
28
0 commit comments