HTTP
Objectives
-
Describe the pieces that make up a URL
-
Identify HTTP verbs
-
Describe makes up an HTTP request/response
-
Identify common HTTP status codes
- Define the same-origin policy
What happens when you type google.com on your browser and hit enter?
Web Sequence Diagrams!
URI
Uniform Resource Identifiers
URLs are URIs
http://www.example.com:80/a/good/path.html?foo=bar#home
protocol/schema - a Standard. tells the computer how to read the information.
host/domain - Location. where the server is
port - window of server
path - path of a file or simply for more information
query string - passing information. searching or filtering
anchor - where in the page
Parts of the URL
HTTP Request
GET /resources/public-data/ HTTP/1.1
Host: bar.other
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20081130 Minefield/3.1b3pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Referer: http://foo.example/examples/access-control/simpleXSInvocation.html
Origin: http://foo.example
HTTP Verbs
GET
POST
PUT
PATCH
DELETE
OPTIONS
RESTful Design
Representational state transfer (REST) or RESTful Web Services are one way of providing interoperability between computer systems on the Internet.
Best practices for the web to create a "uniform interface" for computers to talk to each other.
HTTP Response
HTTP/1.1 200 OK
Date: Mon, 01 Dec 2008 00:23:53 GMT
Server: Apache/2.0.61
Access-Control-Allow-Origin: *
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/xml
[XML Data]
HTTP Status Codes
Status OK
Moved Permanently
Not Modified
Unauthorized
Not Found
Service Unavailable
200
301
304
401
404
503
SO MUCH MORE
- TCP/IP
- JSON, XML
- Cookies, JWTs
- CORS
CORS
You will see this:
Don't worry about it for now. Look into same origin policy
Review
-
Describe the pieces that make up a URL
-
Identify HTTP verbs
-
Describe makes up an HTTP request/response
-
Identify common HTTP status codes
- Define the same-origin policy
deck
By Roberto Ortega
deck
- 358