WO2020206660A1 - Network resource request method and apparatus, electronic device and storage medium - Google Patents

Network resource request method and apparatus, electronic device and storage medium Download PDF

Info

Publication number
WO2020206660A1
WO2020206660A1 PCT/CN2019/082329 CN2019082329W WO2020206660A1 WO 2020206660 A1 WO2020206660 A1 WO 2020206660A1 CN 2019082329 W CN2019082329 W CN 2019082329W WO 2020206660 A1 WO2020206660 A1 WO 2020206660A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
network resource
domain name
resource request
target domain
Prior art date
Application number
PCT/CN2019/082329
Other languages
French (fr)
Chinese (zh)
Inventor
赵剑萍
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN201980090803.1A priority Critical patent/CN113366815B/en
Priority to PCT/CN2019/082329 priority patent/WO2020206660A1/en
Publication of WO2020206660A1 publication Critical patent/WO2020206660A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming

Definitions

  • This application relates to the field of computer technology, and more specifically, to a method, device, electronic device, and storage medium for requesting network resources.
  • this application proposes a network resource request method, device, electronic equipment, and storage medium to improve the above-mentioned problems.
  • this application provides a network resource request method applied to a client.
  • the method includes: sending a network resource request to a target domain name to obtain a response result of the network resource request; if the response result indicates no If the acquisition is successful, it is identified whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution; if it is sent based on the first IP address, the target domain name corresponding to the target domain name is acquired.
  • a second IP address where the second IP address is a destination IP address of a historical network resource request that successfully requests a network resource corresponding to the target domain name; and a network resource request that uses the second IP address as the destination address is sent.
  • this application provides a method for requesting network resources, which is applied to a component capable of communicating with a client.
  • the method includes: obtaining a response result of a network resource request sent by the client to a target domain name;
  • the response result indicates that the acquisition was not successful, and it is identified whether the network resource request is sent based on the first IP address, and the first IP address is an IP address acquired based on domain name resolution; if it is sent based on the first IP address, the acquisition is The second IP address corresponding to the target domain name, where the second IP address is the destination IP address of the historical network resource request that successfully requests the network resource corresponding to the target domain name; sending the second IP address as the destination address Network resource request; sending the network resource requested by the network resource request with the second IP address as the destination address to the client.
  • this application provides an electronic device, including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors Implement the above method.
  • the present application provides a computer-readable storage medium in which program code is stored, wherein the above-mentioned method is executed when the program code is run by a processor.
  • the network resource request method, device, electronic equipment, and storage medium provided in this application obtain the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is based on The first IP address is sent, then the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name is obtained as the second IP address, and the network resource with the second IP address as the destination address is sent request. In this way, when network resources cannot be requested under normal domain name resolution, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the requesting network Reliability of resources.
  • Figure 1 shows an application network environment diagram of a network resource request method proposed in an embodiment of the present application
  • FIG. 2 shows a flowchart of a method for requesting network resources proposed by an embodiment of the present application
  • FIG. 3 shows a flowchart of a method for requesting network resources proposed by still another embodiment of the present application
  • FIG. 4 shows a flowchart of a method for requesting network resources proposed by another embodiment of the present application
  • FIG. 5 shows a flowchart of a method for requesting network resources according to another embodiment of the present application
  • FIG. 6 shows a flowchart of a method for requesting network resources proposed by another embodiment of the present application
  • FIG. 7 shows a structural block diagram of a network resource request device proposed by an embodiment of the present application.
  • FIG. 8 shows a structural block diagram of a network resource request apparatus proposed by another embodiment of the present application.
  • FIG. 9 shows a structural block diagram of a network resource request apparatus proposed by another embodiment of the present application.
  • FIG. 10 shows a structural block diagram of a network resource request apparatus proposed by another embodiment of the present application.
  • FIG. 11 shows a structural block diagram of an electronic device for executing the method for requesting network resources according to an embodiment of the present application in real time of the present application;
  • Fig. 12 shows a storage unit used to store or carry the program code implementing the network resource request method according to the embodiment of the present application in real time of the present application.
  • DNS Domain Name System
  • the Domain Name System is a core service of the Internet. As a distributed database that can map domain names and IP addresses to each other, it can make it easier for people to access the Internet. There is no need to remember the number of IP addresses that can be directly read by the machine. For example, www.wikipedia.org is a domain name that corresponds to the IP address 208.80.152.2. DNS is like an automatic telephone directory, we can directly dial the name of Wikipedia instead of phone number (IP address). After we directly call the name of the website, DNS will convert a human-friendly name (such as www.wikipedia.org) into an IP address (such as 208.80.152.2) that is easy to recognize by machines.
  • a human-friendly name such as www.wikipedia.org
  • IP address such as 208.80.152.2
  • the electronic device 100 sends www.wikipedia.org to the domain name server 200 ,
  • the domain name server 200 will resolve www.wikipedia.org to obtain the corresponding IP address, and then return the resolved IP address to the electronic device 100, and then the electronic device 100 will send to the server 300 pointed to by the IP address Network resource request.
  • the client can be an application with network communication function, for example, it can be a browser, it can be instant chat software, or it can be video software, etc.
  • the inventor proposed that when network resources cannot be requested under the normal domain name resolution method, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby improving the success rate of the network resource request. , And also improve the reliability of requesting network resources, network resource request methods, devices, electronic equipment and storage media.
  • a client with a front-end interface is running in the electronic device, for example, a browser, even chat software, or video software. You can also run some components that do not show network resources to users but manage the aforementioned clients. In addition, the electronic device can also run some components that only run in the background without a user interaction interface. The aforementioned components can also be run as independent applications or run as an SDK plug-in of the client. Then, the network resource request method provided by the embodiment of the present application can run on the aforementioned client or the aforementioned component, and the specific operation mode will be introduced through the following embodiments.
  • a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
  • Step S110 Send a network resource request to the target domain name, and obtain a response result of the network resource request.
  • the network resource request may be triggered after the client detects that the domain name input area in the client has a domain name input, or it may be triggered after the client detects that a certain hyperlink displayed is touched. For example, if the client detects that a domain name is entered in the domain name input area, and then detects that the search start control is triggered, it can start to generate and send a network resource request requesting the network resource corresponding to the entered domain name. For another example, a text configured with a hyperlink is displayed on the interface of the client. For example, if the hyperlink corresponding to the text is oppo.com, when the client detects that the text is touched, it can generate and send a request A network resource request for a network resource whose domain name is oppo.com.
  • the client After the client sends a network resource request to the target domain name, it will detect the response result of the network resource request. It is understandable that the network resource request is sent to the server corresponding to the target domain name through the network, so the server may not be able to respond to the network request due to the problem of the server corresponding to the target domain name or the network problem of the intermediate data transmission. Or the server can respond, but the response data as a response cannot be successfully returned to the client. Or the response data returned by the server corresponding to the target domain name is some error code. Then, based on the above method, the response result for a network resource request may include response data of the requested resource, may include response data including an error code, or it may be that no response data is returned within a specified time.
  • the client determines that the acquired response data includes the requested resource, it is determined that the response result indicates that the acquisition is successful, and when the client determines that the acquired response data includes an error code or the client determines that there is no response data within a specified time In the case of return, it is determined that the response result characterization is not obtained successfully.
  • the client can identify the value of the status field in the http response header in the response data.
  • the value of the statu field is 200, which indicates that the requested network resource is successfully obtained, and the response result indicates that the acquisition is successful. If the value of the statu field is 400, it indicates that only an error code was returned or the client did not receive it after the specified time Based on the response data of the http protocol, it will be determined that the response result characterization is not obtained successfully.
  • Step S120 If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
  • the client can add a specific field to the request to identify the source of the destination IP address of the request when generating a network resource request. Then in this way, when the server returns the response data, the specific field will be added to the response data. Furthermore, after receiving the response data, the client can determine how the destination IP address of this network resource request is obtained by identifying the value of the specific field in the response data.
  • the specific field can be added to the request header of the network resource request based on the http protocol, then the client can correspondingly specify the response header of the http-based response data
  • the source of the destination address used in this network resource request is determined by identifying the value of the specific field.
  • the client can store the request header of the network resource request corresponding to another unique identifier after the generated network resource request, and the unique identifier can pass its own The format or character content of the corresponding to identify the source of the destination address of the corresponding network resource request, so that the client can determine the source of the destination address of the network resource request corresponding to the identifier by identifying the identifier.
  • the field Request_data is used to store the request header
  • the field Source_Id is used to store the aforementioned unique identifier. Then the corresponding request header and identifier with the same field ID value have a corresponding relationship.
  • the identifiers starting with “A” can be configured to be obtained based on domain name resolution, those starting with "B” are obtained from local search, and those starting with "C” are obtained from the network. And the number after the letter can be used to indicate how many times this is the network resource request that the IP address obtained in this way is sent as the destination IP.
  • A01 represents the first network resource request sent using the IP address obtained by domain name resolution as the destination IP
  • A02 represents the second network resource request sent using the IP address obtained by domain name resolution as the destination IP for the second time.
  • the generated network resource request is not modified, thereby reducing the data processing error caused when the protocol versions adopted by the server and the client are different.
  • the server when the server generates response data, it does not document the aforementioned specific fields in the response header because of the collected protocol.
  • the content of the request header in the above table is only exemplary, and the specific request header will vary according to the communication protocol used.
  • Step S130 If it is sent based on the first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP of the historical network resource request that successfully requests the network resource corresponding to the target domain name address.
  • the second IP address may be obtained locally or obtained from the network.
  • the second IP address obtained locally may be obtained by the client based on a domain name resolution method, and successfully obtained the IP address of the network resource as the destination IP of the network resource request. For example, if the client sends a network resource request for the domain name oppo.com in step S110, then here is oppo.com as the target domain name, then the client can resolve it based on the domain name oppo.com before searching locally
  • the IP address of the network resource can be successfully requested as the second IP address.
  • the second IP address obtained from the network may be a device other than the electronic device where the client is located. It was previously obtained based on the domain name resolution method and successfully obtained the IP address of the network resource as the destination IP of the network resource request.
  • the IP corresponding to the domain name obtained by the resolution may be different. different.
  • the devices other than the electronic device where the client is located may include devices located in different cities, provinces, or countries, or other users’ electronic devices.
  • the other users may include users in different cities in the registration information, or they may be Users in different countries in the registration information.
  • the city or country where the user is located can be determined by the IP assigned to the electronic device used when the user registers.
  • Step S140 Send a network resource request with the second IP address as the destination address.
  • the client can determine that it has tried again to obtain the network resources of the target domain name based on the aforementioned step S130, but it still cannot be successfully obtained, then it can report to the designated server.
  • the target domain name If it is detected that it is not sent based on the first IP address, the client can determine that it has tried again to obtain the network resources of the target domain name based on the aforementioned step S130, but it still cannot be successfully obtained, then it can report to the designated server.
  • the target domain name is a configurabled by the target domain name.
  • the network resource request method provided by this application obtains the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then Then obtain the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name as the second IP address, and send the network resource request with the second IP address as the destination address. In this way, when network resources cannot be requested under normal domain name resolution, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the requesting network Reliability of resources.
  • a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
  • Step S210 Send a network resource request to the target domain name, and obtain a response result of the network resource request.
  • Step S220 If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
  • the client may display a request failure page, and in this example, if the response is identified in step S220 After the result indicates that the request is not successfully obtained, the page where the request failed is directly displayed on the client side, which may make the user mistakenly think that the request has ended, and thus make the user think that the required network resource cannot be requested.
  • Step S230 If it is sent based on the first IP address, search for a locally stored second IP address corresponding to the target domain, where the second IP address is a historical network resource request that successfully requests the network resource corresponding to the target domain name And the historical network request is sent by the client.
  • the destination IP address of the network resource request that successfully obtains the network resource and the target domain name are stored locally for subsequent clients Use again.
  • the target domain name and the corresponding IP address can be stored in the manner of the aforementioned data table. Then when the client searches the IP address locally, it can look up the table based on the target domain name. If the IP address corresponding to the target domain name is found locally, it will be used as the second IP address. If it is not found locally The IP address corresponding to the target domain name, then upload the target domain name to the designated server.
  • Step S240 Send a network resource request that uses the second IP address as the destination address and carries a first identifier, where the first identifier is used to indicate that the destination IP address in the network resource request is from the client local Find.
  • Step S250 If it is not sent based on the first IP address, identify whether the response result carries the first identifier.
  • a specific field can be added to the generated network resource request to identify the source of the destination IP address of the network resource request, and the corresponding server will also add the specific field when generating the response data. And the value of the specific field in the response data is the same as the value of the specific field in the corresponding network resource request. In this way, if the specific field value is the first identifier, it can be determined that the destination IP address in the network resource request is obtained locally, and if the specific field value is the second identifier, it can be determined that the network The destination IP address in the resource request is obtained from the network.
  • Step S260 If the response result carries the first identifier, use a web crawler to crawl the second IP address corresponding to the target domain name, wherein the historical network request is from the client Sending from devices other than electronic devices.
  • one or more servers with a network crawling function can be designated in advance as the IP acquisition server for performing the crawling action.
  • the client can send an IP address acquisition request to the IP acquisition server, and the IP address acquisition request carries the target domain name, so that the IP acquisition server knows which domain name corresponding IP address needs to be acquired.
  • the IP acquisition server After receiving the IP address acquisition request, the IP acquisition server will start the web crawler function to crawl the IP address corresponding to the target domain name in the network.
  • the IP acquisition server obtains the IP address corresponding to the target domain name, it will The crawled IP address will be returned to the client. After the client receives the IP address returned by the IP acquisition server, it will use the returned IP address as the second IP address.
  • the network crawling method used by the IP acquisition server can be an existing network crawling method, which will not be described in detail here.
  • the IP acquisition server can send an IP acquisition request that also carries the aforementioned target domain name to a server in another region. After the server in the other region acquires the IP acquisition request, it will simulate the client to initiate domain name resolution, and then Obtain the IP address corresponding to the target domain name by way of domain name resolution, and then use the IP address to send the network resource request.
  • the server in another area will immediately return the obtained IP address to the IP acquisition server, and the IP acquisition server will then return the IP address returned by the server in the other area to the client , So that the client is the second IP address.
  • the aforementioned additional region may refer to another city, another province, or another country. It is understandable that the domain name servers used by different regions or different network service providers are different, so the domain name information may not be synchronized, resulting in the corresponding IP addresses of the same domain name resolved in different regions There will be a difference. Then, by letting servers in other regions try domain name resolution again as described above, the probability of obtaining an IP address that can request network resources can be increased, thereby increasing the success rate of the client in obtaining the required network resources.
  • Step S270 Send a network resource request that uses the crawled second IP address as a destination address and carries a second identifier, where the second identifier is used to indicate that the destination IP address in the network resource request is obtained from the network.
  • Step S280 If the response result does not carry the first identifier and carries the second identifier, report the target domain name to a preset server.
  • This application provides a network resource request method.
  • the response result of the network resource request sent to the target domain name indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then the local storage is obtained first
  • the successful request to the destination IP address of the historical network resource request of the network resource corresponding to the target domain name is used as the second IP address, and the network resource request with the second IP address as the destination address is sent, if the first obtained locally 2.
  • the destination IP address of the historical network resource request from the successful request sent by other devices to the network resource corresponding to the target domain name is crawled from the network as the second IP address Therefore, when network resources cannot be requested under normal domain name resolution based on the above method, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the request The reliability of network resources.
  • a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
  • Step S310 Send a network resource request to the target domain name, and obtain a response result of the network resource request.
  • Step S320 If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
  • Step S330 If it is sent based on the first IP address, send an IP address acquisition request carrying the target domain name to a designated server.
  • the IP address acquisition request is used by the designated server to crawl the first IP address corresponding to the target domain name.
  • Two IP addresses, and the crawled second IP address is returned to the electronic device, where a device other than the electronic device where the client is located has successfully acquired a history based on the crawled second IP address history The network resource corresponding to the target domain name.
  • Step S340 Send a network resource request with the second IP address as the destination address.
  • the network resource request method provided by this application obtains the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then Then, the destination IP address of the historical network resource request that successfully requests the network resource corresponding to the target domain name is acquired through the network as the second IP address, and the network resource request with the second IP address as the destination address is sent. In this way, when network resources cannot be requested under normal domain name resolution based on the above method, the IP address of the network resource can be requested again based on the historically successful request obtained through the network, thereby improving the success rate of the network resource request. It also improves the reliability of requesting network resources.
  • a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
  • Step S410 Send a network resource request to the target domain name, and obtain a response result of the network resource request.
  • Step S420 If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
  • Step S430 If it is sent based on the first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP of the historical network resource request that successfully requests the network resource corresponding to the target domain name Address, and the IP address corresponding to the target domain name obtained based on the domain name resolution method again.
  • the step of acquiring the IP address corresponding to the target domain name based on the domain name resolution method again includes: acquiring the IP address corresponding to the target domain name based on the switched DNS server again based on the domain name resolution method.
  • the user can manually configure multiple domain name servers in the client, and then configure the priority of the multiple domain name servers, and then the client can perform domain name resolution according to the configured priority. It is understandable that the condition for the client to switch the domain name server is that the IP address resolved by the domain name server of the previous priority cannot successfully request the required network resources.
  • Step S440 Send a network resource request using the second IP address as a destination address, and send a network resource request using the IP address again obtained by domain name resolution as the destination address.
  • step S440 two network resource requests will be sent at the same time.
  • the destination IP address of one network resource request is the IP address obtained based on the domain name resolution performed again, and the purpose of the other network resource request is The IP address is the destination IP address of the historical network resource request that successfully requests the network resource corresponding to the target domain name.
  • the two network resource requests can be sent in parallel in a multi-threaded manner.
  • the sequence of the response data returned may be different.
  • Step S450 If it is detected that the response result of the network resource request using the second IP address as the destination address indicates that the requested network resource is successfully obtained, terminate the response to the IP address obtained by domain name resolution as the destination Address of the network resource request.
  • Step S460 If it is detected that the response result of the network resource request using the IP address obtained by domain name resolution as the destination address indicates that the requested network resource is successfully obtained, terminate the response to the second IP address as the destination address. Network resource request.
  • the network resources requested by the two network resource requests sent in step S440 are the same. If the two network resource requests successfully request network resources, the client will respond to the requested network resources. The processing of the received network resources is bound to cause repeated processing of the same amount of resources, resulting in a waste of resources. For example, if the requested network resource is an html page, the client may repeat the html page rendering operation, which not only causes a waste of resources, but also causes the user to mistakenly think that the page is refreshing. Then, through step S450 and step S460, the client can select one of the two network resource requests, thereby avoiding the aforementioned problem of repeatedly processing the same network resource.
  • the client can determine that it has tried again to obtain the network resources of the target domain name based on the aforementioned step S130, but it still cannot be successfully obtained, then the client The terminal can perform step S470: the target domain name can be reported to the designated server.
  • the network resource request method provided by this application obtains the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then Simultaneously send a network resource request with the IP address obtained based on domain name resolution as the destination IP address, and a network resource request with the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name as the destination IP address . In this way, when network resources cannot be requested under normal domain name resolution based on the above method, the IP address of the network resource can be requested again based on the historically successful request obtained through the network, thereby improving the success rate of the network resource request. It also improves the reliability of requesting network resources.
  • a network resource request method provided by an embodiment of the present application is applied to a component capable of communicating with a client.
  • the method includes:
  • Step S510 Obtain the response result of the network resource request sent by the client to the target domain name.
  • the component can obtain the network resource request sent by the client by capturing packets, or obtain the response data returned by the server to the client by capturing packets.
  • the client can be adaptively changed, so that the client and the component can exchange data through inter-process communication, so that the client can not obtain a successful response result after receiving the characterization
  • the component can be notified that the network resource request for unsuccessful acquisition of network resources is the target domain name, which destination IP address is used, and the source of the used destination IP address.
  • the client obtains the network resource request for what the target domain name is, what is the destination IP address used, and what is the source of the used destination IP address can adopt the method in the foregoing embodiment, here No longer.
  • Step S520 If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
  • the client may recognize in advance that the response result characterization has not been successfully obtained, and recognize that the network resource request is based on the first After the IP address, the identification result is notified to the component based on the method of inter-process communication. And when no adaptive modification is made to the client, the component can refer to how the client described in the foregoing embodiment detects if the response result is not successfully obtained.
  • the client detects whether the network resource request is sent based on the first IP address when the response result is not successfully obtained, to detect that the network resource request is not successfully obtained when the response result is not successfully obtained. Whether the resource request is sent based on the first IP address.
  • Step S530 If it is sent based on the first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP of the historical network resource request that successfully requests the network resource corresponding to the target domain name address.
  • a locally stored second IP address corresponding to the target domain can be searched, and the historical network request is sent by the client.
  • an IP address acquisition request carrying the target domain name may be sent to a designated server, where the IP address acquisition request is used by the designated server to crawl the second IP address corresponding to the target domain name, And return the crawled second IP address to the electronic device, where a device other than the electronic device where the client is located has successfully obtained the target domain name based on the crawled second IP address history Corresponding network resources.
  • Step S540 Send a network resource request with the second IP address as the destination address.
  • Step S550 Send the network resource requested by the network resource request with the second IP address as the destination address to the client.
  • the component can request the network resource request with the second IP address as the destination address based on the inter-process communication. Send the network resources to the client.
  • the component can send the network resource requested by the network resource request with the second IP address as the destination address to the client by simulating the server.
  • the component can implement a MockApi module that simulates the server-side data interface locally. It is understandable that in the process of simulating the server, the parameters of the simulated server need to be consistent with the parameters of the actual server corresponding to the target domain name, so that the client can receive data normally.
  • the network resource request method provided by the present application obtains the response result of the network resource request sent by the client to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, Then, obtain the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name as the second IP address, send the network resource request with the second IP address as the destination address, and then transfer the requested In the case of sending the network resource to the client, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the reliability of the requested network resource. Moreover, the re-request action in this embodiment is executed by the component, and the component can still interact with the client without adaptive modification by the client, and obtain the response returned by the server to the client. Data, thereby enhancing the versatility and adaptability of components.
  • an apparatus 500 for requesting network resources provided by an embodiment of the present application, the apparatus 500 includes:
  • the network unit 510 is configured to send a network resource request to the target domain name, and obtain a response result of the network resource request.
  • the response identification unit 520 is configured to, if the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
  • the address search unit 530 is configured to obtain a second IP address corresponding to the target domain name if it is sent based on the first IP address, where the second IP address is a historical network resource that successfully requests the network resource corresponding to the target domain name The destination IP address of the request.
  • the network unit 540 is further configured to send a network resource request using the second IP address as a destination address. Wherein, as a way, the network unit 540 specifically detects that a touch operation requesting the network resource corresponding to the target domain name is triggered, and sends a network resource request with the second IP address as the destination address.
  • the address search unit 530 is specifically configured to search for a locally stored second IP address corresponding to the target domain, and the historical network request is sent by the client.
  • the apparatus 500 may further include a data reporting unit 531, which is configured to report the target domain name to the advance if the second IP address corresponding to the target domain is not found locally.
  • the set server is configured to report the target domain name to the advance if the second IP address corresponding to the target domain is not found locally.
  • the address lookup unit 530 may also be specifically configured to send an IP address acquisition request carrying the target domain name to a designated server, and the IP address acquisition request is used by the designated server to crawl information corresponding to the target domain name.
  • the network unit 540 is specifically configured to send a network resource request using the second IP address as a destination address and carrying a first identifier, where the first identifier is used to characterize the purpose of the network resource request
  • the IP address is found locally from the client.
  • the address lookup unit 530 is specifically configured to respond to the identification unit 520 to identify the network resource request that is not successfully obtained. If the request is not sent based on the first IP address, identify whether the response result carries the The first identifier; if the response result carries the first identifier, use a web crawler to crawl the second IP address corresponding to the target domain name, where the historical network request is from the client Sending to devices other than electronic devices.
  • the network unit 540 is specifically configured to send a network resource request that uses the crawled second IP address as a destination address and carries a second identifier, and the second identifier is used to represent The destination IP address in the network resource request is obtained from the network.
  • the address search unit 530 is specifically configured to send an IP address acquisition request carrying the target domain name to a designated server, and the IP address acquisition request is used by the designated server to crawl the second corresponding to the target domain name. And return the crawled second IP address to the electronic device.
  • the data reporting unit 531 is further configured to, if the network unit 540 recognizes that the response result carries the second identifier, report the target domain name to a preset server.
  • the device 500 further includes a page control unit 550, configured to display a page with a network resource request error if the response result carries the second identifier.
  • the page control unit 550 is further configured to continue to display the interface displayed in the process of waiting for the response result when the response result indicates that the acquisition is not successful.
  • the network unit 540 is configured to simultaneously send a network resource request using the IP address again obtained through domain name resolution as a destination address and a network resource request using the second IP address as the destination address,
  • the response identification unit 520 is further configured to: if the response result of the network resource request with the second IP address as the destination address is detected, it indicates that the requested network resource is successfully obtained, and then terminate the response to the second IP address.
  • the IP address obtained based on domain name resolution again is the IP address corresponding to the target domain name obtained by the network unit 540 based on the switched DNS server.
  • the apparatus 500 in this embodiment can be understood as the aforementioned client, or a software unit in the client, or can be understood as a hardware device for performing the aforementioned steps.
  • an apparatus 600 for requesting network resources includes:
  • the data obtaining unit 610 is configured to obtain the response result of the network resource request sent by the client to the target domain name.
  • the response identification unit 620 is configured to identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on a domain name resolution method, if the response result indicates that the acquisition is not successful.
  • the address search unit 630 is configured to obtain a second IP address corresponding to the target domain name if it is sent based on the first IP address, where the second IP address is a historical network resource that successfully requests the network resource corresponding to the target domain name The destination IP address of the request.
  • the network unit 640 is configured to send a network resource request using the second IP address as a destination address.
  • the data forwarding unit 650 is configured to send the network resource requested by the network resource request with the second IP address as the destination address to the client.
  • the functions that can be implemented by the unit with the same name in the device 600 and the unit in the device 500 are the same.
  • the functions that can be implemented by the response identification unit 520 in the device 500 are the same in the response identification unit 620 in the device 600. It can be realized.
  • the functions that can be realized by the address searching unit 530 in the device 500 can be realized by the address searching unit 630 in the device 600.
  • the apparatus 600 in this embodiment can be regarded as the aforementioned component, and can also be understood as a hardware device for executing the steps performed by the aforementioned component.
  • an embodiment of the present application also provides another electronic device 100 that can execute the foregoing network resource request method.
  • the electronic device 100 includes one or more (only one is shown in the figure) a processor 102, a memory 104, and a wireless module 106 coupled to each other.
  • the memory 104 stores a program that can execute the content in the foregoing embodiment, and the processor 102 can execute the program stored in the memory 104.
  • the processor 102 may include one or more processing cores.
  • the processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and calling data stored in the memory 104.
  • the processor 102 may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 102 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented by a communication chip alone.
  • the memory 104 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 104 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 104 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions for implementing the following method embodiments, etc.
  • the data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
  • the wireless module 106 is used to receive and send electromagnetic waves, and realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other equipment, such as communicating with an audio playback device.
  • the wireless module 106 may include various existing circuit elements for performing these functions, for example, an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a subscriber identity module (SIM) card, a memory, etc. .
  • SIM subscriber identity module
  • the wireless module 106 can communicate with various networks such as the Internet, an intranet, and a wireless network, or communicate with other devices through a wireless network.
  • the aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network.
  • the wireless module 106 can exchange information with the base station.
  • FIG. 12 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 800 has a storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read out from or written into one or more computer program products.
  • the program code 810 may be compressed in a suitable form, for example.
  • the network resource request method, device, electronic device, and storage medium obtained by the present application obtain the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, the recognition The network request is sent based on the first IP address, then the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name is obtained as the second IP address, and the second IP address is sent as the The network resource request of the destination address. In this way, when network resources cannot be requested under normal domain name resolution, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the requesting network Reliability of resources.

