Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix string addition for latest nightly. #2

Merged
merged 2 commits into from
Dec 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/util/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl HeaderCollection {
match self.map.insert(lowercase.to_string(), value.to_string()) {
Some(old_value) => {
//Append if there's already a value
self.map.insert(lowercase.to_string(), old_value + ", ".to_string() + value.to_string());
self.map.insert(lowercase.to_string(), old_value.to_string() + ", " + value.to_string().as_slice());
}
None => { }
}
Expand Down
10 changes: 5 additions & 5 deletions src/ws/handshake/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ impl WebSocketRequest {
_ => { return Err(ParseError::InvalidScheme); }
}

let host = match ws_uri.serialize_host() {
Some(host) => { host }
let host : String = match ws_uri.serialize_host() {
Some(host) => { host.to_string() }
None => { return Err(ParseError::InvalidCharacter); }
} + match ws_uri.port_or_default() {
Some(port) => { ":".to_string() + port.to_string() }
Some(port) => { ":".to_string() + port.to_string().as_slice() }
None => { return Err(ParseError::InvalidCharacter); }
};
}.as_slice();

let resource_name = match ws_uri.serialize_path() {
Some(resource_name) => {
Expand Down Expand Up @@ -223,7 +223,7 @@ pub trait WriteWebSocketRequest {

impl<W: Writer> WriteWebSocketRequest for W {
fn write_websocket_request(&mut self, request: &WebSocketRequest) -> IoResult<()> {
let request_line = "GET ".to_string() + request.resource_name + " HTTP/".to_string() + request.http_version.to_string();
let request_line = "GET ".to_string() + request.resource_name.as_slice() + " HTTP/" + request.http_version.to_string().as_slice();

try!(self.write_str(request_line.as_slice()));
try!(self.write_str("\r\n"));
Expand Down
6 changes: 4 additions & 2 deletions src/ws/handshake/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl WebSocketResponse {
/// Generates the handshake Sec-WebSocket-Accept value from
/// the given Sec-WebSocket-Key.
pub fn gen_accept<A: ToString>(key: A) -> String {
let concat_key = key.to_string() + MAGIC_GUID.to_string();
let concat_key = key.to_string() + MAGIC_GUID;
let mut sha1 = Sha1::new();
sha1.update(concat_key.into_bytes().as_slice());
sha1.digest().as_slice().to_base64(STANDARD)
Expand Down Expand Up @@ -218,7 +218,9 @@ pub trait WriteWebSocketResponse {

impl<W: Writer> WriteWebSocketResponse for W {
fn write_websocket_response(&mut self, response: &WebSocketResponse) -> IoResult<()> {
let status_line = "HTTP/".to_string() + response.http_version.to_string() + " ".to_string() + response.status_code.to_string() + " ".to_string() + response.reason_phrase;
let mut status_line = "HTTP/".to_string() + response.http_version.to_string().as_slice();
status_line = status_line + " " + response.status_code.to_string().as_slice();
status_line = status_line + " " + response.reason_phrase.to_string().as_slice();

try!(self.write_str(status_line.as_slice()));
try!(self.write_str("\r\n"));
Expand Down