HTTP Flashcards
What is a client?
computer/software/anything that requests a service and consume data
What is a server?
computer/software/anything that provide resource or service
ex) web server, file server
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
What three things are on the start-line of an HTTP request message?
- HTTP method = a verb (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed.
- request target (usually a URL, or the absolute path of the protocol, port, and domain are usually characterized by the request context)
- HTTP version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response
What three things are on the start-line of an HTTP response message?
- protocol version aka HTTP version, usually HTTP/1.1.
- status code indicating success or failure of the request. Common status codes are 200, 404, or 302
- status text, a brief, textual description of the status code to help a human understand the HTTP message
What are HTTP headers?
equivalent of head element in HTML document but for HTTP
attaching metadata/additional information that describes the data itself (several types: general, request, representation)
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN
Is a body required for a valid HTTP request or response message?
No.
The final part of the request is its body. Not all requests have one: requests fetching resources, like GET, HEAD, DELETE, or OPTIONS, usually don’t need one. Some requests send data to the server in order to update it: as often the case with POST requests (containing HTML form data).
Bodies can be broadly divided into two categories:
- Single-resource bodies, consisting of one single file, defined by the two headers: Content-Type and Content-Length.
- Multiple-resource bodies, consisting of a multipart body, each containing a different bit of information. This is typically associated with HTML Forms.
What is AJAX?
Asynchronous meaning your code continues to run while the targeted part of your web page is trying to reload (compared to synchronously, which blocks your code from running until that part of your page is done reloading)
A programming practice of building complex, dynamic webpages using a technology known as XMLHttpRequest.
What does the AJAX acronym stand for?
Asynchronous JavaScript And XML
Which object is built into the browser for making HTTP requests in JavaScript?
XMLHttpRequest
What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?
‘load’
An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?
prototypal inheritance
http vs https
s = secure
making it not visible and therefore more “secure”