Abstract

A network resource request method and apparatus, an electronic device and a storage medium. The method comprises: sending a network resource request to a target domain name, and acquiring a result of response to the network resource request (S110); if the result of response indicates that acquisition is not successful, identifying whether the network resource request is sent on the basis of a first IP address, wherein the first IP address is an IP address acquired on the basis of domain name resolution (S120); if same is sent on the basis of the first IP address, acquiring a second IP address corresponding to a target domain name (S130), wherein the second IP address is a destination IP address of a historical network resource request whereby a network resource corresponding to the target domain name was successfully requested; and sending a network resource request with the second IP address as a destination address (S140). The method realizes it being possible, when a network resource cannot be requested on the basis of normal domain name resolution, to request a network resource again on the basis of an IP address whereby a network resource was successfully requested historically, thereby improving the success rate of requesting a network resource and also improving the reliability of requesting a network resource.

Description

网络资源请求方法、装置、电子设备以及存储介质Network resource request method, device, electronic equipment and storage medium 技术领域Technical field
本申请涉及计算机技术领域,更具体地,涉及一种网络资源请求方法、装置、电子设备以及存储介质。This application relates to the field of computer technology, and more specifically, to a method, device, electronic device, and storage medium for requesting network resources.
背景技术Background technique
随着经济和社会的发展,手机已经变成了人们的必需品,上网的人数越来越多,浏览器作为浏览网页的工具,访问网页的可靠性就变的越来越重要。With the development of economy and society, mobile phones have become a necessity for people, and more and more people are surfing the Internet. As a tool for browsing webpages, browsers have become more and more important for the reliability of visiting webpages.
发明内容Summary of the invention
鉴于上述问题,本申请提出了一种网络资源请求方法、装置、电子设备以及存储介质,以改善上述问题。In view of the above-mentioned problems, this application proposes a network resource request method, device, electronic equipment, and storage medium to improve the above-mentioned problems.
第一方面,本申请提供了一种网络资源请求方法,应用于客户端,所述方法包括:向目标域名发送网络资源请求,获取所述网络资源请求的响应结果;若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址;若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址;发送以所述第二IP地址作为目的地址的网络资源请求。In the first aspect, this application provides a network resource request method applied to a client. The method includes: sending a network resource request to a target domain name to obtain a response result of the network resource request; if the response result indicates no If the acquisition is successful, it is identified whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution; if it is sent based on the first IP address, the target domain name corresponding to the target domain name is acquired. A second IP address, where the second IP address is a destination IP address of a historical network resource request that successfully requests a network resource corresponding to the target domain name; and a network resource request that uses the second IP address as the destination address is sent.
第二方面,本申请提供了一种网络资源请求方法,应用于具备与客户端通信功能的组件,所述方法包括:获取所述客户端向目标域名发送的网络资源请求的响应结果;若所述响应结果表征没有成功获取,识别所述网络资源请求是否为基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址;若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址;发送以所述第二IP地址作为目的地址的网络资源请求;将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端。In a second aspect, this application provides a method for requesting network resources, which is applied to a component capable of communicating with a client. The method includes: obtaining a response result of a network resource request sent by the client to a target domain name; The response result indicates that the acquisition was not successful, and it is identified whether the network resource request is sent based on the first IP address, and the first IP address is an IP address acquired based on domain name resolution; if it is sent based on the first IP address, the acquisition is The second IP address corresponding to the target domain name, where the second IP address is the destination IP address of the historical network resource request that successfully requests the network resource corresponding to the target domain name; sending the second IP address as the destination address Network resource request; sending the network resource requested by the network resource request with the second IP address as the destination address to the client.
第三方面,本申请提供了一种电子设备,包括一个或多个处理器以及存储器;一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行以实现上述的方法。In a third aspect, this application provides an electronic device, including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors Implement the above method.
第四方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行上述的方法。In a fourth aspect, the present application provides a computer-readable storage medium in which program code is stored, wherein the above-mentioned method is executed when the program code is run by a processor.
本申请提供的一种网络资源请求方法、装置、电子设备以及存储介质,通过获取向 目标域名发送的网络资源请求的响应结果,若所述响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送,那么就再获取成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,发送以所述第二IP地址作为目的地址的网络资源请求。从而通过上述方式实现在基于正常的域名解析方式下无法请求到网络资源时,可以在基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。The network resource request method, device, electronic equipment, and storage medium provided in this application obtain the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is based on The first IP address is sent, then the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name is obtained as the second IP address, and the network resource with the second IP address as the destination address is sent request. In this way, when network resources cannot be requested under normal domain name resolution, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the requesting network Reliability of resources.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
图1示出了本申请实施例提出的一种网络资源请求方法的应用网络环境图;Figure 1 shows an application network environment diagram of a network resource request method proposed in an embodiment of the present application;
图2示出了本申请实施例提出的一种网络资源请求方法的流程图;FIG. 2 shows a flowchart of a method for requesting network resources proposed by an embodiment of the present application;
图3示出了本申请再一实施例提出的一种网络资源请求方法的流程图;FIG. 3 shows a flowchart of a method for requesting network resources proposed by still another embodiment of the present application;
图4示出了本申请另一实施例提出的一种网络资源请求方法的流程图;FIG. 4 shows a flowchart of a method for requesting network resources proposed by another embodiment of the present application;
图5示出了本申请另一实施例提出的一种网络资源请求方法的流程图;FIG. 5 shows a flowchart of a method for requesting network resources according to another embodiment of the present application;
图6示出了本申请另一实施例提出的一种网络资源请求方法的流程图;FIG. 6 shows a flowchart of a method for requesting network resources proposed by another embodiment of the present application;
图7示出了本申请实施例提出的一种网络资源请求装置的结构框图;FIG. 7 shows a structural block diagram of a network resource request device proposed by an embodiment of the present application;
图8示出了本申请再一实施例提出的一种网络资源请求装置的结构框图;FIG. 8 shows a structural block diagram of a network resource request apparatus proposed by another embodiment of the present application;
图9示出了本申请另一实施例提出的一种网络资源请求装置的结构框图;FIG. 9 shows a structural block diagram of a network resource request apparatus proposed by another embodiment of the present application;
图10示出了本申请另一实施例提出的一种网络资源请求装置的结构框图;FIG. 10 shows a structural block diagram of a network resource request apparatus proposed by another embodiment of the present application;
图11示出了本申请实时中的用于执行根据本申请实施例的网络资源请求方法的电子设备的结构框图;FIG. 11 shows a structural block diagram of an electronic device for executing the method for requesting network resources according to an embodiment of the present application in real time of the present application;
图12示出了本申请实时中的用于保存或者携带实现根据本申请实施例的网络资源请求方法的程序代码的存储单元。Fig. 12 shows a storage unit used to store or carry the program code implementing the network resource request method according to the embodiment of the present application in real time of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of this application.
网域名称系统(DNS,Domain Name System,有时也简称为域名)是因特网的一项核心服务,它作为可以将域名和IP地址相互映射的一个分布式数据库,能够使人更方便的访问互联网,而不用去记住能够被机器直接读取的IP地址数串。例如,www.wikipedia.org是一个域名,和IP地址208.80.152.2相对应。DNS就像是一个自动的电话号码簿,我们可以直接拨打wikipedia的名字来代替电话号码(IP地址)。我们直接调用网站的名字以后,DNS就会将便于人类使用的名字(如www.wikipedia.org)转化成便于机器识别的IP地址(如208.80.152.2)。The Domain Name System (DNS, sometimes referred to as domain name) is a core service of the Internet. As a distributed database that can map domain names and IP addresses to each other, it can make it easier for people to access the Internet. There is no need to remember the number of IP addresses that can be directly read by the machine. For example, www.wikipedia.org is a domain name that corresponds to the IP address 208.80.152.2. DNS is like an automatic telephone directory, we can directly dial the name of Wikipedia instead of phone number (IP address). After we directly call the name of the website, DNS will convert a human-friendly name (such as www.wikipedia.org) into an IP address (such as 208.80.152.2) that is easy to recognize by machines.
如图1所示,当用户在图1中所示的电子设备100中的客户端中输入或者选择www.wikipedia.org作为目标域名后,电子设备100将www.wikipedia.org发送到域名服务器200,域名服务器200就会对www.wikipedia.org进行解析得到对应的IP地址,然后将该解析得到的IP地址返回给电子设备100,然后电子设备100就会向该IP地址所指向的服务器300发送网络资源请求。其中,该客户端可以为具备网络通信功能的应用程序,例如,可以为浏览器,也可以为即时聊天软件,或者也可以为视频软件等。As shown in FIG. 1, when the user inputs or selects www.wikipedia.org as the target domain name in the client of the electronic device 100 shown in FIG. 1, the electronic device 100 sends www.wikipedia.org to the domain name server 200 , The domain name server 200 will resolve www.wikipedia.org to obtain the corresponding IP address, and then return the resolved IP address to the electronic device 100, and then the electronic device 100 will send to the server 300 pointed to by the IP address Network resource request. Wherein, the client can be an application with network communication function, for example, it can be a browser, it can be instant chat software, or it can be video software, etc.
而发明人在研究中发现,有时候因为域名解析错误或者域名服务器不可用,电子设备在请求网络资源的过程中无法获取到有效的IP地址,就无法发送网络资源请求,造成电子设备无法即时的获取到所需要的网络资源。再或者因为存储网络资源的服务器的IP地址发生改变后,域名服务器没有即时的更新,造成域名服务器返回给电子设备的为废弃的IP地址,进而也会造成电子设备无法即时的获取到所需要的网络资源,从而使得电子设备上发起网络请求的客户端也无法获取到所需的网络资源,造成客户端的请求网络资源的可靠性有待提升。However, the inventor found in his research that sometimes because of domain name resolution errors or the unavailability of the domain name server, the electronic device cannot obtain a valid IP address in the process of requesting network resources, and therefore cannot send network resource requests, causing the electronic device to fail to respond immediately. Obtain the required network resources. Or because the IP address of the server storing network resources is changed, the domain name server is not updated in real time, causing the domain name server to return to the electronic device as a discarded IP address, which will also cause the electronic device to fail to obtain what it needs instantly Network resources, so that the client that initiates the network request on the electronic device cannot obtain the required network resources, and the reliability of the client's request for network resources needs to be improved.
因此,发明人提出了申请中的通过在基于正常的域名解析方式下无法请求到网络资源时,可以在基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性的网络资源请求方法、装置、电子设备以及存储介质。Therefore, the inventor proposed that when network resources cannot be requested under the normal domain name resolution method, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby improving the success rate of the network resource request. , And also improve the reliability of requesting network resources, network resource request methods, devices, electronic equipment and storage media.
需要说明的,在电子设备中运行有具有前台界面的客户端,例如,浏览器、即使聊天软件或者视频软件等。还可以运行一些不会向用户展示网络资源而是对前述的客户端进行管理的组件。此外,电子设备中还可以运行一些仅在后台运行而不具有用户交互界面的组件,其中,前述的组件也可以以独立的应用程序运行,也可以作为客户端的一个SDK插件运行。那么对于本申请实施例提供的网络资源请求方法,可以运行于前述的客户端,也可以运行于前述的组件,而对于其中的具体运行方式,将通过后续的实施例进行相信的介绍。It should be noted that a client with a front-end interface is running in the electronic device, for example, a browser, even chat software, or video software. You can also run some components that do not show network resources to users but manage the aforementioned clients. In addition, the electronic device can also run some components that only run in the background without a user interaction interface. The aforementioned components can also be run as independent applications or run as an SDK plug-in of the client. Then, the network resource request method provided by the embodiment of the present application can run on the aforementioned client or the aforementioned component, and the specific operation mode will be introduced through the following embodiments.
下面将结合附图具体描述本申请的各实施例。The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
请参阅图2,本申请实施例提供的一种网络资源请求方法,应用于客户端,所述方法包括:Refer to Fig. 2, a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
步骤S110:向目标域名发送网络资源请求,获取所述网络资源请求的响应结果。Step S110: Send a network resource request to the target domain name, and obtain a response result of the network resource request.
其中,网络资源请求可以是客户端检测到客户端中的域名输入区域处有域名输入后触发,也可以是客户端检测到所展示的某个超链接被触控后触发。例如,若客户端检测到域名输入区域中输入有域名,然后检测到开始搜索的控件被触发后,即可开始生成并发送一个请求该输入的域名对应的网络资源的网络资源请求。再例如,客户端的界面中显示有一个配置有超链接的文本,例如,该文本对应的超链接为oppo.com,那么当客户端检测到该文本被触控后,即可生成并发送一个请求域名为oppo.com的网络资源的网络资源请求。Wherein, the network resource request may be triggered after the client detects that the domain name input area in the client has a domain name input, or it may be triggered after the client detects that a certain hyperlink displayed is touched. For example, if the client detects that a domain name is entered in the domain name input area, and then detects that the search start control is triggered, it can start to generate and send a network resource request requesting the network resource corresponding to the entered domain name. For another example, a text configured with a hyperlink is displayed on the interface of the client. For example, if the hyperlink corresponding to the text is oppo.com, when the client detects that the text is touched, it can generate and send a request A network resource request for a network resource whose domain name is oppo.com.
当客户端向目标域名发送网络资源请求后,会对所述网络资源请求的响应结果的进行检测。可以理解的是,网络资源请求是通过网络向目标域名对应的服务器发送的,那么可能因为目标域名对应的服务器本身的问题,或者因为中间传输数据的网络的问题,服务器无法对网络请求进行响应,或者服务器能够响应,但是作为响应的响应数据无法成功的返回到客户端。再或者目标域名对应的服务器返回的响应数据为一些错误代码。那么基于上述方式,对于一个网络资源请求的响应结果可能会是包括所请求资源的响应数据,可能是包括错误代码的响应数据,也可以会是在指定时间内没有响应数据返回。其中,当客户端确定获取到的响应数据包括所请求的资源时,判定所述响应结果表征获取成功,当客户端确定获取到的响应数据包括错误代码或者客户端确定在指定时间内没有响应数据返回的情况下,确定响应结果表征没有获取成功。After the client sends a network resource request to the target domain name, it will detect the response result of the network resource request. It is understandable that the network resource request is sent to the server corresponding to the target domain name through the network, so the server may not be able to respond to the network request due to the problem of the server corresponding to the target domain name or the network problem of the intermediate data transmission. Or the server can respond, but the response data as a response cannot be successfully returned to the client. Or the response data returned by the server corresponding to the target domain name is some error code. Then, based on the above method, the response result for a network resource request may include response data of the requested resource, may include response data including an error code, or it may be that no response data is returned within a specified time. Wherein, when the client determines that the acquired response data includes the requested resource, it is determined that the response result indicates that the acquisition is successful, and when the client determines that the acquired response data includes an error code or the client determines that there is no response data within a specified time In the case of return, it is determined that the response result characterization is not obtained successfully.
以http请求为例,客户端在基于http协议生成并发送网络资源请求后,若有同样基于http协议响应数据返回后,客户端可以识别响应数据中的http响应头的statu字段的值,若该 statu字段的值为200,表征成功获取到了所请求的网络资源,则会判定响应结果表征获取成功,若该statu字段的值为400表征只返回了错误代码或者客户端在指定时间后没有接收到基于http协议的响应数据,则会判定响应结果表征没有获取成功。Take the http request as an example. After the client generates and sends a network resource request based on the http protocol, if the response data is also returned based on the http protocol, the client can identify the value of the status field in the http response header in the response data. The value of the statu field is 200, which indicates that the requested network resource is successfully obtained, and the response result indicates that the acquisition is successful. If the value of the statu field is 400, it indicates that only an error code was returned or the client did not receive it after the specified time Based on the response data of the http protocol, it will be determined that the response result characterization is not obtained successfully.
步骤S120:若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。Step S120: If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
其中,对于客户端可以有多种方式来识别发送的网络资源请求中的目的地址的来源。Among them, there are multiple ways for the client to identify the source of the destination address in the sent network resource request.
作为一种方式,客户端可以在生成网络资源请求时,在请求中添加特定的字段来标识本次请求的目的IP地址的来源。那么在这种方式下,服务器再进行响应数据返回时也会在响应数据中对应的添加该特定的字段。进而使得客户端在接收到响应数据后,通过识别该响应数据中的该特定字段的值,就可以判断本次网络资源请求的目的IP地址是如何获取的。As a way, the client can add a specific field to the request to identify the source of the destination IP address of the request when generating a network resource request. Then in this way, when the server returns the response data, the specific field will be added to the response data. Furthermore, after receiving the response data, the client can determine how the destination IP address of this network resource request is obtained by identifying the value of the specific field in the response data.
例如,在以http协议发送网络资源请求的过程中,可以在基于http协议的网络资源请求的请求头中添加该特定的字段,那么对应的,客户端就可以在基于http的响应数据的响应头中通过识别该特定的字段的值来确定,本次网络资源请求所采用的目的地址的来源。通过这种方式,可以直接利用现有协议中的字段来标识目的IP地址的来源,进而可以实现不会对客户端的代码做较多的改变,降低客户端的开发成本,也使得这种方式具有更好的通用性。For example, in the process of sending a network resource request based on the http protocol, the specific field can be added to the request header of the network resource request based on the http protocol, then the client can correspondingly specify the response header of the http-based response data The source of the destination address used in this network resource request is determined by identifying the value of the specific field. In this way, the fields in the existing protocol can be directly used to identify the source of the destination IP address, and the client's code will not be changed much, the development cost of the client can be reduced, and this method has more advantages. Good versatility.
此外,作为另外一种方式,客户端可以在生成的网络资源请求后,将该网络资源请求的请求头与另一个唯一存在的标识符进行对应的存储,而该唯一存在的标识符可以通过自身的格式或者字符内容来标识对应的网络资源请求的目的地址的来源,进而使得客户端可以通过对该标识符的识别来确定标识符对应的网络资源请求的目的地址的来源。In addition, as another way, the client can store the request header of the network resource request corresponding to another unique identifier after the generated network resource request, and the unique identifier can pass its own The format or character content of the corresponding to identify the source of the destination address of the corresponding network resource request, so that the client can determine the source of the destination address of the network resource request corresponding to the identifier by identifying the identifier.
例如,如下表所示,For example, as shown in the following table,
IDID Request_dataRequest_data Source_IdSource_Id
11 AaaAaa A01A01
22 BbbBbb A02A02
33 CccCcc B01B01
在上表中,字段Request_data用于存储请求头,字段Source_Id用于存储前述的唯一标识符。那么所对应的字段ID的值相同的请求头和标识符为存在对应关系。需要说明的是,对于标识符可以配置以“A”开头的表征为基于域名解析的方式获取到,以“B”开头的为从本地查找获取到,“C”开头的为从网络获取得到,而字母后面的数字可以用于表示这是第几次发送以这种方式获取的IP地址作为目的IP的网络资源请求。例如,A01表示第一次以域名解析得到的IP地址作为目的IP发送的网络资源请求,而A02表示第二次以域名解析得到的IP地址作为目的IP发送的网络资源请求。那么在这种方式下,客户端在接收到响应数据后,就可以从里面提取出响应头与上表中的请求头进行匹配,进而获取到与响应头匹配的请求头所对应的标识符来作为判定本次网络资源请求的目的IP来源判断的依据。例如,若收到的响应头与请求头“Aaa”匹配,那么就可以与“Aaa”对应的标识符“A01”判定本次网络资源请求是的目的地址为域名解析得到的。In the above table, the field Request_data is used to store the request header, and the field Source_Id is used to store the aforementioned unique identifier. Then the corresponding request header and identifier with the same field ID value have a corresponding relationship. It should be noted that the identifiers starting with "A" can be configured to be obtained based on domain name resolution, those starting with "B" are obtained from local search, and those starting with "C" are obtained from the network. And the number after the letter can be used to indicate how many times this is the network resource request that the IP address obtained in this way is sent as the destination IP. For example, A01 represents the first network resource request sent using the IP address obtained by domain name resolution as the destination IP, and A02 represents the second network resource request sent using the IP address obtained by domain name resolution as the destination IP for the second time. Then in this way, after the client receives the response data, it can extract the response header from it and match it with the request header in the above table, and then obtain the identifier corresponding to the request header that matches the response header. As a basis for determining the source of the destination IP of this network resource request. For example, if the received response header matches the request header "Aaa", the identifier "A01" corresponding to "Aaa" can be used to determine that the destination address of this network resource request is obtained by domain name resolution.
通过上述配置标识符的方式,可以实现不对生成的网络资源请求进行修改,进而降低服务端与客户端所采用的协议版本不同时,所带来的数据处理错误。例如,服务端在生成响应数据时,因为所采集的协议问题,而没有在响应头中证件前述的特定的字段。需要说明的是的上表中的请求头的内容只是示例性的,具体的请求头会根据所使用的通信协议不同而不同。Through the above method of configuring the identifier, it is possible to realize that the generated network resource request is not modified, thereby reducing the data processing error caused when the protocol versions adopted by the server and the client are different. For example, when the server generates response data, it does not document the aforementioned specific fields in the response header because of the collected protocol. It should be noted that the content of the request header in the above table is only exemplary, and the specific request header will vary according to the communication protocol used.
步骤S130:若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址。Step S130: If it is sent based on the first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP of the historical network resource request that successfully requests the network resource corresponding to the target domain name address.
作为一种方式,该第二IP地址可以为从本地获取,也可以从网络获取。其中本地获取的第二IP地址,可以为客户端之前基于域名解析方式得到的,且作为网络资源请求的目的IP成功获取到网络资源的IP地址。例如,客户端在步骤S110中发送的为域名oppo.com的网络资源请求,那么这里的是将oppo.com作为目标域名,那么客户端就可以在本地查找之前基于oppo.com这个域名解析得到的可以成功请求到网络资源的IP地址,来作为第二IP地址。而从网络获取到的第二IP地址可以为客户端所在电子设备以外的设备,之前基于域名解析方式 得到的,且作网络资源请求的目的IP成功获取到网络资源的IP地址。As a way, the second IP address may be obtained locally or obtained from the network. The second IP address obtained locally may be obtained by the client based on a domain name resolution method, and successfully obtained the IP address of the network resource as the destination IP of the network resource request. For example, if the client sends a network resource request for the domain name oppo.com in step S110, then here is oppo.com as the target domain name, then the client can resolve it based on the domain name oppo.com before searching locally The IP address of the network resource can be successfully requested as the second IP address. The second IP address obtained from the network may be a device other than the electronic device where the client is located. It was previously obtained based on the domain name resolution method and successfully obtained the IP address of the network resource as the destination IP of the network resource request.
需要说明的是,不同的电子设备所配置的域名服务器不同,或者不同的电子设备所在的网络不同的情况下,即使都是基于域名解析的方式,所解析得到的与域名对应的IP也可能会不同。那么这里客户端所在电子设备以外的设备可以包括处于不同城市、省份或者国家的设备,或者也可以是其他用户的电子设备,该其他用户可以包括注册信息中的所在城市不同的用户,也可以为注册信息中不同国家的用户。其中可以通过用户注册时,所使用的电子设备被分配的IP来确定用户所在城市或者国家。It should be noted that when different electronic devices are configured with different domain name servers, or different electronic devices are on different networks, even if they are all based on domain name resolution, the IP corresponding to the domain name obtained by the resolution may be different. different. Then the devices other than the electronic device where the client is located may include devices located in different cities, provinces, or countries, or other users’ electronic devices. The other users may include users in different cities in the registration information, or they may be Users in different countries in the registration information. The city or country where the user is located can be determined by the IP assigned to the electronic device used when the user registers.
步骤S140:发送以所述第二IP地址作为目的地址的网络资源请求。Step S140: Send a network resource request with the second IP address as the destination address.
而若检测到不是基于第一IP地址发送的,那么客户端可以判定已经基于前述的步骤S130的方式再次尝试过获取目标域名的网络资源,但是依然无法成功获取,那么进而可以向指定的服务器上报该目标域名。If it is detected that it is not sent based on the first IP address, the client can determine that it has tried again to obtain the network resources of the target domain name based on the aforementioned step S130, but it still cannot be successfully obtained, then it can report to the designated server. The target domain name.
本申请提供的一种网络资源请求方法,通过获取向目标域名发送的网络资源请求的响应结果,若所述响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送,那么就再获取成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,发送以所述第二IP地址作为目的地址的网络资源请求。从而通过上述方式实现在基于正常的域名解析方式下无法请求到网络资源时,可以在基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。The network resource request method provided by this application obtains the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then Then obtain the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name as the second IP address, and send the network resource request with the second IP address as the destination address. In this way, when network resources cannot be requested under normal domain name resolution, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the requesting network Reliability of resources.
请参阅图3,本申请实施例提供的一种网络资源请求方法,应用于客户端,所述方法包括:Please refer to Fig. 3, a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
步骤S210:向目标域名发送网络资源请求,获取所述网络资源请求的响应结果。Step S210: Send a network resource request to the target domain name, and obtain a response result of the network resource request.
步骤S220:若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。Step S220: If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
需要说明的是,在一种相关的方式中,客户端在某一次请求网络资源失败以后,可能会显示一个请求失败的页面,而在本实例中,若在步骤S220中识别到若所述响应结果表征没有获取成功后,直接在客户端显示该请求失败的页面,可能会让用户误以为请求已经结束,进而使得用户以为无法请求到所需的网络资源。那么为了避免该问题,可以在基于域名解析方式获取的IP地址无法成功获取网络资源的情况下,继续显示等待所述响应结果的过程中所显示的界面,然用户以为只是还在第一次的资源请求过程中,以避免上述问题。It should be noted that, in a related manner, after a certain request for network resources fails, the client may display a request failure page, and in this example, if the response is identified in step S220 After the result indicates that the request is not successfully obtained, the page where the request failed is directly displayed on the client side, which may make the user mistakenly think that the request has ended, and thus make the user think that the required network resource cannot be requested. In order to avoid this problem, you can continue to display the interface displayed in the process of waiting for the response result when the IP address obtained based on the domain name resolution method cannot successfully obtain the network resource, but the user thinks that it is only the first time During the resource request process, to avoid the above problems.
步骤S230:若是基于第一IP地址发送,查找本地存储的与所述目标域对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址,且所述历史网络请求由所述客户端发送。Step S230: If it is sent based on the first IP address, search for a locally stored second IP address corresponding to the target domain, where the second IP address is a historical network resource request that successfully requests the network resource corresponding to the target domain name And the historical network request is sent by the client.
需要说明的是,客户端可以在基于所发送的网络资源请求成功获取到网络资源后,将该成功获取到网络资源的网络资源请求的目的IP地址与目标域名对应存储在本地,以便后续客户端再次使用。其中可以前述的数据表的方式将目标域名与对应的IP地址进行存储。那么当客户端在本地查找IP地址的过程中,就可以基于目标域名然后进行查表,若在本地查找到了与目标域名对应的IP地址,那么就作为第二IP地址,若在本地未查找到与目标域名对应的IP地址,那么就将该目标域名上传给指定的服务器。It should be noted that after the client successfully obtains the network resource based on the sent network resource request, the destination IP address of the network resource request that successfully obtains the network resource and the target domain name are stored locally for subsequent clients Use again. The target domain name and the corresponding IP address can be stored in the manner of the aforementioned data table. Then when the client searches the IP address locally, it can look up the table based on the target domain name. If the IP address corresponding to the target domain name is found locally, it will be used as the second IP address. If it is not found locally The IP address corresponding to the target domain name, then upload the target domain name to the designated server.
步骤S240:发送以所述第二IP地址作为目的地址,且携带有第一标识的网络资源请求,所述第一标识为用于表征网络资源请求中的目的IP地址为从所述客户端本地查找。Step S240: Send a network resource request that uses the second IP address as the destination address and carries a first identifier, where the first identifier is used to indicate that the destination IP address in the network resource request is from the client local Find.
步骤S250:若不是基于第一IP地址发送,识别所述响应结果中是否携带有所述第一标识。Step S250: If it is not sent based on the first IP address, identify whether the response result carries the first identifier.
如前述的内容所介绍的,可以在生成的网络资源请求中添加特定的字段用于标识网络资源请求的目的IP地址的来源,对应的服务端在生成响应数据时也会增加该特定的字段,并且响应数据中该特定字段的值和对应的网络资源请求中的特定字段的值是相同的。在这种方式下,若该特定的字段值为第一标识,就可以判定网络资源请求中的目的IP地址为从本地获取的,而若该特定的字段值为第二标识,就可以判定网络资源请求中的目 的IP地址为从网络获取的。As described in the foregoing content, a specific field can be added to the generated network resource request to identify the source of the destination IP address of the network resource request, and the corresponding server will also add the specific field when generating the response data. And the value of the specific field in the response data is the same as the value of the specific field in the corresponding network resource request. In this way, if the specific field value is the first identifier, it can be determined that the destination IP address in the network resource request is obtained locally, and if the specific field value is the second identifier, it can be determined that the network The destination IP address in the resource request is obtained from the network.
步骤S260:若所述响应结果中携带有所述第一标识,采用网络爬虫的方式爬取与所述目标域名对应的第二IP地址,其中,所述历史网络请求由所述客户端所在的电子设备以外的设备发送。Step S260: If the response result carries the first identifier, use a web crawler to crawl the second IP address corresponding to the target domain name, wherein the historical network request is from the client Sending from devices other than electronic devices.
作为一种方式,可以预先指定一个或多个具备网络爬取功能的服务器,作为执行爬取动作的IP获取服务器。在这种方式下,客户端可以向该IP获取服务器发送IP地址获取请求,该IP地址获取请求中携带有目标域名,以便IP获取服务器知道需要去获取与哪个域名对应的IP地址。当接收到该IP地址获取请求后,IP获取服务器就会启动网络爬虫功能到网络中爬取与该目标域名对应的IP地址,当IP获取服务器获取到与该目标域名对应的IP地址后,就会将爬取到的IP地址返回给客户端,客户端在接收到IP获取服务器返回的IP地址后,就会将该返回的IP地址作为第二IP地址。As a way, one or more servers with a network crawling function can be designated in advance as the IP acquisition server for performing the crawling action. In this way, the client can send an IP address acquisition request to the IP acquisition server, and the IP address acquisition request carries the target domain name, so that the IP acquisition server knows which domain name corresponding IP address needs to be acquired. After receiving the IP address acquisition request, the IP acquisition server will start the web crawler function to crawl the IP address corresponding to the target domain name in the network. When the IP acquisition server obtains the IP address corresponding to the target domain name, it will The crawled IP address will be returned to the client. After the client receives the IP address returned by the IP acquisition server, it will use the returned IP address as the second IP address.
需要说明的是,作为一种方式,该IP获取服务器所用的网络爬取方式,可以采用现有的网络爬取方式,此处不再详细描述。而作为另外一种方式,该IP获取服务器可以向另外区域的服务器发送同样携带有前述目标域名的IP获取请求,而该另外区域的服务器获取IP获取请求后,会模拟客户端发起域名解析,然后利于域名解析的方式获取到与目标域名对应的IP地址,进而再利用该IP地址发送网络资源请求,若检测到网络资源请求被成功响应,那么会在检测到网络资源请求被成功响应(此时,所请求的数据可能还未全部返回)时,另外区域的服务器就会将所获取的IP地址立刻返回给IP获取服务器,进而IP获取服务器再将另外区域的服务器返回的IP地址返回给客户端,以便客户端作为第二IP地址。It should be noted that, as a way, the network crawling method used by the IP acquisition server can be an existing network crawling method, which will not be described in detail here. As another way, the IP acquisition server can send an IP acquisition request that also carries the aforementioned target domain name to a server in another region. After the server in the other region acquires the IP acquisition request, it will simulate the client to initiate domain name resolution, and then Obtain the IP address corresponding to the target domain name by way of domain name resolution, and then use the IP address to send the network resource request. If it is detected that the network resource request is successfully responded, it will be detected when the network resource request is successfully responded (at this time) , The requested data may not be all returned), the server in another area will immediately return the obtained IP address to the IP acquisition server, and the IP acquisition server will then return the IP address returned by the server in the other area to the client , So that the client is the second IP address.
其中,需要说明的是,前述的另外区域可以是指另外的城市,另外的省份或者另外的国家。可以理解的是,不同的区域或者不同的网络服务提供商所采用的域名服务器是不同的,那么就可能会因为域名信息没有同步,造成同一个域名在不同的区域所解析得到的对应的IP地址会有区别。那么通过前述的让另外的区域的服务器再次去尝试域名解析,就可以增加获取到能够请求到网络资源的IP地址的概率,进而增加客户端获取到所需网络资源的成功率。Among them, it should be noted that the aforementioned additional region may refer to another city, another province, or another country. It is understandable that the domain name servers used by different regions or different network service providers are different, so the domain name information may not be synchronized, resulting in the corresponding IP addresses of the same domain name resolved in different regions There will be a difference. Then, by letting servers in other regions try domain name resolution again as described above, the probability of obtaining an IP address that can request network resources can be increased, thereby increasing the success rate of the client in obtaining the required network resources.
步骤S270:发送将所述爬取的第二IP地址作为目的地址,且携带有第二标识的网络资源请求,所述第二标识用于表征网络资源请求中的目的IP地址为从网络获取。Step S270: Send a network resource request that uses the crawled second IP address as a destination address and carries a second identifier, where the second identifier is used to indicate that the destination IP address in the network resource request is obtained from the network.
步骤S280:若所述响应结果中未携带有所述第一标识,且携带有所述第二标识,将所述目标域名上报给预先设定的服务器。Step S280: If the response result does not carry the first identifier and carries the second identifier, report the target domain name to a preset server.
作为一种方式,若所述响应结果中携带有所述第二标识,显示网络资源请求错误的页面,并将上述目标域名发送的指定的服务器。As a way, if the response result carries the second identifier, a page of the network resource request error is displayed, and the target domain name is sent to the designated server.
本申请提供的一种网络资源请求方法,在向目标域名发送的网络资源请求的响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送的情况下,那么就先获取本地存储的成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,发送以所述第二IP地址作为目的地址的网络资源请求,若将从本地获取的第二IP地址作为目的地址发送的网络资源请求失败的情况下,再从网络爬取其他设备发送的成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,从而通过上述方式实现在基于正常的域名解析方式下无法请求到网络资源时,可以在基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。This application provides a network resource request method. When the response result of the network resource request sent to the target domain name indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then the local storage is obtained first The successful request to the destination IP address of the historical network resource request of the network resource corresponding to the target domain name is used as the second IP address, and the network resource request with the second IP address as the destination address is sent, if the first obtained locally 2. In the case that the network resource request sent by the IP address as the destination address fails, the destination IP address of the historical network resource request from the successful request sent by other devices to the network resource corresponding to the target domain name is crawled from the network as the second IP address Therefore, when network resources cannot be requested under normal domain name resolution based on the above method, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the request The reliability of network resources.
请参阅图4,本申请实施例提供的一种网络资源请求方法,应用于客户端,所述方法包括:Refer to Figure 4, a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
步骤S310:向目标域名发送网络资源请求,获取所述网络资源请求的响应结果。Step S310: Send a network resource request to the target domain name, and obtain a response result of the network resource request.
步骤S320:若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。Step S320: If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
步骤S330:若是基于第一IP地址发送,向指定的服务器发送携带所述目标域名的IP地址获取请求,所述IP地址获取请求用于所述指定的服务器爬取与所述目标域名对应的第二IP地址,并将所述爬取的第二IP地址返回给所述电子设备,其中,所述客户端所在的电子设备以外的设备基于所述爬取的第二IP地址历史成功获取到过所述目标域名对应的网络资源。Step S330: If it is sent based on the first IP address, send an IP address acquisition request carrying the target domain name to a designated server. The IP address acquisition request is used by the designated server to crawl the first IP address corresponding to the target domain name. Two IP addresses, and the crawled second IP address is returned to the electronic device, where a device other than the electronic device where the client is located has successfully acquired a history based on the crawled second IP address history The network resource corresponding to the target domain name.
步骤S340:发送以所述第二IP地址作为目的地址的网络资源请求。Step S340: Send a network resource request with the second IP address as the destination address.
本申请提供的一种网络资源请求方法,通过获取向目标域名发送的网络资源请求的响应结果,若所述响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送,那么就再通过网络获取成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,发送以所述第二IP地址作为目的地址的网络资源请求。从而通过上述方式实现在基于正常的域名解析方式下无法请求到网络资源时,可以在通过网络获取的基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。The network resource request method provided by this application obtains the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then Then, the destination IP address of the historical network resource request that successfully requests the network resource corresponding to the target domain name is acquired through the network as the second IP address, and the network resource request with the second IP address as the destination address is sent. In this way, when network resources cannot be requested under normal domain name resolution based on the above method, the IP address of the network resource can be requested again based on the historically successful request obtained through the network, thereby improving the success rate of the network resource request. It also improves the reliability of requesting network resources.
请参阅图5,本申请实施例提供的一种网络资源请求方法,应用于客户端,所述方法包括:Referring to FIG. 5, a network resource request method provided by an embodiment of the present application is applied to a client, and the method includes:
步骤S410:向目标域名发送网络资源请求,获取所述网络资源请求的响应结果。Step S410: Send a network resource request to the target domain name, and obtain a response result of the network resource request.
步骤S420:若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。Step S420: If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
步骤S430:若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址,并再次基于所述域名解析方式获取的与所述目标域名对应的IP地址。Step S430: If it is sent based on the first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP of the historical network resource request that successfully requests the network resource corresponding to the target domain name Address, and the IP address corresponding to the target domain name obtained based on the domain name resolution method again.
其中,作为一种方式,所述再次基于所述域名解析方式获取的与所述目标域名对应的IP地址的步骤包括:基于切换后的DNS服务器,再次基于所述域名解析方式获取与所述目标域名对应的IP地址。可选的,用户可以在客户端中手动配置多个域名服务器,然后配置该多个域名服务器的优先级,然后客户端可以按照配置的优先级进行域名解析。可以理解的是,客户端切换域名服务器的条件是上一优先级的域名服务器所解析得到的IP地址无法成功请求到所需的网络资源。Wherein, as a way, the step of acquiring the IP address corresponding to the target domain name based on the domain name resolution method again includes: acquiring the IP address corresponding to the target domain name based on the switched DNS server again based on the domain name resolution method. The IP address corresponding to the domain name. Optionally, the user can manually configure multiple domain name servers in the client, and then configure the priority of the multiple domain name servers, and then the client can perform domain name resolution according to the configured priority. It is understandable that the condition for the client to switch the domain name server is that the IP address resolved by the domain name server of the previous priority cannot successfully request the required network resources.
步骤S440:发送以所述第二IP地址作为目的地址的网络资源请求,并发送将以所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求。Step S440: Send a network resource request using the second IP address as a destination address, and send a network resource request using the IP address again obtained by domain name resolution as the destination address.
可以理解的是,在步骤S440中,将会同时发送两个网络资源请求,其中一个网络资源请求的目的IP地址为基于再次进行的域名解析获取到的IP地址,而另外一个网络资源请求的目的IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址。其中,为了使得对于这两个网络资源请求都可以更快的发送,可以采用多线程的方式来并行发送这两个网络资源请求。It is understandable that in step S440, two network resource requests will be sent at the same time. The destination IP address of one network resource request is the IP address obtained based on the domain name resolution performed again, and the purpose of the other network resource request is The IP address is the destination IP address of the historical network resource request that successfully requests the network resource corresponding to the target domain name. Among them, in order to make the two network resource requests can be sent faster, the two network resource requests can be sent in parallel in a multi-threaded manner.
而对于即使是同时发送的两个网络资源请求,受限于网络因素,或者目标域名所对应的服务器的处理先后关系,返回的响应数据的先后可能会有不同。For two network resource requests sent at the same time, due to network factors or the processing sequence of the server corresponding to the target domain name, the sequence of the response data returned may be different.
步骤S450:若检测到所述以所述第二IP地址作为目的地址的网络资源请求的响应成果表征成功获取到所请求的网络资源,终止响应所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求。Step S450: If it is detected that the response result of the network resource request using the second IP address as the destination address indicates that the requested network resource is successfully obtained, terminate the response to the IP address obtained by domain name resolution as the destination Address of the network resource request.
步骤S460:若检测到所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求的响应成果表征成功获取到所请求的网络资源,终止响应以所述第二IP地址作为目的地址的网络资源请求。Step S460: If it is detected that the response result of the network resource request using the IP address obtained by domain name resolution as the destination address indicates that the requested network resource is successfully obtained, terminate the response to the second IP address as the destination address. Network resource request.
可以理解的是,在步骤S440中发送的两个网络资源请求所请求的网络资源都是相同的,若在这两个网络资源请求都成功请求到网络资源的情况下,客户端都对所请求到的网络资源进行处理,势必会造成同样额资源的重复处理,造成资源浪费。例如,若所请求的网络资源为html页面,那么客户端可能就会重复的进行html页面渲染操作,这样 不仅造成资源浪费,还会造成用户误以为页面自己在刷新。那么通过步骤S450以及步骤S460就可以使得客户端对两个网络资源请求进行择一处理,进而避免前述的重复对同样的网络资源进行处理的问题。It is understandable that the network resources requested by the two network resource requests sent in step S440 are the same. If the two network resource requests successfully request network resources, the client will respond to the requested network resources. The processing of the received network resources is bound to cause repeated processing of the same amount of resources, resulting in a waste of resources. For example, if the requested network resource is an html page, the client may repeat the html page rendering operation, which not only causes a waste of resources, but also causes the user to mistakenly think that the page is refreshing. Then, through step S450 and step S460, the client can select one of the two network resource requests, thereby avoiding the aforementioned problem of repeatedly processing the same network resource.
作为一种方式,而若检测到不是基于第一IP地址发送的,那么客户端可以判定已经基于前述的步骤S130的方式再次尝试过获取目标域名的网络资源,但是依然无法成功获取,那么进而客户端可以执行步骤S470:可以向指定的服务器上报该目标域名。As a way, if it is detected that the transmission is not based on the first IP address, the client can determine that it has tried again to obtain the network resources of the target domain name based on the aforementioned step S130, but it still cannot be successfully obtained, then the client The terminal can perform step S470: the target domain name can be reported to the designated server.
本申请提供的一种网络资源请求方法,通过获取向目标域名发送的网络资源请求的响应结果,若所述响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送,那么就同时发送以再次基于域名解析获取的IP地址为目的IP地址的网络资源请求,以及以成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址为目的IP地址的网络资源请求。从而通过上述方式实现在基于正常的域名解析方式下无法请求到网络资源时,可以在通过网络获取的基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。The network resource request method provided by this application obtains the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, then Simultaneously send a network resource request with the IP address obtained based on domain name resolution as the destination IP address, and a network resource request with the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name as the destination IP address . In this way, when network resources cannot be requested under normal domain name resolution based on the above method, the IP address of the network resource can be requested again based on the historically successful request obtained through the network, thereby improving the success rate of the network resource request. It also improves the reliability of requesting network resources.
请参阅图6,本申请实施例提供的一种网络资源请求方法,应用于具备与客户端通信功能的组件,所述方法包括:Referring to FIG. 6, a network resource request method provided by an embodiment of the present application is applied to a component capable of communicating with a client. The method includes:
步骤S510:获取所述客户端向目标域名发送的网络资源请求的响应结果。Step S510: Obtain the response result of the network resource request sent by the client to the target domain name.
作为一种方式,在不对客户端进行改变的情况下,组件可以通过抓包的方式来获取客户端发送的网络资源请求,或者通过抓包的方式来获取服务端返回给客户端的响应数据。作为另外一种方式,可以对客户端进行适应性的改变,以便客户端和组件之间可以通过进程间通信的方式进行数据交互,进而使得客户端在接收到表征没有获取成功的响应结果的情况下,可以通知组件未成功获取网络资源的网络资源请求是目标域名是什么、所采用的目的IP地址是哪个以及所采用的目的IP地址的来源是什么。其中,本实施例中客户端获取网络资源请求是目标域名是什么、所采用的目的IP地址是哪个以及所采用的目的IP地址的来源是什么的方式可以采用前述实施例中的方式,此处不再赘述。As a way, without changing the client, the component can obtain the network resource request sent by the client by capturing packets, or obtain the response data returned by the server to the client by capturing packets. As another way, the client can be adaptively changed, so that the client and the component can exchange data through inter-process communication, so that the client can not obtain a successful response result after receiving the characterization Next, the component can be notified that the network resource request for unsuccessful acquisition of network resources is the target domain name, which destination IP address is used, and the source of the used destination IP address. Wherein, in this embodiment, the client obtains the network resource request for what the target domain name is, what is the destination IP address used, and what is the source of the used destination IP address can adopt the method in the foregoing embodiment, here No longer.
步骤S520:若所述响应结果表征没有成功获取,识别所述网络资源请求是否为基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。Step S520: If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
如前述内容所述,在客户端和组件之间可以进行进程间通信的情况下,可以由客户端预先识别到所述响应结果表征没有成功获取,且识别到所述网络资源请求是基于第一IP地址后,将识别结果基于进程间通信的方式告知组件。而当在并未对客户端做出适应性的修改的情况下,组件可以参照前述实施例中介绍的客户端是如何检测若所述响应结果是否表征没有成功获取的方式来检测响应结果所表征的内容,As described in the foregoing, when inter-process communication is possible between the client and the component, the client may recognize in advance that the response result characterization has not been successfully obtained, and recognize that the network resource request is based on the first After the IP address, the identification result is notified to the component based on the method of inter-process communication. And when no adaptive modification is made to the client, the component can refer to how the client described in the foregoing embodiment detects if the response result is not successfully obtained. Content,
以及参考客户端在响应结果在表征没有成功获取的情况下是如何检测所述网络资源请求是否为基于第一IP地址发送的方式,来检测响应结果在表征没有成功获取的情况下,所述网络资源请求是否为基于第一IP地址发送的。And refer to how the client detects whether the network resource request is sent based on the first IP address when the response result is not successfully obtained, to detect that the network resource request is not successfully obtained when the response result is not successfully obtained. Whether the resource request is sent based on the first IP address.
步骤S530:若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址。Step S530: If it is sent based on the first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP of the historical network resource request that successfully requests the network resource corresponding to the target domain name address.
作为一种方式,可以查找本地存储的与所述目标域对应的第二IP地址,所述历史网络请求由所述客户端发送。As a way, a locally stored second IP address corresponding to the target domain can be searched, and the historical network request is sent by the client.
作为另外一种方式,可以向指定的服务器发送携带所述目标域名的IP地址获取请求,所述IP地址获取请求用于所述指定的服务器爬取与所述目标域名对应的第二IP地址,并将所述爬取的第二IP地址返回给所述电子设备,其中,所述客户端所在的电子设备以外的设备基于所述爬取的第二IP地址历史成功获取到过所述目标域名对应的网络资源。As another way, an IP address acquisition request carrying the target domain name may be sent to a designated server, where the IP address acquisition request is used by the designated server to crawl the second IP address corresponding to the target domain name, And return the crawled second IP address to the electronic device, where a device other than the electronic device where the client is located has successfully obtained the target domain name based on the crawled second IP address history Corresponding network resources.
步骤S540:发送以所述第二IP地址作为目的地址的网络资源请求。Step S540: Send a network resource request with the second IP address as the destination address.
步骤S550:将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源 发送给所述客户端。Step S550: Send the network resource requested by the network resource request with the second IP address as the destination address to the client.
作为一种方式,在客户端有适应性的修改后可以与组件进行进程间通信的情况下,组件可以基于进程间通信的方式将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端。作为另外一种方式,在没有对客户端做出修改的情况下,组件可以通过模拟服务端的方式将以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端。例如,组件可以在本地实现一个模拟服务端数据接口的MockApi模块。可以理解的是,在模拟服务端的过程中所模拟的服务端的参数需要与目标域名所对应的实际服务端的参数一致,以便客户端可以正常的进行数据接收。As a way, in the case that the client can communicate with the component after being adaptively modified, the component can request the network resource request with the second IP address as the destination address based on the inter-process communication. Send the network resources to the client. As another way, without modification to the client, the component can send the network resource requested by the network resource request with the second IP address as the destination address to the client by simulating the server. For example, the component can implement a MockApi module that simulates the server-side data interface locally. It is understandable that in the process of simulating the server, the parameters of the simulated server need to be consistent with the parameters of the actual server corresponding to the target domain name, so that the client can receive data normally.
本申请提供的一种网络资源请求方法,通过获取客户端向目标域名发送的网络资源请求的响应结果,若所述响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送,那么就再获取成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,发送以所述第二IP地址作为目的地址的网络资源请求,然后将所请求的网络资源再发送给客户端的情况下,可以在基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。并且,本实施例中的再次请求动作是由组件来执行的,而组件可以在客户端不进行适应性修改的情况下依然可以与客户端进行数据交互,以及获取到服务端返回给客户端的响应数据,进而提升了组件的通用性以及适配性。The network resource request method provided by the present application obtains the response result of the network resource request sent by the client to the target domain name. If the response result indicates that the acquisition is not successful, and it is recognized that the network request is sent based on the first IP address, Then, obtain the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name as the second IP address, send the network resource request with the second IP address as the destination address, and then transfer the requested In the case of sending the network resource to the client, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the reliability of the requested network resource. Moreover, the re-request action in this embodiment is executed by the component, and the component can still interact with the client without adaptive modification by the client, and obtain the response returned by the server to the client. Data, thereby enhancing the versatility and adaptability of components.
请参阅图7,本申请实施例提供的一种网络资源请求装置500,所述装置500包括:Referring to FIG. 7, an apparatus 500 for requesting network resources provided by an embodiment of the present application, the apparatus 500 includes:
网络单元510,用于向目标域名发送网络资源请求,获取所述网络资源请求的响应结果。The network unit 510 is configured to send a network resource request to the target domain name, and obtain a response result of the network resource request.
响应识别单元520,用于若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。The response identification unit 520 is configured to, if the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution.
地址查找单元530,用于若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址。The address search unit 530 is configured to obtain a second IP address corresponding to the target domain name if it is sent based on the first IP address, where the second IP address is a historical network resource that successfully requests the network resource corresponding to the target domain name The destination IP address of the request.
所述网络单元540,还用于发送以所述第二IP地址作为目的地址的网络资源请求。其中,作为一种方式,对于网络单元540,具体在检测到触发请求所述目标域名对应的网络资源的触控操作,发送以所述第二IP地址作为目的地址的网络资源请求。The network unit 540 is further configured to send a network resource request using the second IP address as a destination address. Wherein, as a way, the network unit 540 specifically detects that a touch operation requesting the network resource corresponding to the target domain name is triggered, and sends a network resource request with the second IP address as the destination address.
作为一种方式,地址查找单元530,具体用于查找本地存储的与所述目标域对应的第二IP地址,所述历史网络请求由所述客户端发送。在这种方式下,如图8所示,装置500还可以包括数据上报单元531,用于若在本地未查找到与所述目标域对应的第二IP地址,将所述目标域名上报给预先设定的服务器。As a way, the address search unit 530 is specifically configured to search for a locally stored second IP address corresponding to the target domain, and the historical network request is sent by the client. In this manner, as shown in FIG. 8, the apparatus 500 may further include a data reporting unit 531, which is configured to report the target domain name to the advance if the second IP address corresponding to the target domain is not found locally. The set server.
此外,地址查找单元530,还可以具体用于向指定的服务器发送携带所述目标域名的IP地址获取请求,所述IP地址获取请求用于所述指定的服务器爬取与所述目标域名对应的第二IP地址,并将所述爬取的第二IP地址返回给所述电子设备,其中,所述客户端所在的电子设备以外的设备基于所述爬取的第二IP地址历史成功获取到过所述目标域名对应的网络资源。In addition, the address lookup unit 530 may also be specifically configured to send an IP address acquisition request carrying the target domain name to a designated server, and the IP address acquisition request is used by the designated server to crawl information corresponding to the target domain name. The second IP address and return the crawled second IP address to the electronic device, wherein a device other than the electronic device where the client is located successfully obtains the second IP address based on the crawled second IP address history Through the network resource corresponding to the target domain name.
作为一种方式,网络单元540,具体用于发送以所述第二IP地址作为目的地址,且携带有第一标识的网络资源请求,所述第一标识为用于表征网络资源请求中的目的IP地址为从所述客户端本地查找。在这种方式下,地址查找单元530,具体用于响应识别单元520识别表征未成功获取的网络资源请求若不是基于第一IP地址发送的情况下,识别所述响应结果中是否携带有所述第一标识;若所述响应结果中携带有所述第一标识,采用网络爬虫的方式爬取与所述目标域名对应的第二IP地址,其中,所述历史网络请求由所述客户端所在的电子设备以外的设备发送。对应的,在这种方式下,网络单元540,具体用于发送将所述爬取的第二IP地址作为目的地址,且携带有第二标识的网络资源请求,所述第二标识用于表征网络资源请求中的目的IP地址为从网络获取。As a way, the network unit 540 is specifically configured to send a network resource request using the second IP address as a destination address and carrying a first identifier, where the first identifier is used to characterize the purpose of the network resource request The IP address is found locally from the client. In this manner, the address lookup unit 530 is specifically configured to respond to the identification unit 520 to identify the network resource request that is not successfully obtained. If the request is not sent based on the first IP address, identify whether the response result carries the The first identifier; if the response result carries the first identifier, use a web crawler to crawl the second IP address corresponding to the target domain name, where the historical network request is from the client Sending to devices other than electronic devices. Correspondingly, in this manner, the network unit 540 is specifically configured to send a network resource request that uses the crawled second IP address as a destination address and carries a second identifier, and the second identifier is used to represent The destination IP address in the network resource request is obtained from the network.
其中,地址查找单元530,具体用于向指定的服务器发送携带所述目标域名的IP地址获取请求,所述IP地址获取请求用于所述指定的服务器爬取与所述目标域名对应的第二IP地址,并将所述爬取的第二IP地址返回给所述电子设备。Wherein, the address search unit 530 is specifically configured to send an IP address acquisition request carrying the target domain name to a designated server, and the IP address acquisition request is used by the designated server to crawl the second corresponding to the target domain name. And return the crawled second IP address to the electronic device.
再者,数据上报单元531,还用于若网络单元540识别所述响应结果中携带有所述第二标识,将所述目标域名上报给预先设定的服务器。Furthermore, the data reporting unit 531 is further configured to, if the network unit 540 recognizes that the response result carries the second identifier, report the target domain name to a preset server.
作为另外一种方式,如图9所示,所述装置500还包括页面控制单元550,用于若所述响应结果中携带有所述第二标识,显示网络资源请求错误的页面。As another way, as shown in FIG. 9, the device 500 further includes a page control unit 550, configured to display a page with a network resource request error if the response result carries the second identifier.
所述页面控制单元550,还用于在所述响应结果表征没有获取成功,继续显示等待所述响应结果的过程中所显示的界面。The page control unit 550 is further configured to continue to display the interface displayed in the process of waiting for the response result when the response result indicates that the acquisition is not successful.
作为一种方式,网络单元540,用于同时发送将以所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求,以及以所述第二IP地址作为目的地址的网络资源请求,在这种方式下响应识别单元520,还用于若检测到所述以所述第二IP地址作为目的地址的网络资源请求的响应成果表征成功获取到所请求的网络资源,终止响应所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求;若检测到所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求的响应成果表征成功获取到所请求的网络资源,终止响应以所述第二IP地址作为目的地址的网络资源请求。As a way, the network unit 540 is configured to simultaneously send a network resource request using the IP address again obtained through domain name resolution as a destination address and a network resource request using the second IP address as the destination address, In this manner, the response identification unit 520 is further configured to: if the response result of the network resource request with the second IP address as the destination address is detected, it indicates that the requested network resource is successfully obtained, and then terminate the response to the second IP address. A network resource request with an IP address obtained by domain name resolution as a destination address; if the response result of a network resource request with an IP address obtained by domain name resolution as a destination address is detected, the requested network resource is successfully obtained, Terminate the response to the network resource request using the second IP address as the destination address.
其中,再次基于域名解析获取的IP地址,为网络单元540基于切换后的DNS服务器获取的与所述目标域名对应的IP地址。Wherein, the IP address obtained based on domain name resolution again is the IP address corresponding to the target domain name obtained by the network unit 540 based on the switched DNS server.
需要说明的是,本实施例中的装置500可以理解为前述的客户端,或者是客户端中的一个软件单元,也可以理解为用于执行前述步骤的硬件设备。It should be noted that the apparatus 500 in this embodiment can be understood as the aforementioned client, or a software unit in the client, or can be understood as a hardware device for performing the aforementioned steps.
请参阅图10,本申请实施例提供的一种网络资源请求装置600,所述装置600包括:Referring to FIG. 10, an apparatus 600 for requesting network resources according to an embodiment of the present application, the apparatus 600 includes:
数据获取单元610,用于获取所述客户端向目标域名发送的网络资源请求的响应结果。The data obtaining unit 610 is configured to obtain the response result of the network resource request sent by the client to the target domain name.
响应识别单元620,用于若所述响应结果表征没有成功获取,识别所述网络资源请求是否为基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址。The response identification unit 620 is configured to identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on a domain name resolution method, if the response result indicates that the acquisition is not successful.
地址查找单元630,用于若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址。The address search unit 630 is configured to obtain a second IP address corresponding to the target domain name if it is sent based on the first IP address, where the second IP address is a historical network resource that successfully requests the network resource corresponding to the target domain name The destination IP address of the request.
网络单元640,用于发送以所述第二IP地址作为目的地址的网络资源请求。The network unit 640 is configured to send a network resource request using the second IP address as a destination address.
数据转发单元650,用于将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端。The data forwarding unit 650 is configured to send the network resource requested by the network resource request with the second IP address as the destination address to the client.
需要说明的是,装置600中与装置500中的单元名称相同的单元可以实现的功能是相同的,例如,装置500中响应识别单元520可以实现的功能,在装置600中的响应识别单元620均可以实现,再例如,装置500中地址查找单元530可以实现的功能,在装置600中的地址查找单元630均可以实现。再者,本实施例中的装置600可以看做是前述的组件,也可以理解为用于执行前述组件所执行步骤的硬件设备。It should be noted that the functions that can be implemented by the unit with the same name in the device 600 and the unit in the device 500 are the same. For example, the functions that can be implemented by the response identification unit 520 in the device 500 are the same in the response identification unit 620 in the device 600. It can be realized. For another example, the functions that can be realized by the address searching unit 530 in the device 500 can be realized by the address searching unit 630 in the device 600. Furthermore, the apparatus 600 in this embodiment can be regarded as the aforementioned component, and can also be understood as a hardware device for executing the steps performed by the aforementioned component.
需要说明的是,本申请中装置实施例与前述方法实施例是相互对应的,装置实施例中具体的原理可以参见前述方法实施例中的内容,此处不再赘述。It should be noted that the device embodiment in this application and the foregoing method embodiment correspond to each other, and the specific principles in the device embodiment can be referred to the content in the foregoing method embodiment, which is not repeated here.
下面将结合图11对本申请提供的一种电子设备进行说明。Hereinafter, an electronic device provided by the present application will be described with reference to FIG. 11.
请参阅图11,基于上述的网络资源请求方法、装置,本申请实施例还提供的另一种可以执行前述网络资源请求方法的电子设备100。电子设备100包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104以及无线模块106。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理器102可以执行该存储器104中存储的程序。Referring to FIG. 11, based on the foregoing network resource request method and apparatus, an embodiment of the present application also provides another electronic device 100 that can execute the foregoing network resource request method. The electronic device 100 includes one or more (only one is shown in the figure) a processor 102, a memory 104, and a wireless module 106 coupled to each other. Wherein, the memory 104 stores a program that can execute the content in the foregoing embodiment, and the processor 102 can execute the program stored in the memory 104.
其中,处理器102可以包括一个或者多个处理核。处理器102利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备100的各种功能和处理数 据。可选地,处理器102可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通过一块通信芯片进行实现。The processor 102 may include one or more processing cores. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and calling data stored in the memory 104. Various functions and processing data of the electronic device 100. Optionally, the processor 102 may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). A kind of hardware form to realize. The processor 102 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented by a communication chip alone.
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器104可用于存储指令、程序、代码、代码集或指令集。存储器104可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 104 may include random access memory (RAM) or read-only memory (Read-Only Memory). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions for implementing the following method embodiments, etc. The data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
所述无线模块106用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯,例如和音频播放设备进行通讯。所述无线模块106可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。所述无线模块106可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。例如,无线模块106可以与基站进行信息交互。The wireless module 106 is used to receive and send electromagnetic waves, and realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other equipment, such as communicating with an audio playback device. The wireless module 106 may include various existing circuit elements for performing these functions, for example, an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a subscriber identity module (SIM) card, a memory, etc. . The wireless module 106 can communicate with various networks such as the Internet, an intranet, and a wireless network, or communicate with other devices through a wireless network. The aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network. For example, the wireless module 106 can exchange information with the base station.
请参考图12,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质800中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 12, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
计算机可读存储介质800可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质800包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质800具有执行上述方法中的任何方法步骤的程序代码810的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码810可以例如以适当形式进行压缩。The computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 800 has a storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read out from or written into one or more computer program products. The program code 810 may be compressed in a suitable form, for example.
综上所述,本申请提供的一种网络资源请求方法、装置、电子设备以及存储介质,通过获取向目标域名发送的网络资源请求的响应结果,若所述响应结果表征没有获取成功,且识别该网络请求是基于第一IP地址发送,那么就再获取成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址作为第二IP地址,发送以所述第二IP地址作为目的地址的网络资源请求。从而通过上述方式实现在基于正常的域名解析方式下无法请求到网络资源时,可以在基于历史成功请求到网络资源的IP地址,再次进行请求,进而提升网络资源请求的成功率,也提升请求网络资源的可靠性。In summary, the network resource request method, device, electronic device, and storage medium provided by the present application obtain the response result of the network resource request sent to the target domain name. If the response result indicates that the acquisition is not successful, the recognition The network request is sent based on the first IP address, then the destination IP address of the historical network resource request successfully requested to the network resource corresponding to the target domain name is obtained as the second IP address, and the second IP address is sent as the The network resource request of the destination address. In this way, when network resources cannot be requested under normal domain name resolution, the IP address of the network resource can be successfully requested based on the history, and the request can be made again, thereby increasing the success rate of the network resource request and the requesting network Reliability of resources.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种网络资源请求方法,其特征在于,应用于客户端,所述方法包括:A method for requesting network resources, characterized in that it is applied to a client, and the method includes:
    向目标域名发送网络资源请求,获取所述网络资源请求的响应结果;Sending a network resource request to the target domain name, and obtaining a response result of the network resource request;
    若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址;If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on a domain name resolution method;
    若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址;If it is sent based on a first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP address of a historical network resource request that successfully requests the network resource corresponding to the target domain name;
    发送以所述第二IP地址作为目的地址的网络资源请求。Send a network resource request with the second IP address as the destination address.
  2. 根据权利要求1所述的方法,其特征在于,所述获取与所述目标域名对应的第二IP地址的步骤包括:The method according to claim 1, wherein the step of obtaining a second IP address corresponding to the target domain name comprises:
    查找本地存储的与所述目标域对应的第二IP地址,所述历史网络请求由所述客户端发送。Search for a locally stored second IP address corresponding to the target domain, and the historical network request is sent by the client.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method of claim 2, wherein the method further comprises:
    若在本地未查找到与所述目标域对应的第二IP地址,将所述目标域名上报给预先设定的服务器。If the second IP address corresponding to the target domain is not found locally, report the target domain name to a preset server.
  4. 根据权利要求2或3所述的方法,其特征在于,所述发送以所述第二IP地址作为目的地址的网络资源请求的步骤包括:The method according to claim 2 or 3, wherein the step of sending a network resource request using the second IP address as a destination address comprises:
    发送以所述第二IP地址作为目的地址,且携带有第一标识的网络资源请求,所述第一标识为用于表征网络资源请求中的目的IP地址为从所述客户端本地查找。Sending a network resource request that uses the second IP address as a destination address and carries a first identifier, where the first identifier is used to characterize that the destination IP address in the network resource request is locally searched from the client.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, wherein the method further comprises:
    若不是基于第一IP地址发送,识别所述响应结果中是否携带有所述第一标识;If it is not sent based on the first IP address, identify whether the response result carries the first identifier;
    若所述响应结果中携带有所述第一标识,采用网络爬虫的方式爬取与所述目标域名对应的第二IP地址,其中,所述历史网络请求由所述客户端所在的电子设备以外的设备发送;If the response result carries the first identifier, the second IP address corresponding to the target domain name is crawled by means of a web crawler, wherein the historical network request is from an electronic device other than the electronic device where the client is located. Device sent;
    发送将所述爬取的第二IP地址作为目的地址,且携带有第二标识的网络资源请求,所述第二标识用于表征网络资源请求中的目的IP地址为从网络获取。Sending a network resource request using the crawled second IP address as a destination address and carrying a second identifier, where the second identifier is used to characterize that the destination IP address in the network resource request is obtained from the network.
  6. 根据权利要求5所述的方法,其特征在于,所述采用网络爬虫的方式爬取与所述目标域名对应的IP地址的步骤包括:The method according to claim 5, wherein the step of crawling the IP address corresponding to the target domain name by means of a web crawler comprises:
    向指定的服务器发送携带所述目标域名的IP地址获取请求,所述IP地址获取请求用于所述指定的服务器爬取与所述目标域名对应的第二IP地址,并将所述爬取的第二IP地址返回给所述电子设备。Send an IP address acquisition request carrying the target domain name to a designated server, where the IP address acquisition request is used by the designated server to crawl the second IP address corresponding to the target domain name, and the crawled The second IP address is returned to the electronic device.
  7. 根据权利要求5或6所述的方法,其特征在于,所述方法还包括:The method according to claim 5 or 6, wherein the method further comprises:
    若所述响应结果中携带有所述第二标识,将所述目标域名上报给预先设定的服务器。If the response result carries the second identifier, report the target domain name to a preset server.
  8. 根据权利要求5-7任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 5-7, wherein the method further comprises:
    若所述响应结果中携带有所述第二标识,显示网络资源请求错误的页面。If the response result carries the second identifier, a web resource request error page is displayed.
  9. 根据权利要求1所述的方法,其特征在于,所述获取与所述目标域名对应的第二IP地址的步骤包括:The method according to claim 1, wherein the step of obtaining a second IP address corresponding to the target domain name comprises:
    向指定的服务器发送携带所述目标域名的IP地址获取请求,所述IP地址获取请求用于所述指定的服务器爬取与所述目标域名对应的第二IP地址,并将所述爬取的第二IP地址返回给所述电子设备,其中,所述客户端所在的电子设备以外的设备基于所述爬取的第二IP地址历史成功获取到过所述目标域名对应的网络资源。Send an IP address acquisition request carrying the target domain name to a designated server, where the IP address acquisition request is used by the designated server to crawl the second IP address corresponding to the target domain name, and the crawled The second IP address is returned to the electronic device, where a device other than the electronic device where the client is located has successfully obtained the network resource corresponding to the target domain name based on the crawled second IP address history.
  10. 根据权利要求1-9任一所述的方法,其特征在于,所述发送将以所述第二方式获取的IP地址作为目的地址的网络资源请求的步骤包括:The method according to any one of claims 1-9, wherein the step of sending a network resource request using the IP address obtained in the second manner as a destination address comprises:
    检测到触发请求所述目标域名对应的网络资源的触控操作,发送以所述第二IP地址作为目的地址的网络资源请求。It is detected that a touch operation requesting the network resource corresponding to the target domain name is triggered, and a network resource request with the second IP address as the destination address is sent.
  11. 根据权利要求1-10任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-10, wherein the method further comprises:
    所述响应结果表征没有获取成功,继续显示等待所述响应结果的过程中所显示的界面。The response result indicates that the acquisition is not successful, and the interface displayed while waiting for the response result is continued to be displayed.
  12. 根据权利要求1-11任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-11, wherein the method further comprises:
    若是基于第一IP地址发送,再次基于所述域名解析方式获取的与所述目标域名对应的IP地址;If it is sent based on the first IP address, the IP address corresponding to the target domain name obtained based on the domain name resolution method is again obtained;
    发送将以所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求;Sending a network resource request using the IP address again obtained by domain name resolution as the destination address;
    若检测到所述以所述第二IP地址作为目的地址的网络资源请求的响应成果表征成功获取到所请求的网络资源,终止响应所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求;If it is detected that the response result of the network resource request using the second IP address as the destination address indicates that the requested network resource is successfully obtained, terminate the response to the network that uses the IP address again obtained by domain name resolution as the destination address Resource request
    若检测到所述再次以域名解析方式获取的IP地址作为目的地址的网络资源请求的响应成果表征成功获取到所请求的网络资源,终止响应以所述第二IP地址作为目的地址的网络资源请求。If it is detected that the response result of the network resource request using the IP address again obtained by means of domain name resolution as the destination address indicates that the requested network resource is successfully obtained, terminate the response to the network resource request using the second IP address as the destination address .
  13. 根据权利要求12所述的方法,其特征在于,所述再次基于所述域名解析方式获取的与所述目标域名对应的IP地址的步骤包括:The method according to claim 12, wherein the step of obtaining the IP address corresponding to the target domain name based on the domain name resolution method again comprises:
    基于切换后的DNS服务器,再次基于所述域名解析方式获取与所述目标域名对应的IP地址。Based on the switched DNS server, the IP address corresponding to the target domain name is acquired again based on the domain name resolution method.
  14. 一种网络资源请求方法,其特征在于,应用于具备与客户端通信功能的组件,所述方法包括:A method for requesting network resources, characterized in that it is applied to a component capable of communicating with a client, and the method includes:
    获取所述客户端向目标域名发送的网络资源请求的响应结果;Obtaining a response result of the network resource request sent by the client to the target domain name;
    若所述响应结果表征没有成功获取,识别所述网络资源请求是否为基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址;If the response result indicates that the acquisition is not successful, identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on a domain name resolution method;
    若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址;If it is sent based on a first IP address, obtain a second IP address corresponding to the target domain name, where the second IP address is the destination IP address of a historical network resource request that successfully requests the network resource corresponding to the target domain name;
    发送以所述第二IP地址作为目的地址的网络资源请求;Sending a network resource request with the second IP address as the destination address;
    将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端。The network resource requested by the network resource request using the second IP address as the destination address is sent to the client.
  15. 根据权利要求14所述的方法,其特征在于,所述获取与所述目标域名对应的第二IP地址的步骤包括:The method according to claim 14, wherein the step of obtaining a second IP address corresponding to the target domain name comprises:
    查找本地存储的与所述目标域对应的第二IP地址,所述历史网络请求由所述客户端发送。Search for a locally stored second IP address corresponding to the target domain, and the historical network request is sent by the client.
  16. 根据权利要求14或者15所述的方法,其特征在于,所述获取所述客户端向目标域名发送的网络资源请求的响应结果的步骤包括:The method according to claim 14 or 15, wherein the step of obtaining the response result of the network resource request sent by the client to the target domain name comprises:
    基于抓包的方式获取所述客户端向目标域名发送的网络资源请求的响应结果;Acquiring the response result of the network resource request sent by the client to the target domain name based on packet capture;
    所述将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端的步骤包括:The step of sending the network resource requested by the network resource request with the second IP address as the destination address to the client includes:
    模拟所述第二IP地址对应的服务端,基于所述客户端所使用的通信端口将所述所请求的网络资源发送给所述客户端。Simulate the server corresponding to the second IP address, and send the requested network resource to the client based on the communication port used by the client.
  17. 一种网络资源请求装置,其特征在于,所述装置包括:A network resource request device, characterized in that the device includes:
    网络单元,用于向目标域名发送网络资源请求,获取所述网络资源请求的响应结果;The network unit is configured to send a network resource request to the target domain name, and obtain a response result of the network resource request;
    响应识别单元,用于若所述响应结果表征没有获取成功,识别所述网络资源请求是否由基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址;A response identification unit, configured to identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address acquired based on domain name resolution;
    地址查找单元,用于若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址;An address search unit, configured to obtain a second IP address corresponding to the target domain name if it is sent based on a first IP address, where the second IP address is a historical network resource request that successfully requests a network resource corresponding to the target domain name The destination IP address;
    所述网络单元,还用于发送以所述第二IP地址作为目的地址的网络资源请求。The network unit is further configured to send a network resource request using the second IP address as a destination address.
  18. 一种网络资源请求装置,其特征在于,所述装置包括:A network resource request device, characterized in that the device includes:
    数据获取单元,用于获取所述客户端向目标域名发送的网络资源请求的响应结果;A data obtaining unit, configured to obtain a response result of a network resource request sent by the client to the target domain name;
    响应识别单元,用于若所述响应结果表征没有成功获取,识别所述网络资源请求是否为基于第一IP地址发送,所述第一IP地址为基于域名解析方式获取的IP地址;A response identification unit, configured to identify whether the network resource request is sent based on a first IP address, and the first IP address is an IP address obtained based on domain name resolution;
    地址查找单元,用于若是基于第一IP地址发送,获取与所述目标域名对应的第二IP地址,所述第二IP地址为成功请求到所述目标域名对应的网络资源的历史网络资源请求的目的IP地址;An address search unit, configured to obtain a second IP address corresponding to the target domain name if it is sent based on a first IP address, where the second IP address is a historical network resource request that successfully requests a network resource corresponding to the target domain name The destination IP address;
    网络单元,用于发送以所述第二IP地址作为目的地址的网络资源请求;A network unit, configured to send a network resource request using the second IP address as a destination address;
    数据转发单元,用于将所述以第二IP地址作为目的地址的网络资源请求所请求的网络资源发送给所述客户端。The data forwarding unit is configured to send the network resource requested by the network resource request with the second IP address as the destination address to the client.
  19. 一种电子设备,其特征在于,包括一个或多个处理器以及存储器;An electronic device, characterized in that it includes one or more processors and a memory;
    一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行以实现权利要求1-13任一所述的方法或者执行以实现权利要求14-15任一所述的方法。One or more programs are stored in the memory and configured to be executed by the one or more processors to implement the method according to any one of claims 1-13 or to implement any one of claims 14-15 The method described.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行权利要求1-13任一所述的方法或者 执行以实现权利要求14-15任一所述的方法。A computer-readable storage medium, wherein a program code is stored in the computer-readable storage medium, wherein the method or any one of claims 1-13 is executed when the program code is run by a processor Execute to realize the method of any one of claims 14-15.
