Django Learning----HTTP protocol

Source: Internet
Author: User
Tags webp

Understanding the format of the HTTP protocol

Request Agreement: Requests

Request first line: Contains the request method (such as Get, POST) URL protocol version

Request Header: Request information

Blank line:

Request data: Information related to the content of the Web page

The difference between get and post:

The GET request data on the data is not placed behind the URL in the request body, and the amount of data is limited

Post no data limit {form: adjust method= "POST"}

      

The address bar directly gives the address must be GET request {Address bar request, form (default)}

  

1, the host requests the Web server domain name Address 2, the User-agenthttp client runs the browser type details. With this header information, the Web server can determine the type of browser for the HTTP request client. 3, accept specifies the content type that the client can receive, the order of the content type indicates the order that the customer receives 4, Accept-lanuage specifies the language that the HTTP client browser uses to display the preferred choice of return information 5, accept-encoding specifies that the Web server that the client browser can support returns the content compression encoding type. Indicates that the server is allowed to compress the output before it is sent to the client to conserve bandwidth. The return compression format that the client browser can support is set here. 6, accept-charsethttp the client browser can accept the character encoding set 7, Content-type displays the content type submitted by this HTTP request. This property is typically only required for post submission. There are two encoding types for the Content-type property value: (1) "application/x-www-form-urlencoded": the type of encoding the form data is submitted to the server, The default defaults are "application/x-www-form-urlencoded".     However, this encoding is inefficient when sending large amounts of text to the server, including text or binary data that contains non-ASCII characters. (2) "Multipart/form-data": When the file is uploaded, the type of encoding used should be "Multipart/form-data", which can both send text data and support binary data upload. You can use "application/x-www-form-urlencoded" when committing to form data, and when you commit a file, you need to use the "multipart/form-data" encoding type.

  

 get/562f25980001b1b106000338.jpg http/1.1   Host img.mukewang.comUser -agent mozilla/5.0  (Windows NT 10.0 ; WOW64) Applewebkit/537.36  (khtml, like Gecko) chrome/ 51.0 . 2704.106  safari/537.36  accept image /webp,image/*  ,  */ *;q=0.8  referer http:  // www.imooc.com/ Accept-encoding gzip, deflate, sdchaccept -language zh-cn,zh;q=0.8  
Get
POST/HTTP1. 1 Host:www.wrox.comUser-agent:mozilla/4.06.05.12.0. 50727 3.0. 04506.648 3.5. 21022 ) Content-type:application/x-www-form-urlencodedcontent-length:  Connection:keep-alivename=professional%20ajax&publisher=wiley
Post

 

HTTP protocol Format Request protocol request first line: Method URL protocol version request header: Request information Blank line: Request data GET URL http1.1Accept:text/html,application/xhtml+xml,application/xml;q=0.9, image/webp,image/apng,*/*; q=0.8 accept-encoding:gzip, deflate, BR accept-language:zh-cn,zh;q=0.8 Cache-control:max -age=0 connection:keep-alive cookie:baiduid=88ecf89623bca604e91b4c2250fe0f69:fg=1; bidupsid=88ecf89623bca604e91b4c2250fe0f69; pstm=1499646358; bduss= Vfsetdvbgneqwxzzfdqb21wze1pr2zssnbtww5lfnpuu1hjcei4vgj4whdyt0zasvfbqufbjcqaaaaaaaaaaaeaaad3ixbgbghmndu3mwaaaaaaaaaaaaaaaa Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaapdpuvnwz7lzo; CFLAG=4%3A3; bd_home=1; h_ps_pssid=1420_13290_21127_20242_24023_20718; bd_upn=12314353 Host:www.baidu.com upgrade-insecure-requests:1 user-agent:mozilla/5.0 (Wi Ndows NT 6.1; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/61.0.3163.100 safari/537.36 username= "Yuan" pwd=123 get requests common operations: 1. Give the URL directly in the address bar of the browser, then it must be GET request 2. Clicking on a hyperlink on the page must also be a GET request 3.     When a form is submitted, the form uses the GET request by default, but can be set to postResponse Protocol (response) Response First line response header blank line response content HTTP 1.1 OK bdpagetype:2 bdqid:0x9d4742100000b7c6 bduserid:117546290 3 cache-control:private connection:keep-alive Content-encoding:gzip content-ty            Pe:text/html;charset=utf-8 Date:thu, Oct 01:58:07 GMT Expires:thu, Oct 01:58:06 GMT server:bws/1.1 set-cookie:bdsvrtm=249; path=/set-cookie:bd_home=1; path=/set-cookie:h_ps_pssid=1420_13290_21127_20242_24023_20718; path=/; domain=.baidu.com strict-transport-security:max-age=172800 transfer-encoding:chunked X-Ua -compatible:ie=edge,chrome=1
HTTP protocol Format

First line

    1. Request url:https://www.baidu.com/
    2. Request Method:get
    3. Status Code:$ OK
    4. Remote address:111.13.100.91:443
    5. Referrer Policy:no-referrer-when-downgrade

The following is the relevant request of Baidu Hedear

      1. Accept: (Tell the server what can be rendered (q: Weight */* I can render so content)) text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/ apng,*/*;q=0.8
      2. Accept-encoding: (supported compression formats) gzip, deflate, BR
      3. Accept-language: (I can support the language) zh-cn,zh;q=0.8
      4. Connection: (The HTTP version (1.0 (Close)/1.1 (keep-alive) differs in whether or not the access is broken immediately after completion)) keep-alive
      5. Cookie: (Can be understood as a container, the website gives the random key-value pairs (understood as identity information)) Baiduid=6e4258c5b7906eb4f2cf046d0878752c:fg=1; pstm=1505553583; bidupsid=9f93b6827fe1722f86b831913432d897; bd_upn=12314753; bd_home=0; h_ps_pssid=1427_21085_20927
      6. Host:www.baidu.com
      7. Upgrade-insecure-requests: (Upgrade (with HTTP and HTTPS-related) parameter default upgrade) 1
      8. User-agent: (The user agent (tell me what software is on what operating system is sent)) mozilla/5.0 (Windows NT 10.0; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/61.0.3163.79 safari/537.36

Response protocol: Response

    

      1. Bdpagetype:1
      2. Bdqid:0x8655726500017a00
      3. bduserid:0
      4. Cache-control:private
      5. Connection:keep-alive
      6. Content-encoding:gzip
      7. content-type:text/html; Charset=utf-8
      8. cxy_all:baidu+b7ce8850976e75ce963ceab5f0b07995
      9. Date:thu, Oct 10:34:33 GMT
      10. Expires:thu, Oct 10:34:16 GMT
      11. server:bws/1.1
      12. set-cookie:bdsvrtm=0; path=/
      13. set-cookie:bd_home=0; path=/
      14. set-cookie:h_ps_pssid=1427_21085_20927; path=/; Domain=.baidu.com
      15. strict-transport-security:max-age=172800
      16. Transfer-encoding:chunked
      17. Vary:accept-encoding
      18. x-powered-by:hphp
      19. X-ua-compatible:ie=edge,chrome=1

Django Learning----HTTP protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.