Python code for Close Connection ExampleThis Python code snippet was generated automatically for the Close Connection example.
<< Back to the Close Connection example
What are HTTP Headers?
An HTTP request or response consists of HTTP headers and an HTTP body. HTTP headers contain a case-insensitive name, a colon (:), and a header value. A header field comprises a case-insensitive name followed by a colon (':') and its value (spaces between name and value are ignored). The server uses HTTP headers to send data type information and size in the response body, compression method used, caching directives, and cross-origin resource sharing restrictions (CORS).
What is an HTTP connection header?
HTTP Connection headers are general-purpose headers that allow the sender or client to specify the parameters required for that particular connection. You can send or receive multiple HTTP requests and responses using a single TCP connection instead of opening a new connection for each request. HTTP Connection also controls whether the network remains open or closed after completing the current transaction.
Close Connection Header Syntax
The following is the syntax of the Closed Connection header:
Close Connection Example
The following is an example of sending a GET request with a Closed Connection header:
Server response to our request: