1 HTTP/HTTPS
· Link Style
http://host[:port][path[?querystring]]
Example:
http://www.gotoweb.com:8080/login/Front?username=user&defID=myId
· Protocols
HTTP = Hypertext Transfer Protocol
HTTPS = Hypertext Transfer Protocol Secure
Wiki: http://www.w3.org/Protocols/rfc2616/rfc2616.html
· Default Portss
HTTP – 80;
HTTPS – 443
· TLS/SSL for HTTPS
TLS = Transport Layer Security
SSL = Secure Socket Layer
· Libraries
Language |
HTTP Library |
TLS/SSL |
C# |
System.Net.HttpWebRequest |
|
C/C++ |
LibcURL; QHTTP(QT) |
OpenSSL; GnuTLS;Mozilla NSS/NSPR |
Java |
Restlet |
|
Python |
urllib2/ httplib/ httplib2 |
|
PHP |
PHP Curl Module. PHP Binding of LibcURL |
|
JavaScript |
XMLHttpRequest |
Pay attention to License and see if they can be used in your distribution, especially OpenSSL.
· Request
· Response
· HTTP Headers
HTTPHeader::kAccept, _DNTN("Accept")
HTTPHeader::kAccept_Charset, _DNTN("Accept-Charset")
HTTPHeader::kAccept_Encoding, _DNTN("Accept-Encoding")
HTTPHeader::kAccept_Language, _DNTN("Accept-Language")
HTTPHeader::kAccept_Ranges, _DNTN("Accept-Ranges")
HTTPHeader::kAge, _DNTN("Age")
HTTPHeader::kAllow, _DNTN("Allow")
HTTPHeader::kAuthorization, _DNTN("Authorization")
HTTPHeader::kCache_Control, _DNTN("Cache-Control")
HTTPHeader::kConnection, _DNTN("Connection")
HTTPHeader::kContent_Encoding, _DNTN("Content-Encoding")
HTTPHeader::kContent_Language, _DNTN("Content-Language")
HTTPHeader::kContent_Length, _DNTN("Content-Length")
HTTPHeader::kContent_Location, _DNTN("Content-Location")
HTTPHeader::kContent_MD5, _DNTN("Content-MD5")
HTTPHeader::kContent_Range, _DNTN("Content-Range")
HTTPHeader::kContent_Type, _DNTN("Content-Type")
HTTPHeader::kDate, _DNTN("Date")
HTTPHeader::kETag, _DNTN("ETag")
HTTPHeader::kExpect, _DNTN("Expect")
HTTPHeader::kExpires, _DNTN("Expires")
HTTPHeader::kFrom, _DNTN("From")
HTTPHeader::kHost, _DNTN("Host")
HTTPHeader::kIf_Match, _DNTN("If-Match")
HTTPHeader::kIf_Modified_Since, _DNTN("If-Modified-Since")
HTTPHeader::kIf_None_Match, _DNTN("If-None-Match")
HTTPHeader::kIf_Range, _DNTN("If-Range")
HTTPHeader::kIf_Unmodified_Since, _DNTN("If-Unmodified-Since")
HTTPHeader::kLast_Modified, _DNTN("Last-Modified")
HTTPHeader::kLocation, _DNTN("Location")
HTTPHeader::kMax_Forwards, _DNTN("Max-Forwards")
HTTPHeader::kPragma, _DNTN("Pragma")
HTTPHeader::kProxy_Authenticate, _DNTN("Proxy-Authenticate")
HTTPHeader::kProxy_Authorization, _DNTN("Proxy-Authorization")
HTTPHeader::kRange, _DNTN("Range")
HTTPHeader::kReferer, _DNTN("Referer")
HTTPHeader::kRetry_After, _DNTN("Retry-After")
HTTPHeader::kServer, _DNTN("Server")
HTTPHeader::kTE, _DNTN("TE")
HTTPHeader::kTrailer, _DNTN("Trailer")
HTTPHeader::kTransfer_Encoding, _DNTN("Transfer-Encoding")
HTTPHeader::kUpgrade, _DNTN("Upgrade")
HTTPHeader::kUser_Agent, _DNTN("User-Agent")
HTTPHeader::kVary, _DNTN("Vary")
HTTPHeader::kVia, _DNTN("Via")
HTTPHeader::kWarning, _DNTN("Warning")
HTTPHeader::kWWW_Authenticate, _DNTN("WWW-Authenticate")
HTTPHeader::kContent_Disposition, _DNTN("Content-Disposition")
HTTPHeader::kInvalid, _DNTN("Invalid")
· HTTP Methods
// HTTP Method: Standard, WebDAV, MS Exchange.
//
// >> RFC 2616
// Hypertext Transfer Protocol -- HTTP/1.1
// http://www.ietf.org/rfc/rfc2616
//
// OPTIONS
// GET
// HEAD
// POST
// PUT
// DELETE
// TRACE
// CONNECT
// >> RFC 2518
// HTTP Extensions for Distributed Authoring -- WEBDAV
// http://www.ietf.org/rfc/rfc2518
//
// PROPFIND
// PROPPATCH
// MKCOL
// COPY
// MOVE
// LOCK
// UNLOCK
// >> RFC 3253
// Versioning Extensions to WebDAV(Web Distributed Authoring and Versioning)
// http://www.ietf.org/rfc/rfc3253
//
// VERSION-CONTROL
// REPORT
// CHECKOUT
// CHECKIN
// UNCHECKOUT
// MKWORKSPACE
// UPDATE
// LABEL
// MERGE
// BASELINE-CONTROL
// MKACTIVITY
// >> RFC 3648
// Web Distributed Authoring and Versioning (WebDAV) - Ordered Collections Protocol
// http://www.ietf.org/rfc/rfc3648
//
// ORDERPATCH
// >> RFC 3744
// Web Distributed Authoring and Versioning (WebDAV) - Access Control Protocol
// http://ietf.org/rfc/rfc3744
//
// ACL
// >> Microsoft WebDAV
// Microsoft invented WebDAV methods that are used to interact with the Exchange store.
// http://msdn.microsoft.com/en-us/library/aa142917%28EXCHG.65%29.aspx
//
// BCOPY
// BDELETE
// BMOVE
// BPROPFIND
// BPROPPATCH
// NOTIFY
// POLL
// SUBSCRIBE
// UNSUBSCRIBE
// X-MS-ENUMATTS
//
Not all methods are supported on HTTP Server.
Not all methods are supported by HTTP Libraries; some only support GET and POST methods.
Do not think Get method is just used for Getter.
It’s a GET method but it’s really used to add bookmark https://api.del.icio.us/v1/posts/add
In some cases, almost all requests are using POST, such as XMLRPC/SOAP.
· Response Code
Some Typical reponse codes:
200 (“OK”)
Everything’s fine.
400 (“Bad Request”)
There’s a problem on the client side.
500 (“Internal Server Error”)
There’s a problem on the server side.
404 (“Not Found”)
Sent when the client requests a URI that doesn’t map to any resource. 404 is used
when the server has no clue what the client is asking for.
SOAP web services use only the status codes 200 (“OK”) and 500 (“Internal Server Error”).
· HTTP Date Time
// Three formats supported for HTTP Date Time.
// Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
// Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
// Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
// Sun, 06 Nov 1994 08:49:37 +0000 ; RFC 2822 (AWS S3 uses this)