PCT/CN2019/082329 2019-04-11 2019-04-11 Network resource request method and apparatus, electronic device and storage medium WO2020206660A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980090803.1A CN113366815B (en) 2019-04-11 2019-04-11 Network resource request method, device, electronic equipment and storage medium
PCT/CN2019/082329 WO2020206660A1 (en) 2019-04-11 2019-04-11 Network resource request method and apparatus, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/082329 WO2020206660A1 (en) 2019-04-11 2019-04-11 Network resource request method and apparatus, electronic device and storage medium

Publications (1)

Publication Number Publication Date
WO2020206660A1 true WO2020206660A1 (en) 2020-10-15

Family

ID=72751839

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/082329 WO2020206660A1 (en) 2019-04-11 2019-04-11 Network resource request method and apparatus, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN113366815B (en)
WO (1) WO2020206660A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468611A (en) * 2020-11-27 2021-03-09 深圳市欢太科技有限公司 Application program starting method, terminal device and computer storage medium
CN113239301A (en) * 2021-04-22 2021-08-10 维沃移动通信(杭州)有限公司 Page loading request method and device and electronic equipment
CN114827674A (en) * 2022-03-30 2022-07-29 北京奇艺世纪科技有限公司 Network resource display method, device and system
CN114979069A (en) * 2021-02-22 2022-08-30 腾讯科技(深圳)有限公司 Domain name resolution request processing method, storage medium and electronic device
CN114915610B (en) * 2022-04-29 2024-04-19 北京字跳网络技术有限公司 Method, device, electronic equipment and storage medium for sending network request

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113992578B (en) * 2021-09-09 2023-11-03 新华三大数据技术有限公司 Method, device, equipment and storage medium for switching servers of cloud desktop terminal
CN114844866A (en) * 2022-03-29 2022-08-02 武汉斗鱼鱼乐网络科技有限公司 Network request connection method and related equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060039352A1 (en) * 2004-08-19 2006-02-23 International Business Machines Corporation System and method for designating a priority access order of domain name service servers
US20070061374A1 (en) * 2005-09-14 2007-03-15 Fuji Xerox Co., Ltd. Device and method for restricting display of history
CN104065762A (en) * 2014-05-30 2014-09-24 小米科技有限责任公司 Method and device for detecting hijacking of DNS (Domain Name Server)
CN104468244A (en) * 2014-12-31 2015-03-25 北京奇虎科技有限公司 Domain name resolution system disaster recovery construction method and device
CN107295116A (en) * 2017-05-11 2017-10-24 上海红阵信息科技有限公司 A kind of domain name analytic method, apparatus and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CH696258A5 (en) * 2002-08-15 2007-02-28 Barix Ag A method for automatic network integration.
US7516150B1 (en) * 2004-10-29 2009-04-07 Symantec Corporation Update protection system and method
US10536425B2 (en) * 2015-08-26 2020-01-14 Pulsepoint, Inc. Cross-domain HTTP requests using DNS rebinding
CN106998359A (en) * 2017-03-24 2017-08-01 百度在线网络技术(北京)有限公司 The method for network access and device of speech-recognition services based on artificial intelligence

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060039352A1 (en) * 2004-08-19 2006-02-23 International Business Machines Corporation System and method for designating a priority access order of domain name service servers
US20070061374A1 (en) * 2005-09-14 2007-03-15 Fuji Xerox Co., Ltd. Device and method for restricting display of history
CN104065762A (en) * 2014-05-30 2014-09-24 小米科技有限责任公司 Method and device for detecting hijacking of DNS (Domain Name Server)
CN104468244A (en) * 2014-12-31 2015-03-25 北京奇虎科技有限公司 Domain name resolution system disaster recovery construction method and device
CN107295116A (en) * 2017-05-11 2017-10-24 上海红阵信息科技有限公司 A kind of domain name analytic method, apparatus and system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468611A (en) * 2020-11-27 2021-03-09 深圳市欢太科技有限公司 Application program starting method, terminal device and computer storage medium
CN112468611B (en) * 2020-11-27 2023-04-21 深圳市欢太科技有限公司 Application program starting method, terminal equipment and computer storage medium
CN114979069A (en) * 2021-02-22 2022-08-30 腾讯科技(深圳)有限公司 Domain name resolution request processing method, storage medium and electronic device
CN114979069B (en) * 2021-02-22 2024-04-09 腾讯科技(深圳)有限公司 Domain name resolution request processing method, storage medium and electronic equipment
CN113239301A (en) * 2021-04-22 2021-08-10 维沃移动通信(杭州)有限公司 Page loading request method and device and electronic equipment
CN114827674A (en) * 2022-03-30 2022-07-29 北京奇艺世纪科技有限公司 Network resource display method, device and system
CN114827674B (en) * 2022-03-30 2023-09-05 北京奇艺世纪科技有限公司 Network resource display method, device and system
CN114915610B (en) * 2022-04-29 2024-04-19 北京字跳网络技术有限公司 Method, device, electronic equipment and storage medium for sending network request

