This is a creation in Article, where the information may have evolved or changed.
Golang streamlined and intuitive design, allowing web development and writing print "Hello world" identical. It also gives me a chance to get a glimpse of the design and implementation of HTTP Server. So far, before Tomcat, Apache and other web containers gave me the mystique swept away.
1. Basic knowledge
The purpose of HTTP server is to implement HTTP Protocol, let's briefly describe the HTTP Protocol.
An HTTP message consists of a single line of simple strings. HTTP messages are plain text and are the carrier of web information transmission. The following is a simple scenario for representing the HTTP message format.
The first step: the user input information username=harry&password=1234, the browser sends the POST request to the Http://localhost:8080/login, sends the message to
POST /login http/1.1
Host:localhost:8080/login
Accept:text/html
username=yasun&password=1234
The second step: the server returns the login information of the personal blog page information, send response message for
Step three: Users click on Blog 1, the browser sends a GET request
2. Design Ideas