HTTP Protocol Basics Flashcards

1
Q

HTTP (Hypertext Transfer Protocol)

A
  • clear-text
  • most used app protocol
  • client-server
  • transfers web pages and web app data
  • can be intercepted
  • does not provide strong authentication between parties
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

HTTP first step

A

client (usually web browser) connects to web server (MS IIS r Apache HTTP Server)

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

HTTP second step

A

client and server exchange messages (request & response)

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

How is HTTP related to TCP protocol?

A

It works on top of TCP.

  1. TCP connection is made
  2. client sends request
  3. server processes request
  4. server send back answer w/ status code and data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the format of an HTTP message?

A
  1. Headers\r\n
  2. \r\n
  3. Message Body\r\n
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you end lines in HTTP?

A

\r : carriage return

\n: newline

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

What is the format of an HTTP header field?

A

Header-name: header value

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

HTTP verb

A
  • aka: request method

- state the type of request

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

GET request

A

used when opening web resources

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

After the HTTP verb, there is a path. What does the path do?

A

tells server which resources the browser is asking for

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

After the HTTP verb and path, there is the protocol version. What is the protocol version?

A

tells server how to communicate with the browser

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

What is the structure of the first line of an HTTP request?

A

HTTP VERB, path, protocol version

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

What does the HTTP Request Host header field specify?

A
  • it specifies the internet hostname and port number of the resource being requested
  • tells server which site client is asking for
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

URI

A

identifies a specific resuorce: page, book, document

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

URL

A
  • type of URI

- tells you how to access the resource: HTTPS, FTP

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

User-Agent

A

tell server what client software & version is issuing the request: Firefox, Safari, Chrome, etc

17
Q

Accept header field

A

specifies which document type it is expecting in response

18
Q

Accept-Encoding

A

restricts content encoding, not the content itself.

• for example, the browser will accept two types of compression if read “: gzip, deflate”

19
Q

Connection header

A

allows sender to specify options that are desired for that particular connection

• for example, future comms w/ server will reuse current connection if “keep-alive”

20
Q

HTTP Response: Status-Line

A
  • protocol version (HTTP 1.1)
  • status code (200)
  • relative textual meaning (OK)
21
Q

Status Code: 200

A
  • OK

- resource found

22
Q

Status Code: 301

A
  • Moved Permanently

- resource has been assigned a new permanent URI

23
Q

Status Code: 302

A
  • Found

- temporarily under another URI

24
Q

Status Code: 403

A
  • Forbidden

- client doesn’t have enough privileges, server refuses to fulfill request

25
Q

Status Code: 404

A
  • Not Found

- server cannot find a resource matching the request

26
Q

Status Code: 500

A
  • Internal Service Error

- server does not support the functionality required to fulfill request

27
Q

Cache-Control header

A
  • server informs client about cached content
28
Q

Content-Type header

A

lets client know how to interpret body of message

29
Q

Content-Encoding header (for HTTP response)

A

extends content type - for example, “gzip” would mean message body is compressed with gzip

30
Q

Server header

A

contains the header of the server that generated the content

ex: “Apache/2.2.15 (CentOS)

31
Q

Content-Length header

A

indicates length of bytes of the message body