Course Title: Web Engineering Chapter No: 02 *HTTP and TCP/IP*

advertisement
Web Engineering
“HTTP and TCP/IP”
Course Instructor:
IT Lecturer, MIHE, Kart-i Parwan branch, Kabul
HTTP
• 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.
HTTP
• A browser 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.
HTTP
• 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.
Completion of Request
1. 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.
Completion of Request
2. 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
reflect specification.
Completion of Request
3. 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.
HTTP Message Structure
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 i.e. a CRLF
• An optional message body like file, query data
or query output.
HTTP Methods
• The set of common methods for HTTP/1.0 is
defined below.
1. The GET Method
2. The HEAD Method
3. The POST Method
1. The GET Method
• The GET method means retrieve whatever
information (in the form of an entity) is
identified by the Request-URL.
• The GET method can also be used to submit
forms.
• The form data is URL-encoded and appended
to the request URL.
2. HEAD Method
• A HEAD request is just like a GET request.
• The response to a HEAD request must never
contain a message body, just the status line
and headers.
• This is useful to check characteristics of a
resource without actually downloading it, thus
saving bandwidth.
• Use HEAD when you don't actually need a
file's contents.
3. The POST Method
• A POST request is used to send data to the
server to be processed in some way, like by a
CGI script.
• A POST request is different from a GET request
in the following ways:
1. There's a block of data sent with the request,
in the message body. There are usually extra
headers to describe this message body, like
Content-Type: and Content-Length.
3. The POST Method
2. The request URI is not a resource to retrieve;
it's usually a program to handle the data
you're sending.
3. The HTTP response is normally program
output, not a static file.
HTTP Status Codes
Server Error
Message:
Description:
500 Internal Server Error
The request was not completed. The server met an
unexpected condition
501 Not Implemented
The request was not completed. The server did not support
the functionality required
502 Bad Gateway
The request was not completed. The server received an
invalid response from the upstream server
503 Service Unavailable
The request was not completed. The server is temporarily
overloading or down
504 Gateway Timeout
The gateway has timed out
505 HTTP Version Not Supported
The server does not support the "http protocol" version
TCP/IP
Early TCP/IP History
• The Internet is a primary reason why TCP/IP is
what it is today.
• In fact, the Internet and TCP/IP are so closely
related in their history that it is difficult to
discuss one without also talking about the
other.
• They were developed together, with TCP/IP
providing the mechanism for implementing
the Internet.
Early TCP/IP History
• TCP/IP has over the years continued to evolve
to meet the needs of the Internet.
• The TCP/IP protocols were initially developed
as part of the research network developed by
the United States Defense Advanced Research
Projects Agency (DARPA or ARPA).
• Initially, this hatchling network, called the
ARPAnet, was designed to use a number of
protocols that had been adapted from existing
technologies.
Internet Protocol (IP)
• IP is responsible for several tasks, most
importantly determining a route to the
description.
• In addition, IP is responsible for the packing of
messages into small network-transportable
packets, called data-grams.
• IP is used with almost all TCP protocols, sitting
at the bottom of the TCP protocol stack just
above the network-layers.
Internet Protocol (IP)
• IP has no control over whether messages sent
and received are intact.
• All IP does is handle the sending and
receiving, leaving it up to the next higher
layer, usually TCP or UDP, to take care of any
problems that occur with lost or damaged
data.
Transmission Control Protocol (TCP)
• TCP is used primarily to verify that whatever
was sent by the sending machine is received
intact by the destination.
• TCP is called a reliable delivery protocol,
meaning that it makes sure everything sent
was received properly.
• TCP is a connection-based protocol, meaning
that the sending and the destination machines
communicate with each other by sending
status messages back and forth.
Transmission Control Protocol (TCP)
• TCP adds a header to the front of each
message that contains checksums, numbering,
and other reliability information to ensure
that every packet sent is received without
modification. If there is a transmission
problem, TCP takes care of resending the
information.
Transmission Control Protocol (TCP)
• TCP sits between the application and the IP
layer on each machine, acting as a packaging
layer for application data and a delivery
mechanism of sending packets to an
application.
• TCP usually runs with IP, but it can work with
other protocols.
User Datagram Protocol (UDP)
• UDP is an alternative to TCP.
• It is a connection-less protocol, meaning that
the sending and receiving machine are not
constantly connected to each other.
• They can send status messages back and forth
to indicate reception of packets, but there is
no constant connection maintained.
• UDP sits in the layer between the applications
and IP. UDP usually uses IP to handle its
packets.
Telnet
• The Telnet service provides a remote login
capability.
• This lets a user on one machine log into
another machine and act as if they are directly
in front of the second machine.
• Telnet uses TCP to maintain a connection
between two machines.
Telnet
• The connection can be anywhere on the local
network, or on another network anywhere in
the world, as long as the user has permission
to log into the remote system.
Simple Network Management Protocol
(SNMP)
• SNMP is a network management protocol.
• SNMP uses UDP as a transport mechanism.
• SNMP relies on several terms from TCP/IP
standard
specifications,
working
with
managers and agents instead of clients and
servers.
• An agent provides information about a device,
whereas a manager communicates across the
network.
Domain Name System (DNS)
• DNS enables a device with a common name to
be converted to a special network address.
• DNS provides the conversion from a common
local name to the unique physical address of
the device's network connection.
Download