CN110740048B - Network request processing method and device based on iOS network - Google Patents

Network request processing method and device based on iOS network Download PDF

Info

Publication number
CN110740048B
CN110740048B CN201810791616.3A CN201810791616A CN110740048B CN 110740048 B CN110740048 B CN 110740048B CN 201810791616 A CN201810791616 A CN 201810791616A CN 110740048 B CN110740048 B CN 110740048B
Authority
CN
China
Prior art keywords
network
configuration
request
network request
ios
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810791616.3A
Other languages
Chinese (zh)
Other versions
CN110740048A (en
Inventor
陈锐标
赵善浮
田欢
温斯嘉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Eshore Technology Co Ltd
Original Assignee
Guangdong Eshore Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Eshore Technology Co Ltd filed Critical Guangdong Eshore Technology Co Ltd
Priority to CN201810791616.3A priority Critical patent/CN110740048B/en
Publication of CN110740048A publication Critical patent/CN110740048A/en
Application granted granted Critical
Publication of CN110740048B publication Critical patent/CN110740048B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • H04L63/1466Active attacks involving interception, injection, modification, spoofing of data unit addresses, e.g. hijacking, packet injection or TCP sequence number attacks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/16Implementing security features at a particular protocol layer
    • H04L63/168Implementing security features at a particular protocol layer above the transport layer

Abstract

The invention relates to a network request processing method based on an iOS network, wherein the method comprises the following steps: obtaining the content of a network request, wherein the content of the network request comprises: configuring content and parameters; processing the configuration content and the parameters and generating a corresponding unique identifier; receiving configuration through a uniform interface according to the configuration content, wherein the configuration comprises: HTTPS configuration, DNS hijack prevention configuration and cache configuration; the network request is initiated at the child thread by a single instance. According to the invention, the HTTPS configuration is rapidly added in a configuration type mode, the DNS hijacking configuration is prevented, and repeated and complicated operations are avoided. In addition, the invention is packaged into different modules according to the network request stage and provides a uniform API. In addition, the request is carried out in a single-case and sub-thread mode, so that only one network request object exists in the running process of the application, and the request confusion caused by a plurality of different request objects is effectively avoided.

Description

Network request processing method and device based on iOS network
Technical Field
The invention relates to the technical field of computer networks, in particular to a network request processing method and device based on an iOS network.
Background
In the world of mobile internet, mobile applications have been deepened into the broad masses. Network requests issued daily by mobile applications are in the hundreds of millions, and countless mobile developers are working to ensure that these requests are transmitted stably, efficiently, and securely.
Although most requests are properly handled during development, problems remain when developing using the API provided by the system. First, the system API is low-level in packaging and complex to use. Developers need to know about network-related APIs deeply to develop, and the requirements on the level of the developers are high. Second, the request security aspect is cumbersome to configure. Nowadays, the requirements of users on data security are increasing. However, the configuration of the HTTPS network request is very cumbersome and inconvenient for the ordinary developer. Furthermore, caching of types of pictures, doclets, and the like. Ordinary network requests obviously do not cache these contents, and actually caching these types of contents can greatly improve the request efficiency and save traffic.
In summary, the network request configuration directly performed by using the system API is complex, the system API is complex to use, the network security configuration is complex, a perfect cache mechanism is not provided, the network request modules of different projects are difficult to reuse, the inheritance is poor, and the like, the requirement on the level of a developer is high, and the project is not facilitated to be performed.
In view of the above, there is a need to provide further improvements to the current iOS network-based network request processing technology.
Disclosure of Invention
To solve at least one of the above technical problems, a primary object of the present invention is to provide a network request processing method based on an iOS network.
In order to achieve the purpose, the invention adopts a technical scheme that: the network request processing method based on the iOS network comprises the following steps in sequence:
s10, obtaining the content of the network request, wherein the content of the network request comprises: configuring content and parameters;
s20, processing the configuration content and the parameters and generating a corresponding unique identifier;
s40, receiving configuration through a uniform interface according to the configuration content, wherein the configuration comprises: HTTPS configuration, DNS hijack prevention configuration and cache configuration;
and S50, initiating the network request at the child thread through a single instance.
After step S20, the method further includes:
s302, detecting a request state list;
s304, judging whether the same request exists according to the identification, if not, updating the request state list, and if so, terminating the network request.
After step S50, the method further includes:
and S60, receiving the data returned by the network request, and converting the data into a general message format.
Wherein, after the step S60, the method further includes:
and S70, caching the data returned by the network request, and reading the cache according to the cache configuration when the request is made.
Wherein, step S50 is followed by:
and S80, detecting errors occurring in the network request processing method based on the iOS network, and feeding back the detected errors.
In order to achieve the purpose, the invention adopts another technical scheme that: there is provided an iOS network based network request processing apparatus including:
an obtaining module, configured to obtain content of a network request, where the content of the network request includes: configuring content and parameters;
the generating module is used for processing the configuration content and the parameters and generating a corresponding unique identifier;
a configuration module, configured to accept configuration through a unified interface according to the configuration content, where the configuration includes: HTTPS configuration, DNS hijack prevention configuration and cache configuration;
and the initiating module is used for initiating the network request at the sub thread through a single case.
Wherein, the network request processing device based on the iOS network further comprises:
the state detection module is used for detecting a request state list;
and the judging module is used for judging whether the same request exists according to the identifier, updating the request state list if the same request does not exist, and terminating the network request if the same request exists.
Wherein, the network request processing device based on the iOS network further comprises:
and the message module is used for receiving the data returned by the network request and converting the data into a general message format.
Wherein, the network request processing device based on the iOS network further comprises:
and the cache module is used for caching the data returned by the network request and reading the cache according to the cache configuration when the request is made.
Wherein, the network request processing device based on the iOS network further comprises:
and the error feedback module is used for detecting errors occurring in the network request processing method based on the iOS network and feeding back the detected errors.
The network request processing method based on the iOS network, provided by the invention, has the advantages that the HTTPS configuration is rapidly added in a configuration type mode, the DNS hijacking configuration is prevented, and repeated and complicated operations are avoided. In addition, the invention is packaged into different modules according to the network request stage and provides a uniform API, thereby being beneficial to subsequent maintenance and expansion. In addition, the request is carried out in a single-case and sub-thread mode, so that only one network request object exists in the running process of the application, and the request confusion caused by a plurality of different request objects is effectively avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
Fig. 1 is a flowchart of a method of processing a network request based on an iOS network according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for processing a network request based on an iOS network according to another embodiment of the present invention;
FIG. 3 is a flowchart of a method for processing a network request based on an iOS network according to another embodiment of the present invention;
fig. 4 is a flowchart of a method for processing a network request based on an iOS network according to another embodiment of the present invention;
fig. 5 is a block diagram of a network request processing apparatus based on an iOS network according to an embodiment of the present invention;
fig. 6 is a block diagram of a network request processing apparatus based on an iOS network according to another embodiment of the present invention.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the description of the invention relating to "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying any relative importance or implicit indication of the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Referring to fig. 1, in an embodiment of the present invention, a method for processing a network request based on an iOS network is provided, where the method for processing a network request based on an iOS network includes the following steps in order:
s10, obtaining the content of the network request, wherein the content of the network request comprises: configuring content and parameters;
s20, processing the configuration content and the parameters and generating a corresponding unique identifier;
s40, receiving configuration through a uniform interface according to the configuration content, wherein the configuration comprises: HTTPS configuration, DNS hijack prevention configuration and cache configuration;
and S50, initiating the network request at the child thread through a single instance.
In this embodiment, the method for processing the network request based on the iOS network is applied to the App. Specifically, first, content of a network request is obtained, where the content of the network request includes: configuration content and parameters. Then, the configuration content and the parameters are processed to generate a corresponding unique identifier for identifying the current request and preventing multiple requests which are input in the same way. Receiving configuration through a uniform interface according to the configuration content, wherein the configuration comprises: HTTPS configuration, DNS hijack prevention configuration and cache configuration, and management is facilitated. Finally, the efficient and consistent network request effect is achieved by using the mode of single-instance and sub-thread operation, and the operation of other parts of the application is not influenced.
In summary, the method for processing a network request based on an iOS network proposed in this embodiment adds an HTTPS configuration quickly and prevents a DNS hijacking configuration in a configuration type manner, thereby avoiding repeated and cumbersome operations. In addition, the invention is packaged into different modules according to the network request stage and provides a uniform API, thereby being beneficial to subsequent maintenance and expansion. In addition, the request is carried out in a single-case and sub-thread mode, so that the application only has one network request object during the running period, and the request confusion possibly caused by a plurality of different request objects is effectively avoided.
Referring to fig. 2, in a specific embodiment, after the step S20, the method further includes:
s302, detecting a request state list;
s304, judging whether the same request exists according to the identification, if not, updating the request state list, and if so, terminating the network request.
Specifically, first, a request status list is detected, and then, whether the same request exists is determined according to the identifier, if not, the request status list is updated, and if so, the network request is terminated.
The embodiment realizes that the user can check the current state of each request at any time by detecting and updating the request state list and judging whether the same network request exists according to the unique identifier, thereby effectively preventing the embarrassment that the same network request is initiated for many times and is repeatedly initiated within a period of time.
Referring to fig. 3, in an embodiment, after the step S50, the method further includes:
s60, receiving the data returned by the network request, and converting the data into a general message format.
Specifically, in this embodiment, data returned by the network request is received, and is attempted to be converted into a general message, an XML format and a JSON format are built in, and an open interface is provided, so that a user can conveniently extend and use a new message format.
The embodiment realizes the purpose of providing an open message analysis scheme for the user. The built-in message analysis module supports the analysis of JSON and XML messages, and meets most of the current requirements.
Referring to fig. 4, in a specific embodiment, after the step S60, the method further includes:
and S70, caching the data returned by the network request, and reading the cache according to the cache configuration when the request is made.
Specifically, the request return data is cached, and the cache is read according to the cache configuration when the request is made, so that the efficiency of the content with changed content is obviously improved, and the traffic use is reduced.
The embodiment realizes the caching processing of the types of pictures, small files and the like, and can greatly improve the request efficiency and save the flow by caching the contents of the types.
In an embodiment, after the step S50, the method further includes:
and S80, detecting errors occurring in the network request processing method based on the iOS network, and feeding back the detected errors.
Specifically, a set of complete error feedback mechanism is defined in this embodiment, errors occurring in the network request process flow to the error processing module, and the detected errors are fed back, so that the user can operate according to the prompt.
Referring to fig. 5, the present embodiment provides an iOS network-based network request processing apparatus including:
an obtaining module 10, configured to obtain content of a network request, where the content of the network request includes: configuring content and parameters;
a generating module 20, configured to process the configuration content and the parameter and generate a corresponding unique identifier;
a configuration module 40, configured to accept configuration through a unified interface according to the configuration content, where the configuration includes: HTTPS configuration, DNS hijack prevention configuration and cache configuration;
the initiating module 50 is configured to initiate the network request at a child thread by a single instance.
In an embodiment, the iOS network-based network request processing apparatus further includes:
a status detection module 302, configured to detect a request status list;
a determining module 304, configured to determine whether the same request exists according to the identifier, if not, update the request status list, and if so, terminate the network request.
In the embodiment, the HTTPS configuration is quickly added in a configuration type mode, the DNS hijacking configuration is prevented, and repeated and complicated operations are avoided. In addition, the invention is packaged into different modules according to the network request stage and provides a uniform API, thereby being beneficial to subsequent maintenance and expansion. In addition, the request is carried out in a single-case and sub-thread mode, so that the application only has one network request object during the running period, and the request confusion possibly caused by a plurality of different request objects is effectively avoided.
In a specific embodiment, the iOS network based network request processing apparatus further comprises:
and a message module 60, configured to receive data returned by the network request, and convert the data into a general message format.
Referring to fig. 6, in a specific embodiment, the iOS network based network request processing apparatus further includes:
the caching module 70 is configured to cache data returned by the network request, and read the cache according to the cache configuration when the request is made.
In an embodiment, the iOS network-based network request processing apparatus further includes:
an error feedback module 80, configured to detect an error occurring in the iOS network-based network request processing method, and feed back the detected error.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A network request processing method based on an iOS network is characterized by comprising the following steps in sequence:
s10, obtaining the content of the network request, wherein the content of the network request comprises: configuring content and parameters;
s20, processing the configuration content and the parameters and generating a corresponding unique identifier;
s40, receiving configuration through a uniform interface according to the configuration content, wherein the configuration comprises: HTTPS configuration, DNS hijack prevention configuration and cache configuration;
s50, initiating the network request at the child thread through a single instance;
after the step S20, the method further includes: s302, detecting a request state list; s304, judging whether the same request exists according to the identification, if not, updating the request state list, and if so, terminating the network request.
2. The iOS network-based network request processing method of claim 1, after the step S50, further comprising:
and S60, receiving the data returned by the network request, and converting the data into a general message format.
3. The iOS network-based network request processing method of claim 2, wherein the step S60 is followed by further comprising:
and S70, caching the data returned by the network request, and reading the cache according to the cache configuration when the request is made.
4. The iOS network-based network request processing method of any of claims 1-3, wherein the step S50 is further followed by:
and S80, detecting errors occurring in the network request processing method based on the iOS network, and feeding back the detected errors.
5. An iOS network-based network request processing apparatus, characterized by comprising:
an obtaining module, configured to obtain content of a network request, where the content of the network request includes: configuring content and parameters;
the generating module is used for processing the configuration content and the parameters and generating a corresponding unique identifier;
a configuration module, configured to accept configuration through a unified interface according to the configuration content, where the configuration includes: HTTPS configuration, DNS hijacking prevention configuration and cache configuration;
the initiating module is used for initiating the network request in a sub thread through a single case;
the state detection module is used for detecting a request state list;
and the judging module is used for judging whether the same request exists according to the identifier, updating the request state list if the same request does not exist, and terminating the network request if the same request exists.
6. The iOS network based network request processing apparatus of claim 5, wherein the iOS network based network request processing apparatus further comprises:
and the message module is used for receiving the data returned by the network request and converting the data into a general message format.
7. The iOS network based network request processing apparatus of claim 6, wherein the iOS network based network request processing apparatus further comprises:
and the cache module is used for caching the data returned by the network request and reading the cache according to the cache configuration when the request is made.
8. The iOS network based network request processing apparatus of any of claims 5-7, wherein the iOS network based network request processing apparatus further comprises:
and the error feedback module is used for detecting errors occurring in the network request processing method based on the iOS network and feeding back the detected errors.
CN201810791616.3A 2018-07-18 2018-07-18 Network request processing method and device based on iOS network Active CN110740048B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810791616.3A CN110740048B (en) 2018-07-18 2018-07-18 Network request processing method and device based on iOS network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810791616.3A CN110740048B (en) 2018-07-18 2018-07-18 Network request processing method and device based on iOS network

Publications (2)

Publication Number Publication Date
CN110740048A CN110740048A (en) 2020-01-31
CN110740048B true CN110740048B (en) 2022-09-27

Family

ID=69234938

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810791616.3A Active CN110740048B (en) 2018-07-18 2018-07-18 Network request processing method and device based on iOS network

Country Status (1)

Country Link
CN (1) CN110740048B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106254491A (en) * 2016-08-17 2016-12-21 成都聚美优品科技有限公司 A kind of stable IOS client framework model efficiently
CN106899969A (en) * 2017-01-18 2017-06-27 东南大学常州研究院 Specific secrecy terminal system implementation method based on iOS system
CN108234149A (en) * 2016-12-09 2018-06-29 沈阳美行科技有限公司 Network request management method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716180B2 (en) * 2005-12-29 2010-05-11 Amazon Technologies, Inc. Distributed storage system with web services client interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106254491A (en) * 2016-08-17 2016-12-21 成都聚美优品科技有限公司 A kind of stable IOS client framework model efficiently
CN108234149A (en) * 2016-12-09 2018-06-29 沈阳美行科技有限公司 Network request management method and device
CN106899969A (en) * 2017-01-18 2017-06-27 东南大学常州研究院 Specific secrecy terminal system implementation method based on iOS system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
AFNetworking源码解析;莲舟MQL;《简书》;20180526;第1-2节 *
可能是最全的iOS端HttpDns集成方案;茉莉儿;《简书》;20170425;第4-6节 *

Also Published As

Publication number Publication date
CN110740048A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
CN107835178B (en) Multi-protocol service communication method and device and electronic equipment
CN108984388B (en) Method and terminal equipment for generating automatic test case
CN109635019B (en) Request processing method, device, equipment and storage medium
CN111708619B (en) Distributed transaction processing method and system based on message queue and database
EP3607715A1 (en) NF SERVICE CONSUMER RESTART DETECTION USING DIRECT SIGNALING BETWEEN NFs
CN110535928B (en) Event pushing method for JAVA intelligent contract of block chain
CN111510330B (en) Interface management device, method and storage medium
CN107888446B (en) Protocol robustness testing method and device
CN109343983B (en) Information interaction method, device, equipment and storage medium between function modules
WO2021258340A1 (en) Publishing system, pushing method, application device, receiving apparatus, and service management device
CN110580305A (en) Method, apparatus, system, and medium for generating identifier
US10310851B2 (en) Automated generation of service definitions for message queue application clients
CN111666745B (en) File downloading method, device, server and medium
US20170085673A1 (en) Attribute Operating Method and Apparatus
CN111008087B (en) Message processing method and device
CN109388388B (en) Information interaction method, device, equipment and storage medium between function modules
CN112468585B (en) Data transmission method and device, electronic equipment and storage medium
CN110740048B (en) Network request processing method and device based on iOS network
CN110324722B (en) Method, device, equipment and storage medium for acquiring data in live broadcast room
CN112650804A (en) Big data access method, device, system and storage medium
CN112905197A (en) Information processing method, device and system, electronic equipment and storage medium
CN109495319B (en) Method, device and equipment for determining fault information of CDN node
CN115580522A (en) Method and device for monitoring running state of container cloud platform
CN108390770B (en) Information generation method and device and server
US11349926B1 (en) Protected smart contracts for managing internet of things devices

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant