A blog server needs to respond in the same manner to network requests as any other web server so that it can be used by the existing clients. The main clients to the server will be web browsers, such as Google Chrome and Internet Explorer.
A blog server needs to run as a reliable application on different operating systems. Later in this chapter, we will take a look at how a Dart application can be deployed—helper applications and dependencies are required to achieve this.
The HTTP protocol is straightforward and lightweight. Generally, a server responds to a request with a set of headers stating that the request was successful or not. It then sends the details of what it is going to send, and the content itself, before closing the connection.
The HTTP protocol requires that all headers must be sent before any content. Dart helps enforce this, and if you try to modify the headers once some content has been sent, HttpException
will be thrown.