DevLeague Coding Bootcamp
DevLeague is a Full Stack Coding Bootcamp
HyperText Transfer Protocol
besides a really old and outdated term
HyperText refers to on screen text that can contain references (hyperlinks) to other HyperText.
The content that the term HyperText refers to can be plain text, structured data, hyperlinks, tabular data, images and other media that can be presented on the screen.
We don't use the term HyperText anymore.
It just exists in our acronyms: HTTP and HTML
just use the more descriptive form: HTML content, XML data, Json document, etc.
a protocol used to transfer Hypertext
HTTP is a "language" spoken between clients and servers
Internet Data
An HTTP client makes HTTP requests
An HTTP server accepts HTTP requests, and sends the client an HTTP response
the default designated port for HTTP servers to listen on is the reserved port 80
HTTP connections are created and data is transmitted through sockets
Once the server responds, the socket is closed
A client uses one of the methods to send HTTP Requests to the server
Uniform Resource Identifier
A URI is how a server identifies a resource to be delivered to the client
/index.html
/map/21.3088569,-157.8084575
Examples:
A URL is a URI that also specifies how to get that resource (what protocol to use)
Uniform Resource Locator
https://www.google.com
http://www.devleague.com/apply
Examples:
https://www.google.com
http://www.devleague.com:80/apply
http://162.243.46.54:80/parting-thoughts-from-a-student/
Protocol
Host address
path
port
the default port to make HTTP requests is 80
The HTTP Request Response cycle starts with the HTTP Request
An HTTP Request is a client connecting to a host (server that is listening for incoming messages) and sending a Request Message
The HTTP Request Message contains a Header and Body
separated by a blank line
The HTTP Request Message Header contains
a Request Line which is the first line of the header,
and Request Headers which is a variable number of key value pairs
[METHOD] [Request URI] [HTTP Version]
The request line adheres to this format
Examples
GET /index.html HTTP/1.1 GET / HTTP/1.1 POST /login HTTP/1.1
Key value pairs separated by ":"
multiple values can be separated by ","
Host: www.devleague.com
Connection: Keep-Alive
Accept: text/html, application/json
Date: Wed, 8 Jul 2015 11:12:31 GMT
A request body may be sent to the server.
The body content begins after an empty line after the headers.
Use the content-length header to tell the server how large the message body is.
POST /apply HTTP/1.1 Host: www.devleague.com Connection: Keep-Alive Accept: text/html, application/json Content-Length: 278
firstName=test&lastName=test&email=test%40test.com&phone=8082233899&address1=test&address2=&city=test&state=test&postal=test&country=US&track=55103a9f50b6d0603be3f71b&status=total+noob&employment=student&whyAttend=test&aboutSelf=test&reference=test&referral=&applyScholarship=no
An HTTP Response is the server replying to the client's original HTTP Request with a message and the requested resource
The HTTP Response Message is formatted in a similar way to the HTTP Request Message
[HTTP Version] [HTTP Status Code] [Reason Phrase]
The status line adheres to this format
Examples
HTTP/1.1 200 OK HTTP/1.0 404 Not Found HTTP/1.1 403 Forbidden HTTP/1.1 500 Internal Server Error HTTP/1.1 302 Found HTTP/1.1 304 Not Modified
Key value pairs separated by ":"
multiple values can be separated by ","
HTTP/1.1 200 OK Server: nginx/1.4.6 (Ubuntu) Date: Wed, 08 Jul 2015 22:31:15 GMT Content-Type: text/html; charset=utf-8 Content-Length: 40489 Connection: keep-alive
The body content contains the resource that was requested.
The headers usually contain metadata describing how to handle the body content.
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 08 Jul 2015 22:31:15 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 40489
Connection: keep-alive
<html class="no-js" lang="en">
<head>...
By DevLeague Coding Bootcamp
Basics