HTTP is Hard
-
Upload
pdx-web-design -
Category
Technology
-
view
893 -
download
0
Transcript of HTTP is Hard
HTTP is HARDEric 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)
• 100-199 - Informational
• 200-299 - Success
• 300-399 - Further Client Action
• 400-499 - Client Error
• 500-599 - Server Error
Wednesday, November 13, 13
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, November 13, 13
3xx - Client Action
• 300 Multiple Choices
• 301 Moved Permanently
• 302 Found
• 303 See Other
• 304 Not Modified
• ...
Wednesday, November 13, 13
4xx - Client Error
• 400 Bad Request
• 401 Unauthorized
• 402 Payment Required
• 403 Forbidden
• 404 Not Found
• ...
Wednesday, November 13, 13
5xx - Server Error
• 500 Internal Server Error
• 501 Not Implemented
• 502 Bad Gateway
• 503 Service Unavailable
• 504 Gateway Timeout
• ...
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
• Create
• Read
• Update
• Delete
Wednesday, November 13, 13
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":{"username": "joeuser", "password": "secret"}}}'
Wednesday, November 13, 13
curl -H "Content-type: application/json" \-H "Authorization: Basic am9ldXNlcjpzZWNyZXQ=" \http://localhost:35357/v2.0/tokens
Wednesday, November 13, 13
riak.com.cn 汉语docs.basho.com English
Wednesday, November 13, 13
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