HTTP Flashcards
What is HTTP and what is its use?
Hypertext Transfer Protocol
- Describes how a program called the client can send a request (e.g., retrieve a document) to
- Another program called the server which sends back a response (e.g., containing the requested document) back to the client
What is a URL and what is its use
Uniform Resource Locator (URL) is a type of URI (Uniform Resource Identifier).
- Identifies the location of a resource
- Contains some required and some optional parts
- A naming infrastructure to represent documents, or more formally resources, located on the web. We commonly call a URL a web address.
- Typically the client and server programs run on different machines. In such cases, the url identifies both the machine on which the server is running as well as the specific document among all the other documents hosted by that server. The URL naming infrastructure thus allows retrieval of documents that are located across geographically distant places, i.e., across a wide area.
scheme://server-name:port-number/path-to-resource?param1=value1¶m2=value2#link-in-resource
What is HTML and what is its use
Hypertext Markup Language - A markup language for describing documents that can be retrieved over the web.
- The term hypertext means text which contains links to other texts
HTML supports describing hypermedia documents, i.e., documents that besides text, can also contain other media such as graphics, video, and sound
- A client interprets the HTML in a document it receives in the HTTP response from the server and displays the document.
What is Javascript and what is its use?
A programming language which can be executed by web browsers, and is also used as a general purpose programming language. It is also very popular for implementing server side programs.
- it was developed in order to allow running programs in the browser to support full-blown applications with rich user interfaces and good performance that did not require round-trip communication to the server for every user interaction.
What is CSS and what is its use?
Developed as a way to provide developers a way to have more control over the look and feel of their webpages. Also allows for displaying webpages differently based on screen differences.
- Allows for separating the styling aspects of a webpage, e.g., colors, fonts, etc., from its structure.
- Used for describing the presentation of documents on the web while HTML continues to be used for describing the structure of documents.
What is a server
A server receives the HTTP request from a client and determines the document that has been requested.
What is a client
A client is a web browser.
A client on the web communicates with the server using HTTP protocol.
How do a client and a server communicate over the web
A user enters a URL in the browser (client)
- The browser sends an HTTP request to the appropriate web server as identified by the URL
- The server receives the HTTP request and determines the document that has been requested
- The server sends back the document in an HTTP response to the browser
- The browser interprets the HTML document and displays its contents.
What are the different parts of an HTTP request
An HTTP request has up to 4 parts.
1. The request line, the first line which has the following format: Request-Method Resource HTTP/Version
2. Request Headers: these take the form of a name:value pair
3. A blank line
4. An optional body, usually empty for a Get request, but contains the content in a POST request
What is in a request line?
Request-Method Resource HTTP/Version
What is the GET method used for?
The GET method is used to retrieve a document
What is the use of request headers?
Used to pass additional information to the server.
What re the different parts of an HTTP response
Status Line
Response Headers
Blank Line
Optional Body
What is in the status line?
HTTP/Version Status-code Reason-phrase
What is the use of response code?
This code provides the status of the response.
200 - successful request
400 - the request failed because of a client error
500 - the request failed because of a server error