HTTP Basics Flashcards

1
Q

What does HTTP stand for?

A

HyperText Transfer Protocol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is HTTP?

A

It is a critical protocol used to transfer data across the web.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many types of headers did the first version of HTTP have?

A

One => GET which requests a page from a server.

BONUS: The response from the server was always an HTML page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What was the first version of HTTP?

A

Version 0.9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the current version and when was it last updated?

A

1.1 and last revised in 2014

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is HTTP a:

  1. Command and Response Text-Based protocol using client-server communication models.
  2. Request and Function-based protocol using cloud servers
  3. A protocol to keep your computer safe from viruses
  4. Request and Response Object-Oriented protocol using client-server communication models.
A
  1. Command and Response Text-Based protocol using client-server communication models.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

HTTP is a stateless protocol. What does that mean?

A

That means that the server isn’t required to store session information, and each request is independent of the other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why are independent requests important in HTTP?

A

Because any type of data (file, binary, text, etc..) can be sent by HTTP. The only thing necessary is that server and client should know how to handle that request

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the request and response message structure?

A

The request and response have the same structure as shown in the image.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does a request consist of?

A

A command or request + optional headers + optional body content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does a response consist of?

A

A status code + optional headers + optional body content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is CRLF?

A

It stands for:

Carriage Return and Line Feed

and a simple CRL combination is used to delimit the parts, and a single blank line (CRLF ) indicates end of the headers.

If the request or response contains a message body then this is indicated in the header.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How is the start line of the request formatted?

A

Method + Resource Path + protocol version

Example: if we try to access the web page testpage.htm on www.testsite5.com

The the start line of the request would be

GET /testpage.htm HTTP/1.1

Where

GET is the method

/testpage.htm is the relative path to the resource.

HTTP/1.1 is the protocol version we are using

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Does a relative path include the domain name?

A

NO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When we enter the URL what does the browser do with it?

A

It uses it to create the relative URI of the resource.

Note: URL (uniform resource Locator) is used for web pages. It is an example of a URI (uniform resource indicator).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Is the actual HTTP request shown by the browser?

A

No. Unless of course, you use a special tool like HTTP Header Live (like in FireFox).

17
Q

What is the difference between the URL vs HTTP?

A
  • The HTTP stands for Hyper Text Transfer Protocol and the URLS stands for Uniform Resource Locator.
  • The URL is the web address of the particular website and it tells the web browser the address of the resource to locate and the protocol to use to retrieve that resource (HTTP).
  • HTTP is the transfer protocol that transfers the resource (web page, image, video, etc) from the server to the client.

The URL can also include the port which is normally hidden by the browser, but you can manually include it as shown in the second image with the port

18
Q

What does each HTTP Response consist of?

A
  • STATUS code And Description
  • 1 or more optional headers
  • Optional Body message can be many lines including binary data
19
Q

What is the range of response status codes and their general meanings?

A
  • 1xx – Informational
  • 2xx – Successful
  • 3xx - Multiple Choice
  • 4xx – Client Error
  • 5xx - Server Error

For example, a successful page request will return a 200 response code and an unsuccessful 400 response code.

You can find a complete list and their meaning here

20
Q

The image shows a Request and Response rendered in the browser. That being the case, what do you imagine the HTTP request-response looks like behind the scenes?

A

Notice the request headers are automatically inserted by the browser, and so are the response headers are inserted by the web server.

There is no body content in the request. The body content in the reply is a web page, and is shown in the browser, and not by the live headers tool.

21
Q

What are the two most common types of HTTP request methods?

A

GET and POST

22
Q

The HTTP protocol now support 8 request types, also called methods or verbs in the documentation. What are they and what’s their purpose?

A
  • GET – Requesting resource from server
  • POST – submitting a resource to a server (e.g. file uploads)
  • PUT - As POST but replaces a resource
  • DELETE - Delete a resource from a server
  • HEAD – As GET but only return headers and not content
  • OPTIONS - Get the options for the resource
  • PATCH - Apply modifications to a resource
  • TRACE - Performs message loop-back

GET is for getting web pages and POST is for submitting web forms.

The Other methods are used when working with Web and IOT APIs specifically put, delete and head.