Web Application Technologies Flashcards
HTTP Requests
- consist of one or more headers, each on a separate line
- followed by a mandatory blank line
- followed by an optional message body
The first line of every HTTP request consists of WHAT three items, separated by spaces?
- A VERB indicating the HTTP method (i.e. GET, POST)
- The requested URL and option query string (params)
- HTTP version being used (HTTP/1.1)
The Requested URL?
- The URL typically functions as a name for the resource being requested, together with an optional query string containing parameters that the client is passing to that resource
- The query string is indicated by the ‘?’ character in the URL
EXAMPLE: /auth/488/page.aspx?uid=129
What are some common HTTP Request Headers?
- Referer
- User-Agent
- Host
- Cookie
Referer Header
- used to indicate the URL from which the request originated
- EXAMPLE: If the user clicked on a link, the link URL is displayed
User-Agent Header
- used to provide information about the browser or other client software that generated the request.
Host Header
- specifies the hostname that appeared in the full URL being accessed
- this is necessary when multiple websites are being hosted on the same server
Cookie Header
- used to submit additional parameters that the server has issued to the client
- EXAMPLE: SessionId=5B70C71F3FD4963829483484
The first line of the HTTP Response consists of WHAT three items?
- The HTTP version being used
- A numeric status code indicating the result of the request (200 is most common)
- A textual “reason phrase” further describing the status of the response (usually ‘OK’); not really used anymore
GET method
- most common
- designed to retrieve resources
- it can be used to send parameters to the requested resource in the URL query string
POST method
- used to perform actions
- with this method, request parameters can be sent both in the URL query string and in the body of the message
General HTTP Headers
- Connection
- Content-Encoding
- Content-Length
- Content-Type
- Transfer-Encoding
Connection Header
- tells the other end of the communication whether it should close the TCP connection after the HTTP transmission has completed, or keep it open for further messages
Content-Encoding Header
- specifies the type of encoding being used for the content contained in the message body
- EXAMPLE: gzip
Content-Type Header
- specifies the type of content contained in the message body, such as ‘text/html’ for HTML documents
Transfer-Encoding Header
- specifies any encoding that was performed on the message body to facilitate its transfer over HTTP.
Request Headers
- Accept
- Accept-Encoding
- Authorization
- Cookie
- Host
- Origin
- Referer
- User-agent
Accept Header
- tells the server what kinds of content the client is willing to accept
Accept-Encoding Header
- tells the server what kinds of content encoding the client is willing to accept
Authorization Header
- submits credentials to the server
User-Agent Header
- provides information about the browser or the client software that generated the request
Response Headers
left off here