get:查
post:改
put:增
delete:删
一般來說隻使用get/post
請求頭:
格式如下:
<code></code>
<request-line>
<headers>
<blank line>
[<request-body>]
請求行(request line):用來說明請求類型、要通路的資源以及使用的http版本\
頭域(header):用來說明伺服器要使用的附加資訊
空行(blank line):用來隔開頭域和請求主體
對于www.baidu.com的get請求如下所示:
get / http/1.1
host: www.baidu.com
user-agent: mozilla/5.0 (windows; u; windows nt 5.1;
en-us; rv:1.7.6)
gecko/20050225 firefox/1.0.1
connection: keep-alive
以下就是一個典型的post請求:
post / http/1.1
content-type: application/x-www-form-urlencoded
content-length: 40
name=professional%20ajax&publisher=wiley
響應頭:
http響應的格式與請求的格式十分類似:
<status-line>
[<response-body>]
一個http響應的例子:
http/1.1 200 ok
date: sat, 31 dec 2005 23:59:59 gmt
content-type: text/html;charset=iso-8859-1
content-length: 122
<html>
<head>
<title>wrox homepage</title>
</head>
<body>
<!-- body goes here -->
</body>
</html>