You are on page 1of 12

HTTP

2010.06.22


.................................................................................................................................................................... 3
HTTP URL ........................................................................................................................... 3
HTTP ........................................................................................................................... 3
HTTP ........................................................................................................................... 4
HTTP ................................................................................................................... 5
1.............................................................................................................................................. 5
2.............................................................................................................................................. 6
3.............................................................................................................................................. 7
4.............................................................................................................................................. 7
telnet http .................................................................................................8
1 telnet......................................................................................................................................... 8
2...................................................................................................................... 9
3.......................................................................................................................................... 9
4............................................................................................................................................ 10
HTTP ......................................................................................................................... 10
1.................................................................................................................................................... 10
2HTTP ................................................................................ 11
3HTTP Content Lenth ................................................................ 11
4 HTTP ................................................................... 11
5Http ........................................................................................................................... 11
6.................................................................................................................................................... 12

HTTP

HTTP
1990
WWW HTTP/1.0
HTTP/1.1 HTTP-NG(Next Generation of HTTP)

HTTP
1./
2. GETHEAD
POST HTTP HTTP

3.HTTP Content-Type
4.

5.HTTP

HTTP URL

HTTP
http TCP
HTTP1.1 Web HTTP
Web
HTTP URL (URL URI)
http://host[":"port][abs_path]
http HTTP host Internet IP
port 80abs_path URI URL
abs_path URI /
eg:
1www.guet.edu.cn
http://www.guet.edu.cn/
2http:192.168.0.116:8080/index.jsp

HTTP

HTTP
http

1 URI Method
Request-URI HTTP-Version CRLF
Method Request-URI HTTP-Version
HTTP CRLF CRLF CR LF

GET
Request-URI
POST
Request-URI
HEAD
Request-URI
PUT
Request-URI
DELETE Request-URI
TRACE

CONNECT
OPTIONS

GET GET
eg:GET /form.html HTTP/1.1 (CRLF)
POST
egPOST /reg.jsp HTTP/ (CRLF)
Accept:image/gif,image/x-xbit,... (CRLF)
...
HOST:www.guet.edu.cn (CRLF)
Content-Length:22 (CRLF)
Connection:Keep-Alive (CRLF)
Cache-Control:no-cache (CRLF)
(CRLF)
// CRLF
user=jeffrey&pwd=1234 //
HEAD GET HEAD HTTP
GET
Request-URI

2
3()

HTTP

HTTP
HTTP
HTTP
1
HTTP-Version Status-Code Reason-Phrase CRLF
HTTP-Version HTTP Status-Code

Reason-Phrase

1xx--
2xx--
3xx--
4xx--
5xx--

200 OK
//
400 Bad Request //
401 Unauthorized // WWW-Authenticate
//
403 Forbidden //
404 Not Found //eg URL
500 Internal Server Error //
503 Server Unavailable
//
//
egHTTP/1.1 200 OK CRLF
2
3

HTTP

HTTP
HTTP

CRLF

HTTP
+++

eg

Cache-Control
HTTP1.0
Pragma
no-cacheno-storemax-age
max-stalemin-freshonly-if-cached;

public private no-cache no-store no-transform


must-revalidateproxy-revalidatemax-ages-maxage.
eg IE JSP
response.sehHeader("Cache-Control","no-cache");
//response.setHeader("Pragma","no-cache");//
Cache-Control:no-cache
Date
Connection close

Accept
Accept egAcceptimage/gif
GIF Accepttext/html html
Accept-Charset
Accept-Charset eg
Accept-Charset:iso-8859-1,gb2312.

Accept-Encoding
Accept-Encoding Accept eg
Accept-Encoding:gzip.deflate.

Accept-Language
Accept-Language Accept eg
Accept-Language:zh-cn.

Authorization
Authorization
401 Authorization

Host
Host Internet HTTP URL
eg
http://www.guet.edu.cn/index.html
Host
Hostwww.guet.edu.cn
80Hostwww.guet.edu.cn:
User-Agent


User-Agent
User-Agent
User-Agent

GET /form.html HTTP/1.1 (CRLF)


