HTTP is HARD
Eric Redmond makes Riak
@coderoshi

Wednesday, November 13, 13
HTTP?
• Hyper-Text Transport Protocol
• Client Request -­‐> Server Response
• Stateless

Wednesday, November 13, 13
HTTP Response Codes
• HTTP/1.1 200 OK
• Ranges have meaning (classes)
•
•
•
•
•

Wednesday, November 13, 13

100-199 - Inf...
1xx - Informational
• 100 Continue
• 101 Switching Protocols
• 102 Processing

Wednesday, November 13, 13
2xx - Success
• 200 OK
• 201 Created
• 202 Accepted
• 203 Non-Authoritative Information
• 204 No Content
• ...
Wednesday, ...
3xx - Client Action
• 300 Multiple Choices
• 301 Moved Permanently
• 302 Found
• 303 See Other
• 304 Not Modified
• ...
Wed...
4xx - Client Error
• 400 Bad Request
• 401 Unauthorized
• 402 Payment Required
• 403 Forbidden
• 404 Not Found
• ...
Wedne...
5xx - Server Error
• 500 Internal Server Error
• 501 Not Implemented
• 502 Bad Gateway
• 503 Service Unavailable
• 504 Gat...
http://codes.io/200

Wednesday, November 13, 13
Client Methods
• POST
• GET
•
•
Wednesday, November 13, 13
Client Methods
• POST
• GET
• PUT
• DELETE
Wednesday, November 13, 13
Client Methods
• POST
• GET
• PUT
• DELETE
Wednesday, November 13, 13

• Create
• Read
• Update
• Delete
More Methods?
• HEAD
• OPTIONS
• TRACE
• CONNECT
• PATCH
Wednesday, November 13, 13
Learning from The
Wrong Way

Wednesday, November 13, 13
curl -H "Content-type: application/json" 
http://localhost:35357/v2.0/tokens 
-d '{"auth":{"passwordCredentials":
{"userna...
curl -H "Content-type: application/json" 
-H "Authorization: Basic am9ldXNlcjpzZWNyZXQ=" 
http://localhost:35357/v2.0/toke...
riak.com.cn
docs.basho.com
Wednesday, November 13, 13

汉语
English
https://raw.github.com/wiki/basho/webmachine/images/http-headers-status-v3.png
Wednesday, November 13, 13
Wednesday, November 13, 13
Wednesday, November 13, 13
A Sad History

Wednesday, November 13, 13
http://github.com/coderoshi/
webmachine-nodejs

Wednesday, November 13, 13
Parting Thoughts

Wednesday, November 13, 13
Upcoming SlideShare
Loading in …5
×

HTTP is Hard

1,427 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,427
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

HTTP is Hard

  1. 1. HTTP is HARD Eric Redmond makes Riak @coderoshi Wednesday, November 13, 13
  2. 2. HTTP? • Hyper-Text Transport Protocol • Client Request -­‐> Server Response • Stateless Wednesday, November 13, 13
  3. 3. HTTP Response Codes • HTTP/1.1 200 OK • Ranges have meaning (classes) • • • • • Wednesday, November 13, 13 100-199 - Informational 200-299 - Success 300-399 - Further Client Action 400-499 - Client Error 500-599 - Server Error
  4. 4. 1xx - Informational • 100 Continue • 101 Switching Protocols • 102 Processing Wednesday, November 13, 13
  5. 5. 2xx - Success • 200 OK • 201 Created • 202 Accepted • 203 Non-Authoritative Information • 204 No Content • ... Wednesday, November 13, 13
  6. 6. 3xx - Client Action • 300 Multiple Choices • 301 Moved Permanently • 302 Found • 303 See Other • 304 Not Modified • ... Wednesday, November 13, 13
  7. 7. 4xx - Client Error • 400 Bad Request • 401 Unauthorized • 402 Payment Required • 403 Forbidden • 404 Not Found • ... Wednesday, November 13, 13
  8. 8. 5xx - Server Error • 500 Internal Server Error • 501 Not Implemented • 502 Bad Gateway • 503 Service Unavailable • 504 Gateway Timeout • ... Wednesday, November 13, 13
  9. 9. http://codes.io/200 Wednesday, November 13, 13
  10. 10. Client Methods • POST • GET • • Wednesday, November 13, 13
  11. 11. Client Methods • POST • GET • PUT • DELETE Wednesday, November 13, 13
  12. 12. Client Methods • POST • GET • PUT • DELETE Wednesday, November 13, 13 • Create • Read • Update • Delete
  13. 13. More Methods? • HEAD • OPTIONS • TRACE • CONNECT • PATCH Wednesday, November 13, 13
  14. 14. Learning from The Wrong Way Wednesday, November 13, 13
  15. 15. curl -H "Content-type: application/json" http://localhost:35357/v2.0/tokens -d '{"auth":{"passwordCredentials": {"username": "joeuser", "password": "secret"}}}' Wednesday, November 13, 13
  16. 16. curl -H "Content-type: application/json" -H "Authorization: Basic am9ldXNlcjpzZWNyZXQ=" http://localhost:35357/v2.0/tokens Wednesday, November 13, 13
  17. 17. riak.com.cn docs.basho.com Wednesday, November 13, 13 汉语 English
  18. 18. https://raw.github.com/wiki/basho/webmachine/images/http-headers-status-v3.png Wednesday, November 13, 13
  19. 19. Wednesday, November 13, 13
  20. 20. Wednesday, November 13, 13
  21. 21. A Sad History Wednesday, November 13, 13
  22. 22. http://github.com/coderoshi/ webmachine-nodejs Wednesday, November 13, 13
  23. 23. Parting Thoughts Wednesday, November 13, 13

×