w-b pt1 v2 Flashcards
What was the original idea behind web access?
Access-to and display of distributed hyper-linked files
- Online documents only
- Only really designed for distribution
What type of protocol is HTTP?
It is a request-response protocol
Which means it is stateless
How is the request line formatted?
3 space separated parts
methodName localPath HTTPVersion
Methods:
- Are all caps
- commnon = GET, POST, HEAD
What is a URI?
Uniform Resource Identifier
A URI can be further classified as a locator, a name, or both. The term “Uniform Resource Locator” (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network “location”). The term “Uniform Resource Name” (URN) has been used historically to refer to both URIs under the “urn” scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name.
What are the 3 parts of a response line?
3 Space separated parts
HTTPVersion responseStatusCode reasonPhrase
Examples:
* HTTP/1.0 200 OK
* HTTP/1.0 404 Not Found
In general what are header lines and what are they for?
They provide information about request and response OR about object sent in the message body
In this format:
Header1: value
How many headers and which are REQUEIRED:
* HTTP 1.0
* HTTP 1.1
What SHOULD you always include?
HTTP 1.0 - 16 headers (none required)
HTTP 1.1 - 46 (Host: is required)
From: email address of requesting user
User-Agent: the program making the request
What does the “Server” header do?
Return the server fotware in the form:
“Program-name/x.xx”
“Server: Apache/1.2b3-dev”
What does the “Last-modified” header do?
Specificies the modification date of the resource that is returned.
Used in web caching
In a request and response, what is the message body for?
Request:
- this is where user-entered data or uploaded files are sent to the server
Response:
- This is where the requested resource is returned to the client (or perhaps explanatory text if an error occurs)
What headers are usually included if a HTTP message includes a body?
Content-Type: Gives the MIME-type of the data in the body
MIME = Muli-purpose Internet Mail Extensions” specifying the type of data that is encoded
Content-length: specifies the number of bytes of data in the body
What does the request and repsonse look like for the following:
Request:
- browser opens a stream socket to host www.cs.umanitoba.ca on port 80
- browser sends something like this HTTP over the socket
GET /path/f.html HTTP/1.0
From:
User-agent: HTTPTool/1.0
[blank line]
Response:
The server responses (on the same socket) with the following HTTP:
HTTP/1.0 200 OK
Date:
Content-Type: text/html
Content-Length: 1354
[conent of HTML file]
What is a HEAD request?
It ask the server to return only the response headers, not the actual resouce.
- Useful to determine the characteristics of a resource without actually downloading it
What is the POST request used for?
It is used to send (i.e. “post”) data to the server for processing
* to a CGI (Common Gateway Interface) script
In what ways is a POST request different from a GET request?
- There is a block of data sent with the request in its message body
- The request URI is not a resource to retieve but is instead a program (a script) that will process the data being sent
- the response back is normally program output(HTML), not just a static file