HTTP: request & response

 

Lonce Wyse

Communication & New Media

lonce.wyse@cnm.nus.sg

HTTP protocol

"Hypertext Transfer Protocol"

http://animatedsoundworks.com:8001/Your_Page.html?=b&x=y

protocol

path

host server

port

query

Other necessary info? 

sent automatically

Client makes a request to the server:

HTTP: request

HTTP: request

  • GETfetch an existing resource. The URL contains all the necessary information the server needs to locate and return the resource.
  • POSTcreate a new resource. POST requests usually carry a payload that specifies the data for the new resource
GET /dumprequest HTTP/1.1
Host: rve.org.uk
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36
Referer: https://www.google.com.sg/
Accept-Language: en-US,en;q=0.8
DNT: 1
Via: 1.1 swiftcache1-cc.network.nus.edu.sg
X-Forwarded-For: 172.16.76.227

HTTP: response

  • The most common code is 200 OK
  • 404 indicates that the resource is invalid and does not exist on the server.

Status codes:

Message body

  • text, html (files or dynamically created), etc

OK, let's write a server!

Made with Slides.com