Popular Posts

Sunday, February 14, 2010

various protocols

http://www.tutorialspoint.com/http/http_methods.htm

HTTP Message Structure

previous next AddThis Social Bookmark Button


Like most network protocols, HTTP uses the client-server model: An HTTP client opens a connection and sends a request message to an HTTP server; the server then returns a response message, usually containing the resource that was requested. After delivering the response, the server closes the connection.

The format of the request and response messages are similar and will have following structure:

  • An initial line CRLF
  • Zero or more header lines CRLF
  • A blank line ie. a CRLF
  • An optioanl message body like file, query data or query output.

Initial lines and headers should end in CRLF. Though you should gracefully handle lines ending in just LF. More exactly, CR and LF here mean ASCII values 13 and 10.

Initial Line : Request

The initial line is different for the request than for the response. A request line has three parts, separated by spaces:

  • An HTTP Method Name

  • The local path of the requested resource.

  • The version of HTTP being used.

Here is an exampple of initial line for Request Message.

GET /path/to/file/index.html HTTP/1.0 
  • GET is the most common HTTP method. Other methods could be POST, HEAD etc.

  • The path is the part of the URL after the host name. This path is also called the request Uniform Resource Identifier (URI). A URI is like a URL, but more general.

  • The HTTP version always takes the form "HTTP/x.x", uppercase.

Initial Line : Response

The initial response line, called the status line, also has three parts separated by spaces:

  • The version of HTTP being used.

  • A response status code that gives the result of the request.

  • An English reason phrase describing the status code.

Here is an exampple of initial line for Response Message.

HTTP/1.0 200 OK  or  HTTP/1.0 404 Not Found 

Header Lines

Header lines provide information about the request or response, or about the object sent in the message body.

The header lines are in the usual text header format, which is: one line per header, of the form "Header-Name: value", ending with CRLF. It's the same format used for email and news postings, defined in RFC 822.

  • A header line should end in CRLF, but you should handle LF correctly.

  • The header name is not case-sensitive.

  • Any number of spaces or tabs may be between the ":" and the value.

  • Header lines beginning with space or tab are actually part of the previous header line, folded into multiple lines for easy reading.

Here is an exampple of ione header line

User-agent: Mozilla/3.0Gold  or  Last-Modified: Fri, 31 Dec 1999 23:59:59 GMT 

The Message Body

An HTTP message may have a body of data sent after the header lines. In a response, this is where the requested resource is returned to the client (the most common use of the message body), or perhaps explanatory text if there's an error. In a request, this is where user-entered data or uploaded files are sent to the server.

If an HTTP message includes a body, there are usually header lines in the message that describe the body. In particular:

  • The Content-Type: header gives the MIME-type of the data in the body, such as text/html or image/gif.

  • The Content-Length: header gives the number of bytes in the bod

message body

HTTP Message Structure

previous next AddThis Social Bookmark Button


Like most network protocols, HTTP uses the client-server model: An HTTP client opens a connection and sends a request message to an HTTP server; the server then returns a response message, usually containing the resource that was requested. After delivering the response, the server closes the connection.

The format of the request and response messages are similar and will have following structure:

  • An initial line CRLF
  • Zero or more header lines CRLF
  • A blank line ie. a CRLF
  • An optioanl message body like file, query data or query output.

Initial lines and headers should end in CRLF. Though you should gracefully handle lines ending in just LF. More exactly, CR and LF here mean ASCII values 13 and 10.

Initial Line : Request

The initial line is different for the request than for the response. A request line has three parts, separated by spaces:

  • An HTTP Method Name

  • The local path of the requested resource.

  • The version of HTTP being used.

Here is an exampple of initial line for Request Message.

GET /path/to/file/index.html HTTP/1.0 
  • GET is the most common HTTP method. Other methods could be POST, HEAD etc.

  • The path is the part of the URL after the host name. This path is also called the request Uniform Resource Identifier (URI). A URI is like a URL, but more general.

  • The HTTP version always takes the form "HTTP/x.x", uppercase.

Initial Line : Response

The initial response line, called the status line, also has three parts separated by spaces:

  • The version of HTTP being used.

  • A response status code that gives the result of the request.

  • An English reason phrase describing the status code.

Here is an exampple of initial line for Response Message.

HTTP/1.0 200 OK  or  HTTP/1.0 404 Not Found 

Header Lines

Header lines provide information about the request or response, or about the object sent in the message body.

The header lines are in the usual text header format, which is: one line per header, of the form "Header-Name: value", ending with CRLF. It's the same format used for email and news postings, defined in RFC 822.

  • A header line should end in CRLF, but you should handle LF correctly.

  • The header name is not case-sensitive.

  • Any number of spaces or tabs may be between the ":" and the value.

  • Header lines beginning with space or tab are actually part of the previous header line, folded into multiple lines for easy reading.

Here is an exampple of ione header line

User-agent: Mozilla/3.0Gold  or  Last-Modified: Fri, 31 Dec 1999 23:59:59 GMT 

The Message Body

An HTTP message may have a body of data sent after the header lines. In a response, this is where the requested resource is returned to the client (the most common use of the message body), or perhaps explanatory text if there's an error. In a request, this is where user-entered data or uploaded files are sent to the server.

If an HTTP message includes a body, there are usually header lines in the message that describe the body. In particular:

  • The Content-Type: header gives the MIME-type of the data in the body, such as text/html or image/gif.

  • The Content-Length: header gives the number of bytes in the bod

ftp protocols link

http://www.windowsnetworking.com/articles_tutorials/Understanding-FTP-Protocol.html
http protocols

HTTP Overview

previous next AddThis Social Bookmark Button


HTTP stands for Hypertext Transfer Protocol. It is an TCP/IP based communication protocol which is used to deliver virtually all files and other data, collectively called resources, on the World Wide Web. These resources could be HTML files, image files, query results, or anything else.

A browser is works as an HTTP client because it sends requests to an HTTP server which is called Web server. The Web Server then sends responses back to the client. The standard and default port for HTTP servers to listen on is 80 but it can be changed to any other port like 8080 etc.

There are three important things about HTTP of which you should be aware:

  • HTTP is connectionless: After a request is made, the client disconnects from the server and waits for a response. The server must re-establish the connection after it process the request.

  • HTTP is media independent: Any type of data can be sent by HTTP as long as both the client and server know how to handle the data content. How content is handled is determined by the MIME specification.

  • HTTP is stateless: This is a direct result of HTTP's being connectionless. The server and client are aware of each other only during a request. Afterwards, each forgets the other. For this reason neither the client nor the browser can retain information between different request across the web pages.

Following diagram shows where HTTP Protocol fits in communication: