Skip to content

Commit 585c4f9

Browse files
committed
---
yaml --- r: 77054 b: refs/heads/snap-stage3 c: 1860efb h: refs/heads/master v: v3
1 parent 5fd24a2 commit 585c4f9

File tree

3 files changed

+34
-38
lines changed

3 files changed

+34
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: f1132496dddbdd88f321a7919eec3d65136b3f75
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f51d30d7295507d5075a61d8bf9f17be8ad3fbe9
4+
refs/heads/snap-stage3: 1860efbfc62465ca096e67ee64ba9b2f71c5e1a8
55
refs/heads/try: ebfe63cd1c0b5d23f7ea60c69b4fde2e30cfd42a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/url.rs

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ impl Url {
6161
}
6262

6363
impl UserInfo {
64-
#[inline]
6564
pub fn new(user: ~str, pass: Option<~str>) -> UserInfo {
6665
UserInfo { user: user, pass: pass }
6766
}
@@ -461,14 +460,11 @@ fn get_authority(rawurl: &str) ->
461460
}
462461
InHost => {
463462
pos = i;
463+
// can't be sure whether this is an ipv6 address or a port
464464
if input == Unreserved {
465-
// must be port
466-
host = rawurl.slice(begin, i).to_owned();
467-
st = InPort;
468-
} else {
469-
// can't be sure whether this is an ipv6 address or a port
470-
st = Ip6Port;
465+
return Err(~"Illegal characters in authority.");
471466
}
467+
st = Ip6Port;
472468
}
473469
Ip6Port => {
474470
if input == Unreserved {
@@ -518,12 +514,25 @@ fn get_authority(rawurl: &str) ->
518514
}
519515
_ => ()
520516
}
517+
end = i;
521518
}
522519

520+
let end = end; // make end immutable so it can be captured
521+
522+
let host_is_end_plus_one: &fn() -> bool = || {
523+
let xs = ['?', '#', '/'];
524+
end+1 == len
525+
&& !xs.iter().any(|x| *x == (rawurl[end] as char))
526+
};
527+
523528
// finish up
524529
match st {
525530
Start => {
526-
host = rawurl.slice(begin, end).to_owned();
531+
if host_is_end_plus_one() {
532+
host = rawurl.slice(begin, end+1).to_owned();
533+
} else {
534+
host = rawurl.slice(begin, end).to_owned();
535+
}
527536
}
528537
PassHostPort | Ip6Port => {
529538
if input != Digit {
@@ -543,7 +552,8 @@ fn get_authority(rawurl: &str) ->
543552
}
544553
}
545554

546-
let rest = rawurl.slice(end, len).to_owned();
555+
let rest = if host_is_end_plus_one() { ~"" }
556+
else { rawurl.slice(end, len).to_owned() };
547557
return Ok((userinfo, host, port, rest));
548558
}
549559

@@ -796,17 +806,18 @@ mod tests {
796806
797807
#[test]
798808
fn test_url_parse() {
799-
let url = ~"http://user:[email protected]:8080/doc?s=v#something";
809+
let url = ~"http://user:[email protected]/doc?s=v#something";
800810

801811
let up = from_str(url);
802812
let u = up.unwrap();
803-
assert_eq!(&u.scheme, &~"http");
804-
assert_eq!(&u.user, &Some(UserInfo::new(~"user", Some(~"pass"))));
805-
assert_eq!(&u.host, &~"rust-lang.org");
806-
assert_eq!(&u.port, &Some(~"8080"));
807-
assert_eq!(&u.path, &~"/doc");
808-
assert_eq!(&u.query, &~[(~"s", ~"v")]);
809-
assert_eq!(&u.fragment, &Some(~"something"));
813+
assert!(u.scheme == ~"http");
814+
let userinfo = u.user.get_ref();
815+
assert!(userinfo.user == ~"user");
816+
assert!(userinfo.pass.get_ref() == &~"pass");
817+
assert!(u.host == ~"rust-lang.org");
818+
assert!(u.path == ~"/doc");
819+
assert!(u.query == ~[(~"s", ~"v")]);
820+
assert!(u.fragment.get_ref() == &~"something");
810821
}
811822
812823
#[test]
@@ -817,22 +828,6 @@ mod tests {
817828
assert!(url.path == ~"/");
818829
}
819830
820-
#[test]
821-
fn test_url_host_with_port() {
822-
let urlstr = ~"scheme://host:1234";
823-
let url = from_str(urlstr).unwrap();
824-
assert_eq!(&url.scheme, &~"scheme");
825-
assert_eq!(&url.host, &~"host");
826-
assert_eq!(&url.port, &Some(~"1234"));
827-
assert_eq!(&url.path, &~""); // is empty path really correct? Other tests think so
828-
let urlstr = ~"scheme://host:1234/";
829-
let url = from_str(urlstr).unwrap();
830-
assert_eq!(&url.scheme, &~"scheme");
831-
assert_eq!(&url.host, &~"host");
832-
assert_eq!(&url.port, &Some(~"1234"));
833-
assert_eq!(&url.path, &~"/");
834-
}
835-
836831
#[test]
837832
fn test_url_with_underscores() {
838833
let urlstr = ~"http://dotcom.com/file_name.html";

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,10 @@ pub fn link_binary(sess: Session,
822822
// In the future, FreeBSD will use clang as default compiler.
823823
// It would be flexible to use cc (system's default C compiler)
824824
// instead of hard-coded gcc.
825-
// For win32, there is no cc command,
826-
// so we add a condition to make it use gcc.
827-
let cc_prog: ~str = match sess.opts.linker {
825+
// For win32, there is no cc command, so we add a condition to make it use g++.
826+
// We use g++ rather than gcc because it automatically adds linker options required
827+
// for generation of dll modules that correctly register stack unwind tables.
828+
match sess.opts.linker {
828829
Some(ref linker) => linker.to_str(),
829830
None => match sess.targ_cfg.os {
830831
session::os_android =>
@@ -837,7 +838,7 @@ pub fn link_binary(sess: Session,
837838
(--android-cross-path)")
838839
}
839840
},
840-
session::os_win32 => ~"gcc",
841+
session::os_win32 => ~"g++",
841842
_ => ~"cc"
842843
}
843844
};

0 commit comments

Comments
 (0)