Document directory
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: kntct, _ dntn ("CT ")
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 ("")
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 appsted 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.
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)