HTTP is Hard

23
HTTP is HARD Eric Redmond makes Riak @coderoshi Wednesday, November 13, 13

Transcript of HTTP is Hard

Page 1: HTTP is Hard

HTTP is HARDEric Redmond makes Riak

@coderoshi

Wednesday, November 13, 13

Page 2: HTTP is Hard

HTTP?

• Hyper-Text Transport Protocol

• Client Request -­‐> Server Response

• Stateless

Wednesday, November 13, 13

Page 3: HTTP is Hard

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

Page 4: HTTP is Hard

1xx - Informational

• 100 Continue

• 101 Switching Protocols

• 102 Processing

Wednesday, November 13, 13

Page 5: HTTP is Hard

2xx - Success

• 200 OK

• 201 Created

• 202 Accepted

• 203 Non-Authoritative Information

• 204 No Content

• ...

Wednesday, November 13, 13

Page 6: HTTP is Hard

3xx - Client Action

• 300 Multiple Choices

• 301 Moved Permanently

• 302 Found

• 303 See Other

• 304 Not Modified

• ...

Wednesday, November 13, 13

Page 7: HTTP is Hard

4xx - Client Error

• 400 Bad Request

• 401 Unauthorized

• 402 Payment Required

• 403 Forbidden

• 404 Not Found

• ...

Wednesday, November 13, 13

Page 8: HTTP is Hard

5xx - Server Error

• 500 Internal Server Error

• 501 Not Implemented

• 502 Bad Gateway

• 503 Service Unavailable

• 504 Gateway Timeout

• ...

Wednesday, November 13, 13

Page 9: HTTP is Hard

http://codes.io/200

Wednesday, November 13, 13

Page 10: HTTP is Hard

Client Methods

• POST

• GET

Wednesday, November 13, 13

Page 11: HTTP is Hard

Client Methods

• POST

• GET

• PUT

• DELETE

Wednesday, November 13, 13

Page 12: HTTP is Hard

Client Methods

• POST

• GET

• PUT

• DELETE

• Create

• Read

• Update

• Delete

Wednesday, November 13, 13

Page 13: HTTP is Hard

More Methods?

• HEAD

• OPTIONS

• TRACE

• CONNECT

• PATCH

Wednesday, November 13, 13

Page 14: HTTP is Hard

Learning from The Wrong Way

Wednesday, November 13, 13

Page 15: HTTP is Hard

curl -H "Content-type: application/json" \http://localhost:35357/v2.0/tokens \-d '{"auth":{"passwordCredentials":{"username": "joeuser", "password": "secret"}}}'

Wednesday, November 13, 13

Page 16: HTTP is Hard

curl -H "Content-type: application/json" \-H "Authorization: Basic am9ldXNlcjpzZWNyZXQ=" \http://localhost:35357/v2.0/tokens

Wednesday, November 13, 13

Page 17: HTTP is Hard

riak.com.cn 汉语docs.basho.com English

Wednesday, November 13, 13

Page 18: HTTP is Hard

https://raw.github.com/wiki/basho/webmachine/images/http-headers-status-v3.png

Wednesday, November 13, 13

Page 19: HTTP is Hard

Wednesday, November 13, 13

Page 20: HTTP is Hard

Wednesday, November 13, 13

Page 21: HTTP is Hard

A Sad History

Wednesday, November 13, 13

Page 23: HTTP is Hard

Parting Thoughts

Wednesday, November 13, 13