---
title: "http协议请求行，状态行，响应状态行"
author: "prodream"
date: "2008-09-09T21:19:00Z"
tags: []
slug: "http"
draft: false
lastmod: "2008-09-09T21:19:00Z"
id: 578005
url: "https://prodream.iteye.com/blog/578005"
---

1.请求行  
格式：请求方式 资源路径 HTTP版本号&lt;CRLF&gt;  
举例：GET/test.html HTTP/1.1  
请求方式：POST,HEAD,OPTIONS,DELETE,TRACE,PUT

2.状态行  
格式：HTTP版本号 状态号 原因描述&lt;CRLF&gt;  
举例：HTTP/1.1 200 OK

实例：  
TELNET localhost 8080  
ctr+] //组合键打开本地回显  
GET /test.html HTTP/1.0  
ENTER  
ENTER  
不需加头字段

TELNNET localhost 8080  
ctr+]  
GET /test.html HTTP/1.1  
ENTER  
Host:  
ENTER

使用get和post方式传递参数  
@在url大志后面可以附加一些参数  
[http://www.prodream.com](http://www.prodream.com/)？param1=abc&param2=xyz  
@get方式 默认的表单字段值传递方式  
例如：GET /servlet/ParamsServlet?param1=abc&param2=xyz HTTP/1.1  
Host:  
传输的数据量有限制，一般为1kb以下  
@POST方式

POST /servlet/ParamsServlet?param1=abc&param2=xyz HTTP/1.1  
Host:  
Content-Type:application/x-www-form-urlendoded  
Content-Length:28

3.状态码![](http://p.blog.csdn.net/images/p_blog_csdn_net/li_jinjian2005/448502/o_prodream_1.bmp)![](http://p.blog.csdn.net/images/p_blog_csdn_net/li_jinjian2005/448502/o_prodream_2.bmp)