book icon indicating copy to clipboard operation
book copied to clipboard

Ch20-* Content-Type not set

Open myperry opened this issue 2 years ago • 2 comments

  • [X] I have checked the latest main branch to see if this has already been fixed
  • [X] I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem: https://doc.rust-lang.org/book/ch20-01-single-threaded.html https://doc.rust-lang.org/book/ch20-02-multithreaded.html https://doc.rust-lang.org/book/ch20-03-graceful-shutdown-and-cleanup.html

Description of the problem:

In some internet browsers, the following code cannot be parsed because 'Content-Type' is not set. let response = format!( "{}\r\nContent-Length: {}\r\n\r\n{}", status_line, contents.len(), contents );

Suggested fix:

Set 'Content-Type' let response = format!( "{}\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Length: {}\r\n\r\n{}", status_line, contents.len(), contents );

myperry avatar Jun 10 '22 21:06 myperry

Which browsers, please?

carols10cents avatar Jun 11 '22 02:06 carols10cents

请问哪些浏览器?

Operating System: windows10 Internet Browsers: Microsoft Edge, version: 102.0.1245.39

ghost avatar Jun 11 '22 02:06 ghost