HTTP Transfer Protocol-learning notes
- HTTP data transfer format
The basic format is:
- Request or answer Line
- Request or Answer Header
- Blank Line
- Data
- Post transfer format
- Underlying data communication:
Client Request:
post/response.php http/1.1???? ---request line
Accept:application/x-ms-application, Image/jpeg, Application/xaml+xml, Image/gif, Image/pjpeg, application/ X-MS-XBAP, */*
referer:http://local/
..................
Connection:keep-alive
Pragma:no-cache
?
w=12&h=23&s=276
Server Answer:
http/1.1 OK???? ---request line
Date:thu, 15:08:17 GMT???? ---request header
............
Content-type:text/html
?
??????????? 276???? ---response information
?
- PHP Implementation method:
Form page PHP:
<form action= "response.php" method= "POST" >
<input type= "Text" Name= "W" ><br>
<input type= "text" name= "H" ><br>
..................
<input type= "text" name= "S" >
<input type= "Submit" >
</form>
Answer page PHP:
Can use $_post["s"]; method to get the value of the uploaded variable, preferably using a script for validation
- Summarize:
The Post method places the data in the data section
- Get transfer format
- Underlying data communication
Client Request:
get/response.php?w=12&h=122&s=1464 http/1.1
Accept:application/x-ms-application, Image/jpeg, Application/xaml+xml, Image/gif, Image/pjpeg, application/ X-MS-XBAP, */*
..................
Connection:keep-alive
Server Answer:
http/1.1 OK
Date:thu, Jan 15:39:56 GMT
............
Content-type:text/html
?
??????????? 1464
- PHP Implementation method:
Form page PHP:
<form action= "response.php" method= "Get" >
<input type= "Text" Name= "W" ><br>
<input type= "text" name= "H" ><br>
..................
<input type= "text" name= "S" >
<input type= "Submit" >
</form>
Answer page PHP:
Can use $_get["s"]; method to get the value of the uploaded variable, preferably using a script for validation
- Summarize:
The Get method puts the data in the header in terms of the data transfer
- Error response Format
|
Take value |
Describe |
|
1xx |
Keep. |
|
2xx |
Successful reception, such as "200", indicates successful processing. |
|
3xx |
The customer needs to refine the request further. |
|
4xx |
A client error, such as "404", means that the specified resource for access does not exist. |
|
5xx |
Server error. |
?
?
?
?
?
?
?
?
users can set the wrong answer page in the. htaccess file
- Summarize
This article introduces the basic format of HTTP communication, detailed protocol format definition can refer to HTTP1.1 (RFC2616 document), as for port monitoring can use Fiddler2 software for the bottom view, the software is cracked green version, can be easily done.
Fiddler can monitor the local server port for easy debugging and can modify the 127.0.0.1 in the Hosts file as:
Local 127.0.01
In the browser directly in the address bar to enter local, if you need to only monitor the local address in the Fiddler, then set the use of filters in the filter, and in the only display of the following host in the edit box to display only local data communications information, In addition, you can see the underlying detailed communication data in the raw bar, which is plain text and convenient for analysis.
?
?
?
^_^ Bruce Lone
2015-1-30
HTTP Transfer Protocol