Application Layer.
Application Layer Basics
Processes running on different computers communicate with each other by exchanging message across the computer
network. It's important to distinguish between network applications and network-layer protocols. For example,
Web application consists of many components:
web browser
web server
standard document format (like HTML)
and an application-layer protocol (HTTP).
Application layer protocol defines:
The types of messages exchanged, for example, request messages and response messages.
The syntax of the various message types, such as the fields in the message and how the fields are delineated.
The semantics of the fields, that is, the meaning of the information in the fields.
Rules for determining when and how a process sends messages and responds to messages.
Typically a network application has two parts or "sides", a server side and a client side. Let's agree
that the host that initiates the session is labeled the client.
Ideas of
socket as a door between the application layer and transport layer;
IP address
destination port number
User agent is an interface between the user and the network.
Application's needs and available services
Needs:
Reliable data transfer (loss-tolerant applications vs. no loss-tolerant ones)
Bandwidth. Some application must be able to transfer data at a certain rate in order to be effective. For example,
Internet telephony requires at least 32 Kbps. (band-width sensitive vs. elastic applications.)
Timing. Some application require timing constraints on data delivery in order to be effective.
Available services from the Transport Layer:
TCP -- connection-oriented reliable transport service.
UDP -- no-frills, lightweight transport protocol
Telnet protocol
transport layer service used: TCP
port number: 23
HTTP protocol
transport layer service used: TCP
port number: 80
maintaining information about the client: No => stateless protocol
type of connection: persistent or non-persistent
Client side messages
Client side message format: 
- Possible protocols: HTTP/1.0 and HTTP/1.1
- Possible methods: GET, POST, HEAD, PUT, DELETE
- Some of the possible headers:
- Host
- Connection
- User-Agent
- Accept
- Accept-language
- Set-cookie
- Cookie
- If-modified-since
- Authorization
Server side messages
The server side message format is:

The status code and associated phrase indicate the result of the request. Some common status codes and
associated phrases include:
- 200 OK: Request succeeded and the information is returned in the response.
- 301 Moved Permanently: Requested object has been permanently moved; new URL is specified
in Location: header of the response message. The client software will automatically
retrieve the new URL.
- 304 Not modified: The requested document was not modified after the date specified
at If-modified-after: field of the client request.
- 400 Bad Request: A generic error code indicating that the request could not be understood
by the server.
- 401 Authorization Required: The requested document is located in a directory that requires
authorization. Field Authorization was expected from the client.
- 404 Not Found: The requested document does not exist on this server.
- 505 HTTP Version Not Supported: The requested HTTP protocol version is not supported by
the server.
This page will help you to see server side messages.
Some useful links:
HTTP/1.0: http://www.rfc-editor.org/rfc/rfc1945.txt
HTTP/1.1: http://www.rfc-editor.org/rfc/rfc2068.txt
Cookies: http://home.netscape.com/newsref/std/cookie_spec.html