WO2020177511A1 - 一种资源获取方法、资源返回方法及服务器、存储介质 - Google Patents

一种资源获取方法、资源返回方法及服务器、存储介质 Download PDF

Info

Publication number
WO2020177511A1
WO2020177511A1 PCT/CN2020/074947 CN2020074947W WO2020177511A1 WO 2020177511 A1 WO2020177511 A1 WO 2020177511A1 CN 2020074947 W CN2020074947 W CN 2020074947W WO 2020177511 A1 WO2020177511 A1 WO 2020177511A1
Authority
WO
WIPO (PCT)
Prior art keywords
domain name
resource
name address
server
address
Prior art date
Application number
PCT/CN2020/074947
Other languages
English (en)
French (fr)
Inventor
陈龙
Original Assignee
网宿科技股份有限公司
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 网宿科技股份有限公司 filed Critical 网宿科技股份有限公司
Priority to EP20726272.6A priority Critical patent/EP3734933B1/en
Priority to US16/885,175 priority patent/US20200287865A1/en
Publication of WO2020177511A1 publication Critical patent/WO2020177511A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/301Name conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5053Lease time; Renewal aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/30Types of network names
    • H04L2101/35Types of network names containing special prefixes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/659Internet protocol version 6 [IPv6] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/686Types of network addresses using dual-stack hosts, e.g. in Internet protocol version 4 [IPv4]/Internet protocol version 6 [IPv6] networks

