IOS Network-02-HTTP protocol

Source: Internet
Author: User

HTTP protocol Introduction

1. URL

1. What is a URL

the full name of the URL is Uniform Resource Locator( Uniform Resource Locator )

2. function

through 1 a URL , can find the only one on the Internet 1 A resource

URL is the address and location of the resource , every resource on the Internet has a unique URL

3. Format

URL " Span style= "WHITE-SPACE:PRE; Color:rgb (89,89,89) "> basic format = protocol :// host address / path

http://ios.itcast.cn/ Ios/images/content_25.jpg

http://202.108.22.5/img /bdlogo.gif

protocol: different protocols, representing different resource query methods, resource transfer methods

Blockquote style= "margin:0 0 0 40px; Border:none; padding:0px ">

host Address:

Blockquote style= "margin:0 0 0 40px; Border:none; padding:0px ">

path: Resources are in the host location

4. Common protocols in URLs

1. HTTP

Hypertext Transfer Protocol, access to remote network resources, format is/HTTP (for example: http://ask.csdn.net/)

HTTP protocol is the most commonly used protocol in network development

2. File

Access to a resource on the local computer, the format is file://(do not add host address, for example: file:///Users/jerry/Desktop/)

3. mailto

To access the e-mail address, the format is mailto:

4. FTP

The file resource for the shared host is accessed in the format ftp://

2. Introduction of HTTP protocol

1. HTTP protocol Features

A, simple and fast

B, Flexible (can transfer any type of data)

C, Continuous link

before HTTP 1.1 This saves transfer time by restricting each connection to only one request, and after the server responds to a request from the client, the connection is immediately disconnected.

HTTP 1.1 do not need for each Web object creates a new connection, a connection can transfer multiple objects

2. Basic communication Process for HTTP

A, request : The client requests data from the server

B, response : The server returns the client to the corresponding data

3. Scenarios in which HTTP requests occur in iOS

a, Apple native

< Strong>nsurlconnection : easy to use, It's an old solution.

nsurlsession : ios7 new technology, more powerful than  nsurlconnection

cfnetwork : nsurl*, plain C

b, third-party framework

asihttprequest: powerful, but stopped updating

afnetworking: easy to use, many users

mknetworkkit: easy to use, less user

3. HTTP request method

1.8 Methods of request

GET,POST, OPTIONS, Jead,PUT,DELETE, TRACE, CONNECT, PATCH

2. Common methods

PUT: Zeng

Delete: Delete

POST: Change

GET: Check

The most common are GET and POST

Parameters: is the specific data that is passed to the server, such as the account number at login, password


IOS Network-02-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.