HTTP précis-writers

Source: Internet
Author: User

  Considerations?1.     What are some of the common protocols in Url2.    url 3.     What is the HTTP protocol 4.    http is doing 5.     why to use the HTTP protocol 6.     The communication process of the HTPP protocol describes the 1.    HTTP request 2.    http Response 7.     Selection of HTTP requests 1.     Comparison of two ways of sending requests (scenario) 2.    get Request 3.     Post request 8.     How to send an HTTP request 1.     Apple native send Way 2.     through a third-party framework   1  What is a URL before we introduce HTTP, we have a certain understanding of the URL, because only through the URL we can get the resources on the network. So what exactly is a URL? URL (Uniform Resource locator  Uniform Resource Locator): The URL is actually the resources on the Internet address, location, every resource on the Internet has a unique URL, only through the URL we can find the only resources on the Internet. The basic composition of the URL: protocol://Host address/Path   protocol: Different protocols determine different resource lookup and transmission methods host address: The IP address path of the resource host (server): The resource is  2 in the host (server) location. There are several common protocols in URLs that understand what URLs are, so what are the HTTP protocols commonly used in URLs? l   http://  Hypertext Transfer Protocol, the way to access remote network resources, is also our most commonly used protocol l   ftp://  access to shared host resources of the way L    file://&nbspAccess to local computer resources l   mailto://  How to access e-mail addresses note: Spaces and special symbols such as Chinese are not available in the URL .        1>url, all characters must be  ASCII  code;       2> Chinese and special symbols (such as spaces) cannot appear in the URL;  so if Chinese appears in  URL , you need to add a percent translation. urlstring=[ urlstringstringbyaddingpercentescapesusingencoding:nsutf8stringencoding];3.  what is the HTTP protocol HTTP protocol (HyperText Tranfer protocol  Hypertext Transfer Protocol): HTTP specifies how data is transferred between the client and the server. HTTP underlying principle: the bottom of the HTTP is through the socket to establish a connection to the communication pipeline, to achieve data transmission. HTTP is a TCP Transport protocol (mode) that is a reliable and secure protocol. The HTTP protocol is the most commonly used protocol in network development. Access to network resources is often using the HTTP protocol, whether it is a mobile client or a PC. What  4.http is doing with the HTTP function can be summarized in a nutshell: Make the data of the client and the server valid for transmission.  5. Why use the HTTP protocol (the advantage of the HTTP protocol) 1.     flexible: The HTTP protocol allows the transmission of various types of data. 2.     is simple and fast: The HTTP protocol is simple and the transmission speed is fast. Because the protocol is simple and the HTTP server is small, the communication speed is fast. The 3.    http protocol is a short connection (non-persistent connection): The HTTP limit handles only one request per connection, and the server disconnects when it responds to the request, saving transmission time. (this is used after HTTP 0.9/1.0)  6. The communication process of the HTPP protocol to understand the introduction of the HTTP protocol, continue to understand the HTTP protocol communication process, HTTP communication process contains two aspects:   http Request: The client wants the server-side data HTTP protocol requirements: a completeHTTP protocol to contain three parts:  request line, request header, request body l    request line: Main include request method, request path, HTTP protocol version "get/resources/images/http/1.1" L     Request Header: Mainly contains the description of the client environment, the host address information requested by the client. host:192.168.38.24:8080 class= "Apple-tab-span" >//  the server host address that the client wants to access  accept:text/html //   The type of data the client can receive accept-language:zh-cn //  the client's locale accept-encoding:gzip //  The client supports the data compression format host: m.baidu.com //  client wants to access the server host address user-agent:mozilla/5.0 (Macintosh; Intel Mac OS x 10.10; rv:37.0) gecko/20100101firefox/37.0 //  The type of client, the client's software environment l    the request body: specific data that the client sends to the server, such as File/data  http response: The server returns the client wants the data client to send a request to the server, the server should respond, that is, return data to the client HTTP protocol provisions: A complete HTTP response contains the following content:l    Status line: Contains the HTTP protocol version, status, status code corresponding to the English name http/1.1 okl    response header: Contains a description of the server, a description of the returned data.         Content-Encoding:gzip //  data compression formats supported by the server          Content-Length:  1528 //  the length of the returned data         content-type:  application/xhtml+xml;charset=utf-8 //  Returns the type of data         date:mon, 15 jun 2015 09:06:46  GMT //  Response Time  Server:apache  //  server type l    entity content: Specific data returned by the server to the client (Picture/html/file ...) 7. Selection of HTTP requests 1. A simple description of HTTP requests 1.HTTP methods The HTTP protocol defines a number of methods that correspond to different resource operations, the most common of which is the get  and  POST  methods. Get, POST, OPTIONS, HEAD, PUT, DELETE, TRACE, CONNECT, patch :put  delete:delete :post  check: Get because   get  and  POST  can do all of the above, so in real-world development, we can only use get  and  POST  methods. 2. Parameters when interacting with the server, Sometimes you need to send some data to the server, such as the need to send a user name and password when logging in. Parameter: refers to the specific data that is passed to the server.  2. get request get: The essence is to get data from the server, more efficient. And get requests can be cached. Note:   Network cache data, stored in SQLite's database (path: Nshomedirectory ()). The parameters that are sent to the server are followed by the request  URL  followed by  ? , and the parameters are stitched together in the form of   parameter name = argument value, and multiple parameters are separated by  & . Note: The length of the get is limited, and different browsers have different length limits, typically between 2~8k.  3. post Request Post: The essence is to send data to the server, you can also get the result after the server processing, less efficient than GET.PThe OST request cannot be cached, and the form must be resubmitted after each refresh. The parameters sent to the server are all placed in the ' request body '; In theory, there is no limit to the amount of data that can be transmitted by post. Note: All data related to user privacy (password/bank card number ...) Must be delivered by post. 4. The selection of Get and post requests can be made using the following four principles: 1. If you want to pass large amounts of data, such as file uploads, you can only use post to request 2.GET security than post, if it contains confidential \ sensitive information, POST3 is recommended. If you only request data (data query), we recommend the use of GET4. If you are adding, modifying, and deleting data, we recommend that you use the post 8.  how to send HTTP request suggestions: In order to improve development efficiency, enterprise development is basically a third-party framework 1.   Apple native Send request L   nsurlconnection: Simple to use, the oldest and most classic one of the most direct solutions L   nsurlsession:ios 7 new technology , features more powerful than nsurlconnection l   cfnetwork:nsurl*, pure C language  2.  third-party framework l    ASIHTTPRequest: Nickname "http Terminator", the function is extremely powerful, unfortunately has already stopped the update l   afnetworking: Simple and easy to use, provides the basic enough common function  

HTTP précis-writers

Related Article

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.