Definitions

  • the embodiments of the present application relate to the field of Internet technology, and in particular, to a resource acquisition method, a resource return method, a server, and a storage medium.
  • the link address represented by the relative path belongs to the local domain address and is called the local domain link address;
  • the link address represented by the absolute path is divided according to the domain name to which the link address belongs, and divided into local domain link addresses and non-local domain links Address, where the non-local domain link address represents the link address that does not belong to this domain expressed using an absolute path, for example: the domain name address corresponding to website A is "www.abc.com”, and the domain name address corresponding to website B is " "www.dfg.net”, the domain corresponding to website A and the domain corresponding to website B are not the same, and the domain name address corresponding to website A relative to the domain name address corresponding to website B is the link address of the non-local domain.
  • IPv4/IPv6 dual protocol stack is already supported. If the customer needs to realize that the entire website supports the IPv6 protocol, he only needs to connect the customer's website to the CDN network, that is The network protocol can be upgraded from IPv4 protocol to IPv6 protocol.
  • the traditional CDN network only supports dual protocol stack coverage of the link address of the local domain, and cannot cover the link address of the non-local domain. If in a website, non-domain link addresses are widely used, and the website supports IPv6 protocol for communication, most resources will be inaccessible, resulting in abnormal web page display.
  • the purpose of the embodiments of this application is to provide a method for obtaining resources, a method for returning resources, a server, and a storage medium, so as to solve the problem of abnormal webpage display caused by the inability to access webpages with non-local domain link addresses in websites that support the IPv6 protocol. problem.
  • the embodiment of the present application provides a resource acquisition method, which is applied to a rewrite server, and includes the following steps: receiving a resource request message sent by a content distribution network server based on the first Internet protocol, wherein the resource request message Include the domain name address of the requested resource; determine that the domain name address belongs to the preset domain name, then decode the domain name address to obtain the original domain name address, where the original domain name address is used to access the resource server supporting the second Internet protocol; according to the original domain name address Obtain resources from the resource server.
  • the embodiment of the present application also provides a server, including: at least one processor; and a memory communicatively connected with the at least one processor; wherein the memory stores instructions that can be executed by at least one processor, and the instructions are The processor executes, so that at least one processor can execute the foregoing resource acquisition method.
  • the embodiment of the present application also provides a computer-readable storage medium that stores a computer program, and when the computer program is executed by a processor, the foregoing resource acquisition method is implemented.
  • the embodiment of this application introduces a rewrite server between the CDN server and the resource server, so that the domain name address of the resource requested by the client belonging to the preset domain name can be pointed to the corresponding resource through the rewrite server
  • the server does not need to change the function of each internal node in the CDN network, nor does it need to change the way the resource server processes the content of the page file, so that resources that are not in the same domain can be accessed by the client, which improves customer experience and reduces Cost, to achieve the upgrade of the Internet communication protocol supported by the website.
  • the version of the first internet protocol is higher than the version of the second internet protocol.
  • the first Internet protocol is Internet Protocol version 6 IPv6.
  • the domain name address of the resource belongs to a white list
  • the white list includes preset domain names that support domain name conversion.
  • the domain name address of the requested resource is converted by the rewrite server so that the rewrite server can point to the corresponding The resource server in turn obtains the requested resource.
  • the resource request message also includes the Internet Protocol address and port number of the resource server.
  • the Internet Protocol address and port number of the resource server included in the resource request message are used to enable access to the corresponding resource server and obtain the corresponding resource.
  • decoding the domain name address to obtain the original domain name address includes: replacing special characters in the domain name address with dot separators, where the special characters are among the character set allowed by international domain names except for dot separators Any one other than that; the original domain name address is determined according to the replaced domain name address and the preset domain name.
  • the special characters in the domain name address are replaced by dot separators and combined with the preset domain name to obtain the original domain name address.
  • the original domain name address what the client needs is obtained from the corresponding resource server Resources, so that the client under the IPv6 protocol environment can access resources that are not in the same domain as the client, bringing a good customer experience to the customer.
  • determining the original domain name address according to the replaced domain name address and the preset domain name includes: deleting the preset domain name included in the replaced domain name address to obtain the original domain name address.
  • the embodiment of the present application also provides a resource return method, which is applied to a rewrite server, and includes the following steps: receiving a response message returned by the resource server, wherein the response message carries the resource obtained according to the first domain name address;
  • the second domain name address is encoded to obtain the encoded domain name address, where the first domain name address and the second domain name address do not belong to the same domain, and the encoded domain name address belongs to the preset domain name; the resource is updated according to the encoded domain name address ,
  • the updated resources are returned to the client through the content distribution network server.
  • the embodiment of the present application also provides a server, including: at least one processor; and a memory communicatively connected with the at least one processor; wherein the memory stores instructions that can be executed by at least one processor, and the instructions are The processor executes, so that at least one processor can execute the foregoing resource return method.
  • the embodiment of the present application also provides a computer-readable storage medium that stores a computer program, and when the computer program is executed by a processor, the foregoing resource return method is implemented.
  • the embodiment of this application introduces a rewrite server between the CDN server and the resource server, so that the domain name address of the resource requested by the client belonging to the preset domain name can be pointed to the corresponding resource through the rewrite server
  • the server does not need to change the function of each internal node in the CDN network, nor does it need to change the way the resource server processes the content of the page file, so that resources that are not in the same domain can be accessed by the client, which improves customer experience and reduces Cost, to achieve the upgrade of the Internet communication protocol supported by the website.
  • the first domain name address is used to access a resource server supporting the first Internet protocol
  • the second domain name address is used to access a resource server supporting the second Internet protocol
  • the version of the first internet protocol is higher than the version of the second internet protocol.
  • the first Internet protocol is Internet Protocol version 6 IPv6.
  • updating the resource according to the encoded domain name address includes: replacing the second domain name address in the resource with the encoded domain name address to obtain the updated resource.
  • encoding the second domain name address in the resource after receiving the response message returned by the resource server, encoding the second domain name address in the resource, and before obtaining the encoded domain name address, further includes: determining according to the resource type identifier carried in the response message The type of the resource is a text type; scan the resource to determine that the resource includes a second domain name address.
  • scanning the resource and determining that the resource includes the second domain name address includes: scanning the resource using a regular expression, and if it is determined that the character string in the resource matches the regular expression, determining that the resource includes the second domain name address The domain name address, where the regular expression is a preset character string with the characteristics of the second domain name address.
  • encoding the second domain name address in the resource to obtain the encoded domain name address includes: replacing dot separators in the second domain name address with special characters to obtain the replaced domain name address, where , The special character is any one in the character set allowed by the international domain name except the dot separator; the encoded domain name address is determined according to the replaced domain name address and the preset domain name.
  • the replaced domain name address includes: replacement prefix and original path information; according to the replaced domain name address and the preset domain name, determining the encoded domain name address includes: combining the replaced domain name address with the preset domain name address The domain names are superimposed to obtain the encoded domain name address, where the encoded domain name addresses are: replacement prefix, preset domain name, and original path information.
  • Fig. 1 is a block diagram of the flow of a method for acquiring resources in a first embodiment of the present application
  • FIG. 2 is a block diagram of the flow of the method for obtaining resources in the second embodiment of the present application
  • Fig. 3 is a flow block diagram of a method for returning resources in a third embodiment of the present application.
  • Fig. 4 is a flow block diagram of a resource return method according to a fourth embodiment of the present application.
  • Figure 5 is a diagram of the Internet topology according to the fifth embodiment of the present application.
  • Fig. 6 is a block diagram of a flow of resource acquisition using the Internet topology according to the fifth embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of a server in a fifth embodiment according to the present application.
  • the first embodiment of the present application relates to a resource acquisition method.
  • a rewrite server between the CDN server and the resource server, the domain name address of the resource requested by the client belonging to the preset domain name can be pointed to the corresponding resource server through the rewrite server without changing the internal nodes in the CDN network.
  • Function there is no need to change the way the resource server processes the content of the page file, so that resources that are not in the same domain can be accessed by the client, which improves the customer experience, reduces the cost, and realizes the Internet communication protocol supported by the website Upgrade.
  • Figure 1 shows a flow chart of the resource acquisition method in this embodiment, which can be used to rewrite the server.
  • the method may include the following steps.
  • step 101 a resource request message sent by a content distribution network server based on the first Internet protocol is received.
  • the resource request message includes the domain name address of the requested resource, and also includes the Internet protocol address and port number of the resource server; the domain name address of the resource belongs to a white list, and the white list includes preset domain names that support domain name conversion.
  • the whitelist may be the domain name address corresponding to the website served by the CDN network, or in the CDN network, the domain name address with the rewriting function corresponding to the rewriting server enabled, for example, the website address of the network company A Is "www.asdf.com", the network company A has activated the rewrite function corresponding to the rewrite server in the CDN network, then the website address "www.asdf.com" of the network company A will be added to the white List.
  • the client accesses a webpage of a website, and sends a resource request message for obtaining corresponding resources in the website page to a content delivery network (CDN) server.
  • CDN content delivery network
  • the CDN server receives the resource request message sent by the client.
  • the resource request message is a HyperText Transport Protocol (HTTP) request message.
  • HTTP HyperText Transport Protocol
  • the CDN server determines whether the host (HOST) address carried in the HTTP request message is included in the whitelist, and if it is determined that the HOST address is in the whitelist, and the network environment where the client is located supports the first Internet protocol, for example: If the client supports IPv6, it forwards the HTTP request message to the rewrite server; the HTTP request message contains the IP address and port number of the resource server to facilitate the rewrite server to return to the source, that is, according to the Internet protocol of the resource server ( Internet Protocol (IP) address and port number, return to the resource server to obtain the corresponding resource; for example, the resource server's IP address is: 192.168.1.2, the port number is 5500, and the rewritten server will access "192.168.1.2:5500 "The resource server corresponding to this address obtains the resources needed by the client. If it is determined that the HOST is not in the whitelist, the HTTP request message is returned to the source in a normal manner.
  • IP Internet Protocol
  • the website page visited by the customer contains a variety of resources.
  • the resources can be HTML files, JS script files or CSS files, etc. There is no restriction here, and the specific content depends on the corresponding website content.
  • the Secure Sockets Layer (SSL) protocol certificate of the domain name address is configured on the CDN server, and the certificate supports HTTP protocol and Hypertext Transfer Protocol (over Secure Socket Layer, HTTPS) Format.
  • SSL Secure Sockets Layer
  • step 102 it is determined that the domain name address belongs to the preset domain name, and then the domain name address is decoded to obtain the original domain name address.
  • the rewrite server judges whether the HOST address carried in the HTTP request message belongs to the preset domain name.
  • the preset domain name is a preset generic domain name. For example, apply for an independent domain name "abc" in advance. .com”; Obtain the corresponding pan-domain name "*.abc.com", so that all domain addresses belonging to the pan-domain name point to the rewrite server, and then obtain the corresponding resources through the rewrite server; if the HOST address carried in the HTTP request message is If the preset domain name matches, the rewriting server decodes the HOST address in the HTTP request message and restores the HOST address to the original domain name address.
  • the original domain name address is used to access the resource server that supports the second internet protocol
  • the version of the first internet protocol is higher than the version of the second internet protocol
  • the first internet protocol is the sixth version of the internet protocol IPv6
  • the first Internet protocol is the fourth version of the Internet Protocol IPv4.
  • step 103 resources are obtained from the resource server according to the original domain name address.
  • the rewrite server after the rewrite server obtains the original domain name address through decoding, it accesses the corresponding resource server according to the original domain name address, and the resource server returns the resources required by the rewrite server to the rewrite server, so that the rewrite server obtains the resource .
  • the domain name address of the resource requested by the client belonging to the preset domain name can be pointed to the corresponding resource server through the rewrite server without changing the CDN network
  • the function of each internal node in the web site does not need to change the way the resource server processes the content of the page file, so that resources that are not in the same domain can be accessed by the client, which improves the customer experience, reduces the cost, and realizes the website Supported Internet communication protocol upgrade.
  • the second embodiment of the present application relates to a resource acquisition method.
  • the second embodiment is roughly the same as the first embodiment.
  • the main difference is: replacing special characters in the domain name address with dot separators, and determining the original domain name address based on the replaced domain name address and the preset domain name.
  • the resource acquisition method includes steps 201 to 204, because step 201 in this embodiment is the same as step 101 in the first embodiment, and the steps in this embodiment 204 is the same as step 103 in the first embodiment, and will not be repeated here, and steps 202 to 203 in this embodiment will be specifically described below.
  • step 202 it is determined that the domain name address belongs to a preset domain name, and special characters in the domain name address are replaced with dot separators.
  • domain name address is the encoded domain name address of the resource to be requested
  • special character is any one in the character set allowed by the international domain name except the dot separator.
  • the dot separator ".” is used to replace the special characters in the encoded domain name address, such as "---", then the encoded domain name address is "https://www---aaa- --com.abc.com/1.js", the domain name address after replacement is "https://www.aaa.com.abc.com/1.js". It should be noted that the special characters can also be any one of the character set allowed by international domain names except the dot separator ".”.
  • step 203 the original domain name address is determined according to the replaced domain name address and the preset domain name.
  • the original domain name address is obtained by deleting the preset domain name contained in the replaced domain name address. For example, if the replaced domain name address is "https://www.aaa.com.abc.com/1.js" and the default domain name is determined to be "abc.com", delete the replaced domain name address Default domain name ".abc.com", you can get the original domain name address "https://www.aaa.com1.js".
  • the special characters in the encoded domain name address are replaced by dot separators, and the preset domain name is deleted, so as to obtain the original domain name address, so that the encoded domain name address is restored and rewritten
  • the server can obtain the resources needed by the client from the corresponding resource server according to the restored original domain name address, so that the client under the IPv6 protocol environment can access resources that are not in the same domain as the client. Customers bring a good customer experience.
  • FIG. 3 shows a flowchart of the resource return method in this embodiment.
  • the method can be used to rewrite the server, and the method can include the following steps.
  • step 301 a response message returned by the resource server is received.
  • the response message carries the resource obtained according to the first domain name address.
  • the rewrite server sends a resource request message to the corresponding resource server according to the first domain name address. After receiving the resource request message sent by the rewrite server, the resource server returns a response message corresponding to the resource request message.
  • the response message carries the requested resource.
  • the resource can be an HTML file, or a JS script file or a CSS file, etc., which is not limited here, and is determined according to the content of the corresponding website.
  • step 302 the second domain name address in the resource is encoded to obtain the encoded domain name address.
  • the first domain name address and the second domain name address do not belong to the same domain, and the encoded domain name address belongs to the preset domain name.
  • the first domain name address is used to access a resource server that supports the first Internet protocol
  • the second domain name address is used to access a resource server that supports the second Internet protocol
  • the version of the first Internet protocol is higher than that of the second Internet protocol.
  • the version of the protocol is the sixth version of the internet protocol IPv6, and the first internet protocol is the fourth version of the internet protocol IPv4.
  • the following method is used to encode the second domain name address in the resource: replace the dot separator in the second domain name address with special characters to obtain the replaced domain name address, where the special characters are international domain names Any one of the allowed character set except the dot separator; according to the replaced domain name address and the preset domain name, determine the encoded domain name address.
  • the replaced domain name address includes: replacement prefix and original path information; superimpose the replaced domain name address with the preset domain name to obtain the encoded domain name address, where the encoded domain name address is: replacement prefix, Preset domain name and original path information.
  • the second domain name address in the resource is "https://www.aaa.com/1.js"
  • the special character is "---"
  • the dot separator ".” is replaced with the special character " ---
  • the second domain name address after replacement is "https://www---aaa---com/1.js"
  • "www---aaa---com” represents the replacement prefix
  • "/1.js” represents the original path information, which is superimposed with the preset domain name address "abc.com”
  • the encoded domain name address is "https://www---aaa---com.abc. com/1.js”.
  • the special character can also be any one of the character set allowed by international domain names except the dot separator ".”.
  • step 303 the resource is updated according to the encoded domain name address, and the updated resource is returned to the client through the content distribution network server.
  • the encoded domain name address is used to replace the second domain name address in the resource to obtain the updated resource.
  • the encoded domain name address is "https://www--aaa--com.abc.com/1.js”
  • the second domain name address in the resource is "https://www.aaa.com/ 1.js”
  • use the domain name address "https://www--aaa--com.abc.com/1.js” to replace the domain name address "https://www.aaa.com/1.js” thereby Get updated resources.
  • the second domain name address contained in the resource is more than one, there may be two, three, or even more, just use the corresponding code for all the second domain name addresses contained in the resource
  • the addresses can be accessed through the CDN server and the rewrite server.
  • the domain name address of the resource requested by the client belonging to the preset domain name can be pointed to the corresponding resource server through the rewrite server without changing the CDN network
  • the function of each internal node in the web site does not need to change the way the resource server processes the content of the page file, so that resources that are not in the same domain can be accessed by the client, which improves the customer experience, reduces the cost, and realizes the website Supported Internet communication protocol upgrade.
  • the fourth embodiment of the present application relates to a resource return method.
  • the fourth embodiment is roughly the same as the third embodiment.
  • the main difference is that after receiving the response message returned by the resource server, the second domain name address in the resource Before encoding and obtaining the encoded domain name address, it is also necessary to determine that the type of the resource is a text type, and scan the text type resource to determine that the resource includes a second domain name address.
  • Step 401 is the same as step 301 in the third embodiment, and steps 404 to 405 are the same as those in the third embodiment.
  • Steps 302 to 303 are the same and will not be repeated here. Steps 402 to 403 in this embodiment will be described in detail below.
  • the type of the resource is a text type according to the type identifier of the resource carried in the response message.
  • the resource carried in the response message can be multiple types of resources, for example, text files or image resources, etc.
  • the type of the resource can be determined, for example .
  • the resource type identification carried in the header of the response message is "content-type", set the text type to text/html, or, application/javascript, or, text/css, set the picture
  • the type is image/jpeg. When the content-type is equal to text/html, or, application/javascript, or, text/css, it means that the type of the resource is a text file.
  • step 403 the resource is scanned and it is determined that the resource includes a second domain name address.
  • the regular expression is used to scan the resource, and if it is determined that the character string in the resource matches the regular expression, it is determined that the resource includes the second domain name address, where ,
  • the regular expression is a pre-set character string with the characteristics of the second domain name address.
  • the text resource is scanned using regular expressions to determine that the text resource contains a second domain name address, then the second domain name address is encoded, and the encoded domain name address is used to replace the corresponding second domain name Address, return the updated resource to the client under the first Internet protocol environment, so that the client can access the resource of the resource server supporting the second Internet protocol that is not in the same domain as the client, and give it to the client Brings a good customer experience.
  • the fifth embodiment of the present application provides an Internet topology structure, as shown in Figure 5, the Internet topology structure is composed of a client 501, a CDN server 502, a rewrite server 503, and a resource server 504, using the process steps shown in Figure 6 Obtain the resource requested by the client 501.
  • step 601 the client 501 sends an HTTP request message to the CDN server 502.
  • the HTTP request message is used to request access to a website page.
  • step 602 the CDN server 502 determines whether the HOST address carried in the HTTP request message is included in the whitelist, and the client 501 is in an IPv6 network environment, if it is determined that the HOST address is in the whitelist, and the client If 501 supports the IPv6 network protocol, step 603 is executed; otherwise, step 612 is executed.
  • step 603 the CDN server 502 forwards the HTTP request message to the rewriting server 503.
  • the HTTP request message contains the IP address and port number of the resource server 504 to facilitate rewriting the server 503 to return to the source.
  • step 604 the rewrite server 503 determines whether the domain name address carried in the resource request message is an encoded pan-domain name, if it is, step 606 is executed, otherwise, step 605 is executed.
  • step 605 the rewrite server 503 decodes the domain name address carried in the resource request message to obtain the corresponding original domain name address, and access the corresponding resource server 504 according to the original domain name address.
  • step 606 the IP address and port number of the resource server 504 contained in the HTTP request message are obtained, and the resource server 504 is accessed.
  • resource server 504 is in an IPv4 network environment and is not in the same domain as the client 501.
  • step 607 the resource server 504 receives the HTTP request message and returns a response message to the rewriting server 503.
  • the response message contains the requested resource.
  • step 608 the rewrite server 503 determines whether the type of the resource contained in the response message is a text type, if so, step 610 is executed, otherwise, step 609 is executed.
  • step 609 the rewrite server 503 returns the resource to the CDN server 502.
  • step 610 the rewrite server 503 uses regular expressions to scan the full text of the resource file, determine the non-local domain link address contained in the resource file, and encode the non-local domain link address.
  • step 611 the rewrite server 503 uses the encoded domain name address to replace the non-local domain link address in the resource, obtains the updated resource, and sends the updated resource to the CDN server 502.
  • step 612 the CDN server 502 receives the resource returned by the rewrite server 503, and returns the resource to the client 501.
  • the sixth embodiment of the present application provides a server, and the specific structure of the device is shown in FIG. 7. It includes at least one processor 701; and a memory 702 communicatively connected with the at least one processor 701.
  • the memory 702 stores instructions that can be executed by at least one processor 701, and the instructions are executed by the at least one processor 701, so that the at least one processor 701 can execute the description in any one of the first to second embodiments.
  • the server can be a server that executes the resource acquisition method described in the first or second embodiment, or can be a server that executes the resource return method described in the third or fourth embodiment, or, A server that executes the resource acquisition method described in the first or second embodiment and the resource return method described in the third or fourth embodiment.
  • the processor 701 is an example of a central processing unit (CPU), and the memory 702 is an example of a readable and writable memory (Random Access Memory, RAM).
  • the processor 701 and the memory 702 may be connected through a bus or in other ways. In FIG. 7, the connection through a bus is taken as an example.
  • the memory 702 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules.
  • the program that implements the resource acquisition method in the embodiment of the present application is stored In the memory 702.
  • the processor 701 executes various functional applications and data processing of the device by running non-volatile software programs, instructions, and modules stored in the memory 702, that is, implements the foregoing resource acquisition method or the foregoing resource return method.
  • the memory 702 may include a program storage area and a data storage area.
  • the program storage area may store an operating system and an application program required by at least one function; the data storage area may store a list of options and the like.
  • the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 702 may optionally include a memory remotely provided with respect to the processor 701, and these remote memories may be connected to an external device through a network.
  • One or more program modules are stored in the memory 702, and when executed by one or more processors 701, execute the resource acquisition method in any of the foregoing method embodiments, or execute the resource return method in any of the foregoing method embodiments.
  • the seventh embodiment of the present application relates to a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, the resource acquisition method involved in any method embodiment of the present application can be implemented , Or, resource return method.
  • the program is stored in a storage medium and includes several instructions to enable a device (which can be A single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请实施例涉及互联网技术领域,公开了一种资源获取方法、资源返回方法及服务器、存储介质。本申请中,该资源获取方法包括:接收内容分发网络服务器基于第一互联网协议发送的资源请求消息(101);确定域名地址属于预设域名,则对域名地址进行解码,获得原始域名地址(102);根据原始域名地址从资源服务器获取资源(103)。

Description

一种资源获取方法、资源返回方法及服务器、存储介质
交叉引用
本申请引用于2019年03月05日递交的名称为“一种资源获取方法、资源返回方法及服务器、存储介质”的第201910164233.8号中国专利申请,其通过引用被全部并入本申请。
技术领域
本申请实施例涉及互联网技术领域,特别涉及一种资源获取方法、资源返回方法及服务器、存储介质。
背景技术
目前,互联网技术已得到普遍应用,而互联网在通信的过程中所使用的互联网协议还处于低版本阶段,即第四版本的互联网协议(Internet Protocol Version 4,IPv4),按照“循序渐进、稳步发展”的原则,将互联网协议由IPv4版本提升至较高版本,即第六版本的互联网协议(Internet Protocol Version 6,IPv6)时,需要有一段时间同时使用这两种协议,在这期间通过使用过渡技术,将互联网协议由IPv4版本逐渐演进到IPv6版本。
在一个互联网的网页界面中存在多种资源,如超文本(Hyper Text Markup Language,HTML)文件、脚本(JavaScript,JS)文件、层叠样式表(Cascading Style Sheets,CSS)文件等。在这类资源文件中存在各式各样的链接地址,该链接地址可以用相对路径,或,绝对路径表示。其中,使用相对路径表示的链接地址属于本域地址,称为本域链接地址;使用绝对路径表示的链接地址,根据该链接 地址所属的域名进行划分,分为本域链接地址和非本域链接地址,其中的非本域链接地址表示的是使用绝对路径表示的不属于本域内的链接地址,例如:网站A对应的域名地址为“www.abc.com”,网站B对应的域名地址为“www.dfg.net”,则网站A对应的域与网站B对应的域不是同一个,则网站A对应的域名地址相对于网站B对应的域名地址就是非本域链接地址。在传统的内容分发网络(Content Delivery Network,CDN)中,已经支持IPv4/IPv6双协议栈,如果客户需要实现全网站都支持IPv6协议,只需要将该客户的网站接入到CDN网络中,即可实现网络协议由IPv4协议到IPv6协议的升级。
发明人发现现有技术中至少存在如下问题:传统CDN网络只支持本域链接地址的双协议栈覆盖,无法覆盖非本域链接地址。如果在一个网站中,广泛使用非本域链接地址,并且该网站支持IPv6协议进行通信,则会出现大部分资源无法访问的情况,导致网页显示异常。
发明内容
本申请实施例的目的在于提供一种资源获取方法、资源返回方法及服务器、存储介质,用以解决在支持IPv6协议的网站中,无法访问非本域链接地址的网页而导致的网页显示异常的问题。
为解决上述技术问题,本申请的实施例提供了一种资源获取方法,应用于改写服务器,包括以下步骤:接收内容分发网络服务器基于第一互联网协议发送的资源请求消息,其中,资源请求消息中包括所请求的资源的域名地址;确定域名地址属于预设域名,则对域名地址进行解码,获得原始域名地址,其中,原始域名地址用于访问支持第二互联网协议的资源服务器;根据原始域名地址从资源服务器获取资源。
本申请的实施例还提供了一种服务器,包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上 述资源获取方法。
本申请的实施例还提供了一种计算机可读存储介质,存储有计算机程序,该计算机程序被处理器执行时实现上述资源获取方法。
本申请实施例相对于现有技术而言,通过在CDN服务器和资源服务器之间引入改写服务器,使属于预设域名的客户端所请求的资源的域名地址,能够通过该改写服务器指向对应的资源服务器,无需改动CDN网络中的各个内部节点的功能,也不用改变资源服务器对页面文件的内容的处理方式,使不在同一个域的资源能够被客户端访问到,提升了客户体验度,降低了成本,实现了对网站所支持的互联网通信协议的升级。
在一个实施例中,第一互联网协议的版本高于第二互联网协议的版本。
在一个实施例中,第一互联网协议为互联网协议第六版IPv6。
在一个实施例中,资源的域名地址属于白名单,白名单中包括预先设定的支持域名转换的域名。
该实施例中,通过预先设置白名单,若确定所请求的资源的域名地址在该白名单中,则通过改写服务器将所请求的资源的域名地址进行转换,以使该改写服务器能够指向对应的资源服务器,进而获得所请求的资源。
在一个实施例中,资源请求消息中还包括资源服务器的互联网协议地址和端口号。
该实施例中,通过资源请求消息中所包含的资源服务器的互联网协议地址和端口号,使得能够访问对应的资源服务器,获取对应的资源。
在一个实施例中,对域名地址进行解码,获得原始域名地址,包括:将域名地址中的特殊字符替换为圆点分隔符,其中,特殊字符为国际域名允许的字符集中除圆点分隔符之外的任意一个;根据替换后的域名地址和预设域名,确定原始域名地址。
该实施例中,通过使用圆点分隔符将域名地址中的特殊字符替换,并结合预设域名,获得原始域名地址,根据该原始域名地址,从对应的资源服务器 中获取到客户端所需要的资源,进而使处于IPv6协议环境下的客户端能够访问与该客户端不在同一个域中的资源,为客户带来良好的客户体验。
在一个实施例中,根据替换后的域名地址和预设域名,确定原始域名地址,包括:删除替换后的域名地址中所包含的预设域名,获得原始域名地址。
本申请的实施例还提供了一种资源返回方法,应用于改写服务器,包括以下步骤:接收资源服务器返回的响应消息,其中,响应消息中携带根据第一域名地址所获取的资源;将资源中的第二域名地址进行编码,得到编码后的域名地址,其中,第一域名地址与第二域名地址不属于同一个域,编码后的域名地址属于预设域名;根据编码后的域名地址更新资源,将更新后的资源通过内容分发网络服务器返回给客户端。
本申请的实施例还提供了一种服务器,包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述资源返回方法。
本申请的实施例还提供了一种计算机可读存储介质,存储有计算机程序,该计算机程序被处理器执行时实现上述资源返回方法。
本申请实施例相对于现有技术而言,通过在CDN服务器和资源服务器之间引入改写服务器,使属于预设域名的客户端所请求的资源的域名地址,能够通过该改写服务器指向对应的资源服务器,无需改动CDN网络中的各个内部节点的功能,也不用改变资源服务器对页面文件的内容的处理方式,使不在同一个域的资源能够被客户端访问到,提升了客户体验度,降低了成本,实现了对网站所支持的互联网通信协议的升级。
在一个实施例中,第一域名地址用于访问支持第一互联网协议的资源服务器,第二域名地址用于访问支持第二互联网协议的资源服务器。
在一个实施例中,第一互联网协议的版本高于第二互联网协议的版本。
在一个实施例中,第一互联网协议为互联网协议第六版IPv6。
在一个实施例中,根据编码后的域名地址更新资源,包括:使用编码后的域名地址替换资源中的第二域名地址,获得更新后的资源。
在一个实施例中,在接收资源服务器返回的响应消息之后,将资源中的第二域名地址进行编码,得到编码后的域名地址之前,还包括:根据响应消息中携带的资源的类型标识,确定资源的类型为文本类型;扫描资源,确定资源中包括有第二域名地址。
在一个实施例中,扫描资源,确定资源中包括有第二域名地址,包括:使用正则表达式扫描资源,若确定资源中的字符串与正则表达式相匹配,则确定资源中包括有第二域名地址,其中,正则表达式为预先设定的、具有第二域名地址的特征的字符串。
在一个实施例中,将资源中的第二域名地址进行编码,得到编码后的域名地址,包括:将第二域名地址中的圆点分隔符替换为特殊字符,获得替换后的域名地址,其中,特殊字符为国际域名允许的字符集中除圆点分隔符之外的任意一个;根据替换后的域名地址和预设域名,确定编码后的域名地址。
在一个实施例中,替换后的域名地址中包括:替换前缀和原路径信息;根据替换后的域名地址和预设域名,确定编码后的域名地址,包括:将替换后的域名地址与预设域名相叠加,获得编码后的域名地址,其中,编码后的域名地址依次为:替换前缀、预设域名和原路径信息。
附图说明
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。
图1是根据本申请第一实施例中的资源获取方法流程方框图;
图2是根据本申请第二实施例中的资源获取方法流程方框图;
图3是根据本申请第三实施例中的资源返回方法流程方框图;
图4是根据本申请第四实施例中的资源返回方法流程方框图;
图5是根据本申请第五实施例中的互联网拓扑结构图;
图6是根据本申请第五实施例中的使用互联网拓扑结构进行资源获取的流程方框图;
图7是根据本申请第五实施例中的服务器的结构示意图。
具体实施方式
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施例进行详细的阐述。然而,本领域的普通技术人员可以理解,在本申请各实施例中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施例的种种变化和修改,也可以实现本申请所要求保护的技术方案。
以下各个实施例的划分是为了描述方便,不应对本申请的具体实现方式构成任何限定,各个实施例在不矛盾的前提下可以相互结合相互引用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以使这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本申请的第一实施例涉及一种资源获取方法。通过在CDN服务器和资源服务器之间引入改写服务器,使属于预设域名的客户端所请求的资源的域名地址,能够通过该改写服务器指向对应的资源服务器,无需改动CDN网络中的各个内部节点的功能,也不用改变资源服务器对页面文件的内容的处理方式,使不在同一个域的资源能够被客户端访问到,提升了客户体验度,降低了成本, 实现了对网站所支持的互联网通信协议的升级。
下面对本实施例中的资源获取方法的实现细节进行具体的说明,以下内容仅为方便理解本方案的实现细节,并非实施本方案的必须。
图1所示为本实施例中的资源获取方法的流程图,该方法可用于改写服务器。该方法可包括如下步骤。
在步骤101中,接收内容分发网络服务器基于第一互联网协议发送的资源请求消息。
其中,资源请求消息中包括所请求的资源的域名地址,还包括资源服务器的互联网协议地址和端口号;资源的域名地址属于白名单,该白名单中包括预先设定的支持域名转换的域名。
在一个具体实现中,该白名单可以是CDN网络所服务的网站对应的域名地址,或在CDN网络中,开通了该改写服务器所对应的改写功能的域名地址,例如,网络公司A的网站地址为“www.asdf.com”,该网络公司A在CDN网络中开通了该改写服务器所对应的改写功能,则该网络公司A的网站地址“www.asdf.com”就会被加入到该白名单中。
在一个具体实现中,客户端对一个网站的网页进行访问,发送用来获得该网站页面中对应资源的资源请求消息至内容分发网络(Content Delivery Network,CDN)服务器。CDN服务器收到客户端发送的资源请求消息,例如,该资源请求消息为超文本传输协议(Hyper Text Transport Protocol,HTTP)请求消息。CDN服务器判断该HTTP请求消息的携带的主机(HOST)地址是否包含在白名单中,若确定该HOST地址在白名单中,并且该客户端所在的网络环境是支持第一互联网协议的,例如:该客户端支持IPv6,则将该HTTP请求消息转发至改写服务器;其中该HTTP请求消息中包含有资源服务器的IP地址和端口号,以方便改写服务器进行回源,即根据资源服务器的互联网协议(Internet Protocol,IP)地址和端口号,返回到该资源服务器获取对应的资源;例如该资源服务器的IP地址为:192.168.1.2,端口号为5500,则该改写服务器会访问 “192.168.1.2:5500”这个地址所对应的资源服务器,获取客户端所需要的资源。若确定该HOST不在白名单中,则该HTTP请求消息按照正常方式进行回源。
需要说明的是,客户所访问的网站页面中包含多种资源,该资源可以是HTML文件,也可以是JS脚本文件或CSS文件等,在此不做限制,具体视对应的网站内容而确定。
在一个具体实现中,在CDN服务器上配置域名地址的安全套接层(Secure Sockets Layer,SSL)协议证书,该证书支持HTTP协议和超文本传输安全协议(Hyper Text Transfer Protocol over Secure Socket Layer,HTTPS)的格式。
在步骤102中,确定域名地址属于预设域名,则对域名地址进行解码,获得原始域名地址。
在一个具体实现中,改写服务器收到HTTP请求后,判断HTTP请求消息中携带的HOST地址是否属于预设域名,预设域名为预先设定的泛域名,例如:预先申请一个独立的域名“abc.com”;获得对应的泛域名“*.abc.com”,使属于该泛域名的域名地址都指向改写服务器,进而通过该改写服务器获得对应的资源;若HTTP请求消息中携带的HOST地址与预设域名相匹配,则改写服务器对HTTP请求消息中的HOST地址进行解码,将HOST地址还原成原始域名地址。
需要说明的是,原始域名地址用于访问支持第二互联网协议的资源服务器,并且第一互联网协议的版本高于第二互联网协议的版本,例如,第一互联网协议为互联网协议第六版IPv6,第一互联网协议为互联网协议第四版IPv4。
在步骤103中,根据原始域名地址从资源服务器获取资源。
在一个具体实现中,改写服务器通过解码获得原始域名地址后,根据该原始域名地址,访问对应的资源服务器,该资源服务器将改写服务器需要的资源返回给改写服务器,从而使改写服务器获取到该资源。
在本实施例中,通过在CDN服务器和资源服务器之间引入改写服务器,使属于预设域名的客户端所请求的资源的域名地址,能够通过该改写服务器指 向对应的资源服务器,无需改动CDN网络中的各个内部节点的功能,也不用改变资源服务器对页面文件的内容的处理方式,使不在同一个域的资源能够被客户端访问到,提升了客户体验度,降低了成本,实现了对网站所支持的互联网通信协议的升级。
本申请的第二实施例涉及一种资源获取方法。第二实施例与第一实施例大致相同,主要区别之处在于:将域名地址中的特殊字符替换为圆点分隔符,根据替换后的域名地址和预设域名,确定原始域名地址。
具体处理流程如图2所示,在本实施例中,该资源获取方法包括步骤201~204,因该实施例中步骤201与第一实施例中的步骤101相同,并且,该实施例中步骤204与第一实施例中的步骤103相同,在此不再赘述,下面具体介绍本实施例中的步骤202~203。
在步骤202中,确定域名地址属于预设域名,将域名地址中的特殊字符替换为圆点分隔符。
需要说明的是,其中的域名地址是经过编码后的所要请求的资源的域名地址,特殊字符为国际域名允许的字符集中除圆点分隔符之外的任意一个。
在一个具体实现中,使用圆点分隔符“.”替换已编码的域名地址中的特殊字符,例如“---”,则已编码的域名地址为“https://www---aaa---com.abc.com/1.js”,替换后的该域名地址为“https://www.aaa.com.abc.com/1.js”。需要说明的是,其中的特殊字符也可以是除圆点分隔符“.”之外的其他属于国际域名允许的字符集中的任意一个。
在步骤203中,根据替换后的域名地址和预设域名,确定原始域名地址。
在一个具体实现中,通过删除替换后的域名地址中所包含的预设域名,获得原始域名地址。例如,若替换后的域名地址为“https://www.aaa.com.abc.com/1.js”,并且确定预设域名为“abc.com”,则删除该替换后的域名地址中的预设域名“.abc.com”,即可获得原始域名地址为“https://www.aaa.com1.js”。
在该实施例中,通过使用圆点分隔符将编码后的域名地址中的特殊字符替换后,并删除其中的预设域名,从而获得原始域名地址,使编码后的域名地址得到还原,使改写服务器能够根据还原后的原始域名地址,到对应的资源服务器中获取到客户端所需要的资源,进而使处于IPv6协议环境下的客户端能够访问与该客户端不在同一个域中的资源,为客户带来良好的客户体验。
本申请的第三实施例涉及一种资源返回方法,图3所示为本实施例中的资源返回方法的流程图,该方法可用于改写服务器,该方法可包括如下步骤。
在步骤301中,接收资源服务器返回的响应消息。
其中,响应消息中携带根据第一域名地址所获取的资源。
在一个具体实现中,改写服务器根据第一域名地址,发送资源请求消息给对应的资源服务器,该资源服务器接收到改写服务器发送的资源请求消息后,返回该资源请求消息所对应的响应消息,在该响应消息中携带有所请求的资源,该资源可以是HTML文件,也可以是JS脚本文件或CSS文件等,在此不做限制,具体视对应的网站内容而确定。
在步骤302中,将资源中的第二域名地址进行编码,得到编码后的域名地址。
其中,第一域名地址与第二域名地址不属于同一个域,编码后的域名地址属于预设域名。
需要说明的是,第一域名地址用于访问支持第一互联网协议的资源服务器,第二域名地址用于访问支持第二互联网协议的资源服务器,并且,第一互联网协议的版本高于第二互联网协议的版本。例如,第一互联网协议为互联网协议第六版IPv6,第一互联网协议为互联网协议第四版IPv4。
在一个具体实现中,使用如下方法对资源中的第二域名地址进行编码:将第二域名地址中的圆点分隔符替换为特殊字符,获得替换后的域名地址,其中,特殊字符为国际域名允许的字符集中除圆点分隔符之外的任意一个;根据替换后的域名地址和预设域名,确定编码后的域名地址。
其中,替换后的域名地址中包括:替换前缀和原路径信息;将替换后的域名地址与预设域名相叠加,获得编码后的域名地址,其中,编码后的域名地址依次为:替换前缀、预设域名和原路径信息。
例如,资源中的第二域名地址为“https://www.aaa.com/1.js”,特殊字符为“---”,将其中的圆点分隔符“.”替换为特殊字符“---”,替换后的第二域名地址为“https://www---aaa---com/1.js”,其中,“www---aaa---com”表示替换前缀,“/1.js”表示原路径信息,再与预设域名地址“abc.com”相叠加,则获得编码后的域名地址为“https://www---aaa---com.abc.com/1.js”。其中的特殊字符也可以是除圆点分隔符“.”之外的其他属于国际域名允许的字符集中的任意一个。
在步骤303中,根据编码后的域名地址更新资源,将更新后的资源通过内容分发网络服务器返回给客户端。
在一个具体实现中,使用编码后的域名地址替换资源中的第二域名地址,获得更新后的资源。例如,编码后的域名地址为“https://www--aaa--com.abc.com/1.js”,而资源中的第二域名地址为“https://www.aaa.com/1.js”,使用域名地址“https://www--aaa--com.abc.com/1.js”来替换域名地址“https://www.aaa.com/1.js”,从而获得更新后的资源。需要说明的是,该资源中所包含的第二域名地址不止一个,有可能是两个、三个、甚至更多,只需将该资源中包含的所有的第二域名地址,使用对应的编码后的域名地址替换掉,即可获得更新后的资源,再将该更新后的资源通过CDN服务器返回给客户端,进而使客户端获得所需要的资源,并且该资源中所包含的第二域名地址都是能够通过CDN服务器和改写服务器访问得到的。
在本实施例中,通过在CDN服务器和资源服务器之间引入改写服务器,使属于预设域名的客户端所请求的资源的域名地址,能够通过该改写服务器指向对应的资源服务器,无需改动CDN网络中的各个内部节点的功能,也不用改变资源服务器对页面文件的内容的处理方式,使不在同一个域的资源能够被客户端访问到,提升了客户体验度,降低了成本,实现了对网站所支持的互联网 通信协议的升级。
本申请的第四实施例涉及一种资源返回方法,第四实施例与第三实施例大致相同,主要区别之处在于:在接收资源服务器返回的响应消息之后,将资源中的第二域名地址进行编码,得到编码后的域名地址之前,还需要确定资源的类型为文本类型,并且扫描该文本类型的资源,确定资源中包括有第二域名地址。
具体处理流程如图4所示,在本实施例中,包括步骤401~405,其中,步骤401与第三实施例中的步骤301相同,并且,步骤404~405与第三实施例中的步骤302~303相同在此不再赘述,下面具体介绍本实施例中的步骤402~403。
在步骤402中,根据响应消息中携带的资源的类型标识,确定资源的类型为文本类型。需要说明的是,该响应消息中所携带的资源可以是多种类型的资源,例如,文本文件或图片资源等,根据响应消息中携带的资源的类型标识,可以确定该资源的所属类型,例如,在该响应消息的消息头中携带有资源的类型标识为“内容类型(content-type)”,设定文本类型为text/html,或,application/javascript,或,text/css,设定图片类型为image/jpeg,当content-type等于text/html,或,application/javascript,或,text/css时,表示该资源的类型为文本文件。
在步骤403中,扫描资源,确定资源中包括有第二域名地址。
在一个具体实现中,若确定该资源的类型为文本类型,则使用正则表达式扫描资源,若确定资源中的字符串与正则表达式相匹配,则确定资源中包括有第二域名地址,其中,正则表达式为预先设定的、具有第二域名地址的特征的字符串。
例如:设定正则表达式为“http://*.aaa.com”,则依次提取该文本类型的资源中的字符串,若所提取的字符串与该正则表达式相匹配,即所提取的字符串中包含有具有第二域名地址的特征的字符串“.aaa.com”时,则表示所提取的字符串是属于第二域名地址,则确定该文本资源中包括有第二域名地址。
在该实施方法中,通过使用正则表达式扫描文本资源,确定该文本资源中包含有第二域名地址,再对该第二域名地址进行编码,并使用编码后的域名地址替换对应的第二域名地址,将更新后的资源返回给处于第一互联网协议环境下的客户端,使该客户端能够访问与该客户端不在同一个域中的、支持第二互联网协议的资源服务器的资源,给客户带来了良好的客户体验。
上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包括相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。
本申请第五实施例提供了一种互联网拓扑结构,该互联网拓扑结构如图5所示,由客户端501,CDN服务器502,改写服务器503和资源服务器504组成,使用图6所示的流程步骤获取客户端501所请求的资源。
在步骤601中,客户端501,发送的HTTP请求消息给CDN服务器502。
其中,HTTP请求消息用于请求访问网站页面。
在步骤602中,CDN服务器502判断在白名单中是否包含有该HTTP请求消息所携带的HOST地址,并且客户端501处于IPv6的网络环境中,若确定该HOST地址在白名单中,并且客户端501支持IPv6网络协议,则执行步骤603,否则,执行步骤612。
在步骤603中,CDN服务器502将该HTTP请求消息转发至改写服务器503。
其中该HTTP请求消息中包含有资源服务器504的IP地址和端口号,以方便改写服务器503进行回源。
在步骤604中,改写服务器503判断该资源请求消息中所携带的域名地址是否经过编码的泛域名,若是,则执行步骤606,否则,执行步骤605。
在步骤605中,改写服务器503对该资源请求消息中所携带的域名地址进行解码,获得对应的原始域名地址,根据该原始域名地址访问对应的资源服 务器504。
在步骤606中,获取HTTP请求消息中包含的资源服务器504的IP地址和端口号,访问资源服务器504。
需要说明的是,资源服务器504处于IPv4的网络环境内,并且与客户端501不在同一个域内。
在步骤607中,资源服务器504接收到HTTP请求消息,返回响应消息给改写服务器503。
其中,响应消息中包含有所请求的资源。
在步骤608中,改写服务器503判断响应消息中包含的资源的类型是否是文本类型,若是,则执行步骤610,否则,执行步骤609。
在步骤609中,改写服务器503返回资源给CDN服务器502。
在步骤610中,改写服务器503使用正则表达式,对资源文件进行全文扫描,确定资源文件中包含的非本域链接地址,并对非本域链接地址进行编码。
其中,在资源文件扫描完成后,获取到该资源文件所包含的所有非本域链接地址,对各个非本域链接地址进行编码。
在步骤611中,改写服务器503使用编码后的域名地址,替换资源中的非本域链接地址,获得更新后的资源,发送更新后资源给CDN服务器502。
在步骤612中,CDN服务器502接收到改写服务器503返回的资源,并返回该资源给客户端501。
在该实施例中,通过在CDN服务器和资源服务器之间引入改写服务器,无需改动CDN网络中的各个内部节点的功能,也不用改变资源服务器对页面文件的内容的处理方式,相比与传统的CDN网络修改方案,可以降低成本,以实现网站从IPv4协议升级到IPv6协议。
本申请第六实施例提供了一种服务器,该设备具体结构如图7所示。包括至少一个处理器701;以及,与至少一个处理器701通信连接的存储器702。其中,存储器702存储有可被至少一个处理器701执行的指令,指令被至少一 个处理器701执行,以使至少一个处理器701能够执行第一至第二实施例中的任一实施例所描述的资源获取方法,或,执行第三至第四实施例中的任一实施例所描述的资源返回方法。
需要说明的是,该服务器可以是执行第一或第二实施例中所描述的资源获取方法的服务器,也可以是执行第三或第四实施例中所描述的资源返回方法的服务器,或,执行第一或第二实施例中所描述的资源获取方法和执行第三或第四实施例中所描述的资源返回方法的服务器。
本实施例中,处理器701以中央处理器(Central Processing Unit,CPU)为例,存储器702以可读写存储器(Random Access Memory,RAM)为例。处理器701、存储器702可以通过总线或者其他方式连接,图7中以通过总线连接为例。存储器702作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中实现资源获取方法的程序就存储于存储器702中。处理器701通过运行存储在存储器702中的非易失性软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述资源获取方法,或,上述资源返回方法。
存储器702可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储选项列表等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器702可选包括相对于处理器701远程设置的存储器,这些远程存储器可以通过网络连接至外接设备。
一个或者多个程序模块存储在存储器702中,当被一个或者多个处理器701执行时,执行上述任意方法实施例中的资源获取方法,或,执行上述任意方法实施例中的资源返回方法。
上述产品可执行本申请实施例所提供的方法,具备执行方法相应的功能模块和有益效果,未在本实施例中详尽描述的技术细节,可参见本申请实施例 所提供的方法。
本申请的第七实施例涉及一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,该计算机程序被处理器执行时能够实现本申请任意方法实施例中涉及的资源获取方法,或,资源返回方法。
本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
本领域的普通技术人员可以理解,上述各实施例是实现本申请的部分实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。

Claims (20)

  1. 一种资源获取方法,应用于改写服务器,所述方法包括:
    接收内容分发网络服务器基于第一互联网协议发送的资源请求消息,其中,所述资源请求消息中包括所请求的资源的域名地址;
    确定所述域名地址属于预设域名,则对所述域名地址进行解码,获得原始域名地址,其中,所述原始域名地址用于访问支持第二互联网协议的资源服务器;
    根据所述原始域名地址从所述资源服务器获取资源。
  2. 根据权利要求1所述的资源获取方法,其中,所述第一互联网协议的版本高于所述第二互联网协议的版本。
  3. 根据权利要求2所述的资源获取方法,其中,所述第一互联网协议为互联网协议第六版IPv6。
  4. 根据权利要求1至3任一项所述的资源获取方法,其中,所述资源的域名地址属于白名单,所述白名单中包括预先设定的支持域名转换的域名。
  5. 根据权利要求4所述的资源获取方法,其中,所述资源请求消息中还包括所述资源服务器的互联网协议地址和端口号。
  6. 根据权利要求1所述的资源获取方法,其中,对所述域名地址进行解码,获得原始域名地址,包括:
    将所述域名地址中的特殊字符替换为圆点分隔符,其中,所述特殊字符为国际域名允许的字符集中除圆点分隔符之外的任意一个;
    根据替换后的所述域名地址和所述预设域名,确定所述原始域名地址。
  7. 根据权利要求6所述的资源获取方法,其中,根据替换后的所述域名地址和所述预设域名,确定所述原始域名地址,包括:
    删除所述替换后的域名地址中所包含的所述预设域名,获得所述原始域名地址。
  8. 一种资源返回方法,应用于改写服务器,所述方法包括:
    接收资源服务器返回的响应消息,其中,所述响应消息中携带根据第一域名地址所获取的资源;
    将所述资源中的第二域名地址进行编码,得到编码后的域名地址,其中,所述第一域名地址与所述第二域名地址不属于同一个域,所述编码后的域名地址属于预设域名;
    根据所述编码后的域名地址更新所述资源,将更新后的所述资源通过内容分发网络服务器返回给客户端。
  9. 根据权利要求8所述的资源返回方法,其中,包括:所述第一域名地址用于访问支持第一互联网协议的资源服务器,所述第二域名地址用于访问支持第二互联网协议的资源服务器。
  10. 根据权利要求9所述的资源返回方法,其中,所述第一互联网协议的版本高于所述第二互联网协议的版本。
  11. 根据权利要求10所述的资源返回方法,其中,所述第一互联网协议为互联网协议第六版IPv6。
  12. 根据权利要求8至11任一项所述的资源返回方法,其中,根据所述编码后的域名地址更新所述资源,包括:
    使用所述编码后的域名地址替换所述资源中的第二域名地址,获得更新后的所述资源。
  13. 根据权利要求12所述的资源返回方法,其中,在接收资源服务器返回的响应消息之后,将所述资源中的第二域名地址进行编码,得到编码后的域名地址之前,还包括:
    根据所述响应消息中携带的所述资源的类型标识,确定所述资源的类型为文本类型;
    扫描所述资源,确定所述资源中包括有所述第二域名地址。
  14. 根据权利要求13所述的资源返回方法,其中,扫描所述资源,确定所述资源中包括有所述第二域名地址,包括:
    使用正则表达式扫描所述资源,若确定所述资源中的字符串与所述正则表达式相匹配,则确定所述资源中包括有所述第二域名地址,其中,所述正则表达式为预先设定的、具有所述第二域名地址的特征的字符串。
  15. 根据权利要求14所述的资源返回方法,其中,将所述资源中的第二域名地址进行编码,得到编码后的域名地址,包括:
    将所述第二域名地址中的圆点分隔符替换为特殊字符,获得替换后的域名地址,其中,所述特殊字符为国际域名允许的字符集中除圆点分隔符之外的任意一个;
    根据所述替换后的域名地址和所述预设域名,确定所述编码后的域名地址。
  16. 根据权利要求15所述的资源获取方法,其中,所述替换后的域名地址中包括:替换前缀和原路径信息;
    根据所述替换后的域名地址和所述预设域名,确定所述编码后的域名地址,包括:
    将所述替换后的域名地址与所述预设域名相叠加,获得所述编码后的域名地址,其中,所述编码后的域名地址依次为:所述替换前缀、所述预设域名和所述原路径信息。
  17. 一种服务器,包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7中任一所述的资源获取方法。
  18. 一种服务器,包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述 至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求8至16中任一所述的资源返回方法。
  19. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至7中任一所述的资源获取方法。
  20. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求8至16中任一所述的资源返回方法。
PCT/CN2020/074947 2019-03-05 2020-02-12 一种资源获取方法、资源返回方法及服务器、存储介质 WO2020177511A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP20726272.6A EP3734933B1 (en) 2019-03-05 2020-02-12 Resource acquisition method, server and storage medium
US16/885,175 US20200287865A1 (en) 2019-03-05 2020-05-27 Method for acquiring resource, method for returning resource, server, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910164233.8 2019-03-05
CN201910164233.8A CN109981595B (zh) 2019-03-05 2019-03-05 一种资源获取方法、资源返回方法及服务器、存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/885,175 Continuation US20200287865A1 (en) 2019-03-05 2020-05-27 Method for acquiring resource, method for returning resource, server, and storage medium

Publications (1)

Publication Number Publication Date
WO2020177511A1 true WO2020177511A1 (zh) 2020-09-10

Family

ID=67077932

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/074947 WO2020177511A1 (zh) 2019-03-05 2020-02-12 一种资源获取方法、资源返回方法及服务器、存储介质

Country Status (3)

Country Link
EP (1) EP3734933B1 (zh)
CN (1) CN109981595B (zh)
WO (1) WO2020177511A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112019584A (zh) * 2019-05-31 2020-12-01 阿里巴巴集团控股有限公司 资源访问控制方法、装置及计算机系统
CN112579933A (zh) * 2020-12-24 2021-03-30 中国农业银行股份有限公司 一种信息处理方法及装置
CN113542356A (zh) * 2021-06-10 2021-10-22 上海甄汇信息科技有限公司 局域网内终端快速获取互联网资源的方法
US20220407840A1 (en) * 2021-06-17 2022-12-22 Prosimo Inc Protocol Switching For Connections To Zero-Trust Proxy

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109981595B (zh) * 2019-03-05 2022-04-12 网宿科技股份有限公司 一种资源获取方法、资源返回方法及服务器、存储介质
CN110351294A (zh) * 2019-07-22 2019-10-18 马佳鑫 一种实现IPv4网络和IPv6网络互通的系统
CN111343268B (zh) * 2020-02-24 2022-03-25 北京达佳互联信息技术有限公司 多媒体资源的下载方法、装置、服务器和电子设备
CN111736926A (zh) * 2020-05-29 2020-10-02 北京慧博科技有限公司 在Java Web程序中低侵入式使用CDN加速服务的方法以及系统
CN112600950A (zh) * 2020-12-09 2021-04-02 福建万物易联网络科技有限公司 一种短横杆格式的外链改写方法及系统
CN114710314B (zh) * 2022-02-21 2023-06-06 深圳腾银信息咨询有限责任公司 一种配置化的软件服务平台访问方法、装置、系统及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130212240A1 (en) * 2012-02-15 2013-08-15 F5 Networks, Inc. Methods for dynamic dns implementation and systems thereof
CN103856408A (zh) * 2014-02-17 2014-06-11 中国科学院计算机网络信息中心 一种基于DNS的IPv6和IPv4互通信方法
CN106790503A (zh) * 2016-12-16 2017-05-31 广东睿哲科技股份有限公司 一种基于HTTP反向代理实现无天窗的IPv4网站应用向IPv6升级的装置
CN109981595A (zh) * 2019-03-05 2019-07-05 网宿科技股份有限公司 一种资源获取方法、资源返回方法及服务器、存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546850B (zh) * 2010-12-08 2015-11-25 中国电信股份有限公司 支持IPv6的IPv4内容提供方法、装置及服务器
CN102694754A (zh) * 2012-06-07 2012-09-26 广州睿哲网络科技有限公司 实现IPv4/IPv6网站内容互通的应用网关技术及系统
CN103888554B (zh) * 2014-03-24 2017-12-01 广州杰赛科技股份有限公司 IPv4与IPv6互通的域名解析方法和系统
US10671630B2 (en) * 2016-05-09 2020-06-02 Sap Se External access to database container artifacts
CN106230782A (zh) * 2016-07-20 2016-12-14 腾讯科技(深圳)有限公司 一种基于内容分发网络的信息处理方法及装置
CN106453675B (zh) * 2016-09-19 2022-07-08 网宿科技股份有限公司 302跳转方法、url生成方法及系统、域名解析方法及系统
CN107832329B (zh) * 2017-09-26 2020-11-13 中国平安人寿保险股份有限公司 页面资源获取方法及终端设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130212240A1 (en) * 2012-02-15 2013-08-15 F5 Networks, Inc. Methods for dynamic dns implementation and systems thereof
CN103856408A (zh) * 2014-02-17 2014-06-11 中国科学院计算机网络信息中心 一种基于DNS的IPv6和IPv4互通信方法
CN106790503A (zh) * 2016-12-16 2017-05-31 广东睿哲科技股份有限公司 一种基于HTTP反向代理实现无天窗的IPv4网站应用向IPv6升级的装置
CN109981595A (zh) * 2019-03-05 2019-07-05 网宿科技股份有限公司 一种资源获取方法、资源返回方法及服务器、存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3734933A4 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112019584A (zh) * 2019-05-31 2020-12-01 阿里巴巴集团控股有限公司 资源访问控制方法、装置及计算机系统
CN112019584B (zh) * 2019-05-31 2022-05-31 阿里巴巴集团控股有限公司 资源访问控制方法、装置及计算机系统
CN112579933A (zh) * 2020-12-24 2021-03-30 中国农业银行股份有限公司 一种信息处理方法及装置
CN112579933B (zh) * 2020-12-24 2023-12-08 中国农业银行股份有限公司 一种信息处理方法及装置
CN113542356A (zh) * 2021-06-10 2021-10-22 上海甄汇信息科技有限公司 局域网内终端快速获取互联网资源的方法
US20220407840A1 (en) * 2021-06-17 2022-12-22 Prosimo Inc Protocol Switching For Connections To Zero-Trust Proxy
US11811734B2 (en) * 2021-06-17 2023-11-07 Prosimo Inc Protocol switching for connections to zero-trust proxy

Also Published As

Publication number Publication date
EP3734933A1 (en) 2020-11-04
EP3734933A4 (en) 2021-03-10
EP3734933B1 (en) 2022-01-26
CN109981595B (zh) 2022-04-12
CN109981595A (zh) 2019-07-05

Similar Documents

Publication Publication Date Title
WO2020177511A1 (zh) 一种资源获取方法、资源返回方法及服务器、存储介质
US20200287865A1 (en) Method for acquiring resource, method for returning resource, server, and storage medium
US10785280B2 (en) Mechanism for distinguishing between content to be served through first or second delivery channels
JP6410280B2 (ja) ウェブサイト・アクセス方法、装置、およびウェブサイト・システム
KR102147246B1 (ko) 통신 네트워크에서 성능 개선을 위한 방법 및 장치
US9690568B2 (en) Client-side script bundle management system
US11675868B2 (en) Dynamic service worker code for storing information in web browser
US9679156B2 (en) Database virtualization
WO2013143403A1 (zh) 一种访问网站的方法和系统
WO2018050040A1 (zh) 实现web页面与本地应用通信的方法、装置和电子设备
CN101132420A (zh) 一种基于ssl vpn的链接改写方法和设备
CN101136834B (zh) 一种基于ssl vpn的链接改写方法和设备
US9727643B2 (en) Managing loading of web pages
US8453214B1 (en) Methods of locking a website
US20230418583A1 (en) Containerized, decentralized, and distributed web applications with end-to-end encryption
JP2009230662A (ja) ウェブサイト判定装置及びウェブサイト判定プログラム
WO2017067373A1 (zh) 数据推送方法及装置
CN207234829U (zh) 低流量网页访问系统
JP2015230712A (ja) 通信装置、通信方法、通信システム

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2020726272

Country of ref document: EP

Effective date: 20200527

NENP Non-entry into the national phase

Ref country code: DE