Able to explain HTTP request communication flow Flashcards

1
Q

What is HTTP?

A

HTTP, or Hypertext Transfer Protocol, is a protocol used for communication between web servers and web clients (usually web browsers). HTTP requests are initiated by the client.

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

HTTP Request flow 1

A
  • The client, usually a web browser, sends an HTTP request to the server.
  • This request typically contains a:
    • URL (Uniform Resource Locator) and a
    • set of request headers, which provide information about the request such as
      • the type of request being made and
      • the format in which the client expects the response.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

HTTP Request flow 2

A
  • The server receives the request and processes it.
  • This may involve looking up the requested resource (such as a webpage or a file) on the server,
    • executing server-side scripts or code, or
    • performing other operations depending on the nature of the request.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

HTTP Request flow 3

A

The server sends an HTTP response back to the client.
This response typically includes
- a status code (such as 200 OK, when the request was successful, or 404 Not Found, when the requested resource could not be found),
along with response headers that provide additional information about the response.(like content type)

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

HTTP Request flow 4

A
  • If the response includes any content, such as a webpage or a file, it will be included in the body of the response.
  • The client can then process this content and display it to the user (in the case of a web browser),
  • or perform other actions depending on the nature of the response.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

HTTP methods that can be used in an HTTP request

A

GET:
- The GET method is used to retrieve data from the server.
- When a client sends a GET request to the server, the server responds with the requested data, which is usually in the form of a web page or a JSON object.

POST:
-The POST method is used to send data to the server.
- When a client sends a POST request to the server, the request contains data that the server can use to create a new resource.

PUT: The PUT method is used to update an existing resource on the server. When a client sends a PUT request to the server, the request contains the updated data for the resource.

DELETE: The DELETE method is used to delete a resource on the server. When a client sends a DELETE request to the server, the server deletes the resource specified in the request.

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