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