|
|
@ -136,6 +136,7 @@ Request: [
|
|
|
|
```text
|
|
|
|
```text
|
|
|
|
Method Request-URI HTTP-Version
|
|
|
|
Method Request-URI HTTP-Version
|
|
|
|
headers CRLF
|
|
|
|
headers CRLF
|
|
|
|
|
|
|
|
|
|
|
|
message-body
|
|
|
|
message-body
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
@ -152,6 +153,7 @@ message-body
|
|
|
|
```text
|
|
|
|
```text
|
|
|
|
HTTP-Version Status-Code Reason-Phrase CRLF
|
|
|
|
HTTP-Version Status-Code Reason-Phrase CRLF
|
|
|
|
headers CRLF
|
|
|
|
headers CRLF
|
|
|
|
|
|
|
|
|
|
|
|
message-body
|
|
|
|
message-body
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
@ -227,7 +229,7 @@ fn handle_connection(mut stream: TcpStream) {
|
|
|
|
let length = contents.len();
|
|
|
|
let length = contents.len();
|
|
|
|
|
|
|
|
|
|
|
|
let response =
|
|
|
|
let response =
|
|
|
|
format!("{status_line}\r\nContent-Length: {length}\r\n\r\n{contents}");
|
|
|
|
format!("{status_line}\r\nContent-Length: {length}\r\n\r\n\n{contents}");
|
|
|
|
|
|
|
|
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -257,7 +259,7 @@ fn handle_connection(mut stream: TcpStream) {
|
|
|
|
let length = contents.len();
|
|
|
|
let length = contents.len();
|
|
|
|
|
|
|
|
|
|
|
|
let response = format!(
|
|
|
|
let response = format!(
|
|
|
|
"{status_line}\r\nContent-Length: {length}\r\n\r\n{contents}"
|
|
|
|
"{status_line}\r\nContent-Length: {length}\r\n\r\n\n{contents}"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
@ -283,7 +285,7 @@ fn handle_connection(mut stream: TcpStream) {
|
|
|
|
let length = contents.len();
|
|
|
|
let length = contents.len();
|
|
|
|
|
|
|
|
|
|
|
|
let response = format!(
|
|
|
|
let response = format!(
|
|
|
|
"{status_line}\r\nContent-Length: {length}\r\n\r\n{contents}"
|
|
|
|
"{status_line}\r\nContent-Length: {length}\r\n\r\n\n{contents}"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
@ -324,7 +326,7 @@ fn handle_connection(mut stream: TcpStream) {
|
|
|
|
let length = contents.len();
|
|
|
|
let length = contents.len();
|
|
|
|
|
|
|
|
|
|
|
|
let response =
|
|
|
|
let response =
|
|
|
|
format!("{status_line}\r\nContent-Length: {length}\r\n\r\n{contents}");
|
|
|
|
format!("{status_line}\r\nContent-Length: {length}\r\n\r\n\n{contents}");
|
|
|
|
|
|
|
|
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
|
stream.write_all(response.as_bytes()).unwrap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|