Accept:image/gif,image/x-xbitmap,image/jpeg,application/x-shockwave-flas
h,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword,
*/* (CRLF)
Accept-Language:zh-cn (CRLF)
Accept-Encoding:gzip,deflate (CRLF)
If-Modified-Since:Wed,05 Jan 2007 11:21:25 GMT (CRLF)
If-None-Match:W/"80b1a4c018f3c41:8317" (CRLF)
User-Agent:Mozilla/4.0(compatible;MSIE6.0;Windows NT 5.0) (CRLF)
Host:www.guet.edu.cn (CRLF)
Connection:Keep-Alive (CRLF)
(CRLF)

3

Request-URI

Location
Location Location

Server
Server User-Agent

Server
ServerApache-Coyote/1.1
WWW-Authenticate
WWW-Authenticate 401 401
Authorization
egWWW-Authenticate:Basic realm="Basic Auth Test!" //

eg

Content-Encoding
Content-Encoding
Content-Type
Content-Encoding egContent-Encodinggzip
Content-Language
Content-Language

egContent-Language:da
Content-Length
Content-Length
Content-Type
Content-Type eg
Content-Type:text/html;charset=ISO-8859-1
Content-Type:text/html;charset=GB2312
Last-Modified
Last-Modified
Expires
Expires
()
Expires egExpiresThu15 Sep 2006 16:23:12
GMT
HTTP1.1 0eg
Expires 0 jsp
response.setDateHeader("Expires","0");

telnet http

MS telnet http
telnet http

1 telnet
1.1 telnet
-->cmd-->telnet
1.2 telnet

set localecho

2
2.1 open www.guet.edu.cn 80

//

HEAD /index.asp HTTP/1.0


Host:www.guet.edu.cn
/*,,*/
open www.guet.edu.cn 80
GET /index.asp HTTP/1.0
Host:www.guet.edu.cn
2.2 open www.sina.com.cn 80

//

// telnet www.sina.com.cn

80
HEAD /index.asp HTTP/1.0
Host:www.sina.com.cn

3
3.1 2.1 :
HTTP/1.1 200 OK
//
Server: Microsoft-IIS/5.0
//web
Date: Thu,08 Mar 200707:17:51 GMT
Connection: Keep-Alive
Content-Length: 23330
Content-Type: text/html
Expries: Thu,08 Mar 2007 07:16:51 GMT
Set-Cookie:ASPSESSIONIDQAQBQQQB=BEJCDGKADEDJKLKKAJEOIMMH; path=/
Cache-control: private
//
3.2 2.2 :
HTTP/1.0 404 Not Found

//

Date: Thu, 08 Mar 2007 07:50:50 GMT


Server: Apache/2.0.54 <Unix>
Last-Modified: Thu, 30 Nov 2006 11:35:41 GMT
ETag: "6277a-415-e7c76980"
Accept-Ranges: bytes
X-Powered-By: mod_xlayout_jh/0.0.1vhs.markII.remix
Vary: Accept-Encoding
Content-Type: text/html
X-Cache: MISS from zjm152-78.sina.com.cn
Via: 1.0 zjm152-78.sina.com.cn:80<squid/2.6.STABLES-20061207>
X-Cache: MISS from th-143.sina.com.cn
Connection: close

...

HTTP RFC2616 http://www.letf.org/rfc

http

HTTP

HTTP

1
FTP SMTP DNS
NNTP HTTP
(Proxy)(Gateway)(Tunnel) URI
URI

()

(Proxy)


(Gateway)

HTTP
(Tunnel) HTTP
HTTP
(Portal)
(Intermediary)

HTTP
2

HTTP 803128 8080 network port

HTTP Content Lenth


3HTTP
POST ContentLenth
ContentLenth:999999999 WEB
WEB
http://www.cnpaf.net/Class/HTTP/0532918532667330.html

4 HTTP
TCP

SYNFlood SYN
SmurfTearDrop ICMP Flood IP

19 Chargen Chargen_Denial_of_Service
Chargen UDP DOWN
WEB 2 1. Chargen 2. HTTP
IP N Chargen ConnectChargen
72

5Http
Http
Http Http
.Http TCP/IP , Http
Http , TCP/IP
,.

Banner , Apache Http


, Banner , Http Http
IIS Netscape, Banner Dll ,
,,. Banner

1HEAD/Http/1.0 Http
2DELETE/Http/1.0 , Delete
3GET/Http/3.0 Http
4GET/JUNK/1.0 Http
Http Httprint,,,
Http . Http

HTTP1.1 HTTP HTTP-NG

CSDN
http://blog.csdn.net/gueter/archive/2007/03/08/1524447.aspx

You might also like