What are important HTTP headers to be frequently used in Python CGI Programming?

PythonServer Side ProgrammingProgrammingCGIHTTP

HTTP Header

The line Content-type:text/html\r\n\r\n is part of HTTP header which is sent to the browser to understand the content. All the HTTP header will be in the following form −

HTTP Field Name − Field Content

For Example

Content-type − text/html\r\n\r\n

There are few other important HTTP headers, which we will use frequently in our CGI Programming.     

Sr.No.
Header
Description
1
Content-type:

A MIME string defining the format of the file being returned. Example is Content-type:text/html
2
Expires: Date

The date the information becomes invalid. It is used by the browser to decide when a page needs to be refreshed. A valid date string is in the format 01 Jan 1998 12:00:00 GMT.
3
Location: URL

The URL that is returned instead of the URL requested. You can use this field to redirect a request to any file.

4
Last-modified: Date

The date of last modification of the resource.
5
Content-length: N

The length, in bytes, of the data being returned. The browser uses this value to report the estimated download time for a file.
6
Set-Cookie: String

Set the cookie passed through the string


raja
Published on 31-Jan-2018 07:34:43
Advertisements