Also Published As

Publication number Publication date
CN113366815B (en) 2022-07-12
CN113366815A (en) 2021-09-07

Similar Documents

Publication Publication Date Title
WO2020206660A1 (en) Network resource request method and apparatus, electronic device and storage medium
CN103281409B (en) Based on mobile Internet domain name analytic method and the dns server of Transmission Control Protocol
WO2013131472A1 (en) Message processing method, device and system
CN113316926B (en) Domain name processing method, device, electronic equipment and storage medium
CN107154963B (en) Request processing method and device and electronic equipment
US20160359927A1 (en) Method and device for establishing channel
CN103327135A (en) Domain name resolution method, device and client
CN102098234A (en) Method and device for providing target content based on hyperlink in instant communication message
CN105430711B (en) Transmission method, device and the equipment of information
CN103581351B (en) The method and apparatus of network access
US20170289243A1 (en) Domain name resolution method and electronic device
CN105704246A (en) Network distribution device and method based on SDN architecture
WO2023020187A1 (en) Data obtaining methods and apparatuses, electronic device and storage medium
CN110933193B (en) Domain name resolution method and device, electronic equipment and computer readable storage medium
WO2023020253A1 (en) Data acquisition method and apparatus, electronic device, and storage medium
CN104618388A (en) Quick registration and login method and corresponding reset server and information server
WO2017166524A1 (en) Domain name parsing method and apparatus
CN111615694B (en) Method for selecting server node and terminal equipment
CN102098328B (en) Method and equipment for correlating hypertext transport protocol (HTTP) streams
CN107534859B (en) Network authentication method, client, terminal equipment and platform
CN104639666A (en) Domain name access method and device
CN113285920B (en) Service access method, device, equipment and storage medium
CN113285994A (en) Message sending method, device, server and storage medium
CN113472909A (en) DNS query processing method and device
CN113301556B (en) User internet access record storage method, system and server

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19924605

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 07.03.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19924605

Country of ref document: EP

Kind code of ref document: A1