Communicating
on the
web


by

Adrian Cardenas (@aramonc)

hypertext 

transfer protocol



can't communicate 

without some 

common ground

Client

Server

http is stateless


The request

GET https://www.google.com/ HTTP/1.1
:version: HTTP/1.1
:method: GET
:scheme: https
:host: www.google.comuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36accept-encoding: gzip,deflate,sdchaccept-language: en-US,en;q=0.8,es-419;q=0.6,es;q=0.4accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8cookie: OGP=-3904011:; HSID=A0hmwhHriSEJzPSI; SSID=AKHSzv76RXaggJwJ; APISID=PXmCmOabqgrdcm_z/A7eIE7i4enNC0Hn0;

The Basics


 GET https://www.google.com/ HTTP/1.1

The Basics


 GET https://www.google.com/ HTTP/1.1

Methods / verbs

  • GET
  • POST
  • PUT
  • DELETE
  • HEAD
  • OPTIONS

The Basics


 GET https://www.google.com/ HTTP/1.1

The Basics


 GET https://www.google.com/ HTTP/1.1

COMMON HEADERS

 user-agent: Mozilla/5.0 (Macintosh; Intel 
 Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, 
 like Gecko) Chrome/31.0.1650.57 
 Safari/537.36

COMMON HEADERS

 accept-encoding: gzip,deflate,sdch
accept-language: en-US,en;q=0.8,es- 419;q=0.6,es;q=0.4
accept-charset: utf-8
accept: text/html,application/xhtml+xml, application/xml;q=0.9,image/webp,*/*;q=0.8

common headers

 cookie: OGP=-3904011:; 
 HSID=A0hmwhHriSEJzPSI; 
 SSID=AKHSzv76RXaggJwJ; 
 APISID=PXmCmOabqgrdcm_z/A7eIE7i4enNC0Hn0;

Not so common

 authorization: Basic 
 QWxhZGRpbjpvcGVuIHNlc2FtZQ==

NOT SO COMMON

 x-hello: world
 hello: world

request body

 
    Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   Larry
   --AaB03x
   Content-Disposition: form-data; name="files"; 
   filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --AaB03x--
   

Title

Communicating on the Web

By Adrian Cardenas

Communicating on the Web

HTTP (Hyper Text Transfer Protocol) regulates simple conversations between clients and servers, like placing an order in a restaurant. However, there are some gotchas like the server having short term memory requiring the client to repeat themselves. But don’t despair, HTTP helps reduce confusion with standardized requests and responses. By following these conventions developers are able to create amazing things not possible with just POST requests and 200 OK responses. In this talk Adrian Cardenas will review examples of clients and servers, as well as the stateless nature of HTTP. He will then go into more detail about headers discussing request methods, and common request headers. Good conversations cannot be one sided, so he will also cover common response headers as well as useful response status codes. Attendees will leave knowing the basics of how HTTP works, leading to better communication between input forms and server side processing, better security for sensitive areas of apps, and even API design for RESTful services.

  • 988