Life Beyond HTTP

31254903db793bf6f84bbd607fe092fd?s=47 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

31254903db793bf6f84bbd607fe092fd?s=128

Anthony Eden

September 08, 2012
Tweet

Transcript

  1. LIFE BEYOND HTTP Anthony Eden @aeden DNSimple Friday, September 14,

    12
  2. “A SET OF PROCEDURES TO BE FOLLOWED WHEN COMMUNICATING” Friday,

    September 14, 12
  3. HTTP Friday, September 14, 12

  4. RFC 1945 (1996) HTTP 1.0 Friday, September 14, 12

  5. “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
  6. I <3 HTTP Friday, September 14, 12

  7. HTTP IS UBIQUITOUS Friday, September 14, 12

  8. HTTP IS SIMPLE Friday, September 14, 12

  9. HTTP IS FLEXIBLE Friday, September 14, 12

  10. BUT THERE IS LIFE BEYOND HTTP Friday, September 14, 12

  11. LET’S MAKE SOME (NOT SO) NEW FRIENDS Friday, September 14,

    12
  12. SMTP Friday, September 14, 12

  13. SIMPLE MAIL TRANSPORT PROTOCOL Friday, September 14, 12

  14. RFC 788 (1981) OBSOLETED BY RFC 822 Friday, September 14,

    12
  15. FUN FACT: MAIL USED TO RELY ON FTP Friday, September

    14, 12
  16. 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:<bob@example.org> S: 250 Ok C: RCPT TO:<alice@example.com> S: 250 Ok C: RCPT TO:<theboss@example.com> S: 250 Ok C: DATA S: 354 End data with <CR><LF>.<CR><LF> C: From: "Bob Example" <bob@example.org> C: To: "Alice Example" <alice@example.com> C: Cc: theboss@example.com 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
  17. DNS Friday, September 14, 12

  18. DOMAIN NAME SYSTEM Friday, September 14, 12

  19. RFC 1034, 1034 AND MANY, MANY MORE (1987) Friday, September

    14, 12
  20. FUN FACT: BEFORE DNS ALL COMPUTERS GRABBED HOSTS.TXT FROM A

    COMPUTER AT SRI Friday, September 14, 12
  21. +---------------------+ | 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
  22. 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
  23. 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
  24. DNS: IT’S MORE THAN A PROTOCOL IT’S A WAY OF

    LIFE! Friday, September 14, 12
  25. XMPP Friday, September 14, 12

  26. EXTENSIBLE MESSAGING AND PRESENCE PROTOCOL Friday, September 14, 12

  27. RFC 3920-3923 (2004) Friday, September 14, 12

  28. EXAMPLE OMITTED TO SAVE YOUR EYEBALLS. Friday, September 14, 12

  29. IRC Friday, September 14, 12

  30. INTERNET RELAY CHAT Friday, September 14, 12

  31. RFC 1459 (1993) Friday, September 14, 12

  32. SSH Friday, September 14, 12

  33. SECURE SHELL Friday, September 14, 12

  34. RFC 4250-4256 (2006) Friday, September 14, 12

  35. FUN FACT: THE ORIGINAL ANNOUNCEMENT INCLUDED THE FOLLOWING... Friday, September

    14, 12
  36. 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
  37. AMERICA, FUCK YEAH! Friday, September 14, 12

  38. STOMP Friday, September 14, 12

  39. STREAMING TEXT ORIENTED MESSAGING PROTOCOL Friday, September 14, 12

  40. RFCS ARE FOR KIDS, SILLY! Friday, September 14, 12

  41. CONNECT accept-version:1.1 host:stomp.github.org ^@ CONNECTED version:1.1 ^@ SEND destination:/queue/a content-type:text/plain

    hello queue a ^@ Friday, September 14, 12
  42. SUBSCRIBE ID:0 DESTINATION:/QUEUE/FOO ACK:CLIENT ^@ MESSAGE SUBSCRIPTION:0 MESSAGE-ID:007 DESTINATION:/QUEUE/A CONTENT-TYPE:TEXT/PLAIN

    HELLO QUEUE A^@ Friday, September 14, 12
  43. DISCONNECT receipt:77 ^@ RECEIPT receipt-id:77 ^@ Friday, September 14, 12

  44. SPDY Friday, September 14, 12

  45. MULTIPLEXED HTTP Friday, September 14, 12

  46. CHROMIUM.ORG/SPDY/SPDY-PROTOCOL/SPDY-PROTOCOL-DRAFT2 Friday, September 14, 12

  47. REQUEST PRIORITIZATION Friday, September 14, 12

  48. COMPRESSED HEADERS Friday, September 14, 12

  49. SERVER-PUSHED STREAMS Friday, September 14, 12

  50. APPLICATION PROTOCOLS ARE FUN... Friday, September 14, 12

  51. BUT WHAT ABOUT TRANSPORT PROTOCOLS? Friday, September 14, 12

  52. TCP Friday, September 14, 12

  53. TRANSMISSION CONTROL PROTOCOL Friday, September 14, 12

  54. RELIABLE, ORDERED STREAM OF OCTETS Friday, September 14, 12

  55. UDP Friday, September 14, 12

  56. USER DATAGRAM PROTOCOL Friday, September 14, 12

  57. NO GUARANTEE OF DELIVERY, ORDERING OR DUPLICATE PROTECTION Friday, September

    14, 12
  58. AVOIDS OVERHEAD Friday, September 14, 12

  59. TO THE CODE! Friday, September 14, 12

  60. PROTOCOLS ARE AWESOME Friday, September 14, 12

  61. KNOW THEM. Friday, September 14, 12

  62. USE THEM. Friday, September 14, 12

  63. LOVE THEM. Friday, September 14, 12

  64. THREE QUESTIONS Friday, September 14, 12

  65. •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
  66. THANK YOU, BARUCO Friday, September 14, 12

  67. LIFE BEYOND HTTP Anthony Eden @aeden DNSimple Friday, September 14,

    12