Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Life Beyond HTTP

Anthony Eden
September 08, 2012

Life Beyond HTTP

Attention all rubyists, there is a world of protocols for you to experience beyond HTTP. In this talk I'll introduce you to some of them, including the one I'm most passionate about: DNS. I'll provide you with some examples of how to use existing libraries to talk various protocols using Ruby and maybe even get into some low-level bit slinging. We'll have a grand old time geeking out and in the end you might just find a protocol that you can fall in love with other than HTTP.

Example code available at https://github.com/aeden/life-beyond-http

Anthony Eden

September 08, 2012
Tweet

More Decks by Anthony Eden

Other Decks in Technology

Transcript

  1. “THE HYPERTEXT TRANSFER PROTOCOL (HTTP) IS AN APPLICATION-LEVEL PROTOCOL WITH

    THE LIGHTNESS AND SPEED NECESSARY FOR DISTRIBUTED, COLLABORATIVE, HYPERMEDIA INFORMATION SYSTEMS.” Friday, September 14, 12
  2. S: 220 smtp.example.com ESMTP Postfix C: HELO relay.example.org S: 250

    Hello relay.example.org, I am glad to meet you C: MAIL FROM:<[email protected]> S: 250 Ok C: RCPT TO:<[email protected]> S: 250 Ok C: RCPT TO:<[email protected]> S: 250 Ok C: DATA S: 354 End data with <CR><LF>.<CR><LF> C: From: "Bob Example" <[email protected]> C: To: "Alice Example" <[email protected]> C: Cc: [email protected] C: Date: Tue, 15 January 2008 16:02:43 -0500 C: Subject: Test message C: C: Hello Alice. C: This is a test message with 5 header fields and 4 lines in the message body. C: Your friend, C: Bob C: . S: 250 Ok: queued as 12345 C: QUIT S: 221 Bye Friday, September 14, 12
  3. FUN FACT: BEFORE DNS ALL COMPUTERS GRABBED HOSTS.TXT FROM A

    COMPUTER AT SRI Friday, September 14, 12
  4. +---------------------+ | Header | +---------------------+ | Question | the question

    for the name server +---------------------+ | Answer | RRs answering the question +---------------------+ | Authority | RRs pointing toward an authority +---------------------+ | Additional | RRs holding additional information +---------------------+ Friday, September 14, 12
  5. 1 1 1 1 1 1 0 1 2 3

    4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | / / / NAME / | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TYPE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | CLASS | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | TTL | | | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | RDLENGTH | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| / RDATA / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Friday, September 14, 12
  6. 1 1 1 1 1 1 0 1 2 3

    4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RCODE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | QDCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ANCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | NSCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ARCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Friday, September 14, 12
  7. DNS: IT’S MORE THAN A PROTOCOL IT’S A WAY OF

    LIFE! Friday, September 14, 12
  8. PUTTING THIS OPENLY AVAILABLE FOR FTP IN THE US MAY

    MAKE YOU ELIGIBLE FOR CHARGES ON ITAR VIOLATIONS, WITH PENALTIES UP TO 10 YEARS IN PRISON. Friday, September 14, 12
  9. •What APIs do you use that might be better as

    a protocol? •What are the characteristics of protocols that live long lives? •What APIs have YOU written that might make good protocols? Friday, September 14, 12