WO2019218845A1 - Hypertext transfer protocol redirecting method, device, routing device and storage medium - Google Patents

Hypertext transfer protocol redirecting method, device, routing device and storage medium Download PDF

Info

Publication number
WO2019218845A1
WO2019218845A1 PCT/CN2019/083604 CN2019083604W WO2019218845A1 WO 2019218845 A1 WO2019218845 A1 WO 2019218845A1 CN 2019083604 W CN2019083604 W CN 2019083604W WO 2019218845 A1 WO2019218845 A1 WO 2019218845A1
Authority
WO
WIPO (PCT)
Prior art keywords
browser
http
domain name
address
access request
Prior art date
Application number
PCT/CN2019/083604
Other languages
French (fr)
Chinese (zh)
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 中兴通讯股份有限公司
Publication of WO2019218845A1 publication Critical patent/WO2019218845A1/en

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/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]

Definitions

  • the present invention relates to the field of network technologies, and in particular, to a Hypertext Transfer Protocol (HTTP) redirection method, apparatus, routing device, and storage medium.
  • HTTP Hypertext Transfer Protocol
  • Browser Caching is to save the resources of the network to speed up browsing.
  • the browser stores the recently requested documents on the user's disk.
  • the browser can display the documents from the local disk. This will speed up the reading of the page.
  • the use of the browser's cache wit can reduce network latency in some cases, significantly speed up the opening of the page, and allow users to achieve a better experience.
  • the mechanism is also perfect, and on the other hand, it will bring some negative effects, resulting in users having to clean up the cache to get the browser back to normal work. If users have more Internet access, they will leave a lot of Internet traces and cache records. If there are too many cached messages, it will affect the user's Internet access quality and affect the user's online experience. And users sometimes show the wrong page because they read the cache.
  • the embodiment of the present invention is to provide an HTTP redirection method, device, routing device, and storage medium, which overcomes and avoids problems caused by browser caching and improves the user's online experience.
  • the embodiment of the invention provides an HTTP redirection method, including:
  • the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser;
  • the access request is redirected to a set webpage.
  • redirecting the access request to the setting webpage includes:
  • the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
  • the jumping, by the browser, the HTTP access request for the set port to the setting webpage includes:
  • the browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
  • the method further includes:
  • the browser provides a corresponding parsed real address to the browser based on the saved external network domain name, so that the browser performs a redirect jump based on the real address.
  • the method further includes:
  • the external network domain name that fails to be parsed is provided with a set number of parsing operations, including:
  • the legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality.
  • the method further includes:
  • the embodiment of the invention further provides an HTTP redirection device, including:
  • a networked detection module configured to detect the connection status with the Internet in real time
  • the non-network processing module is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in a state that is not connected to the Internet; when the browser is based on the When the virtual address initiates an access request, the access request is redirected to the set web page.
  • the unnetworked processing module is configured to:
  • the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
  • the unnetworked processing module is further configured to:
  • the browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
  • the non-network processing module is further configured to save an external network domain name that the browser requests to parse in a state that is not connected to the Internet;
  • the device further includes:
  • a network processing module configured to provide a corresponding parsed real address to the browser based on the saved external network domain name in a state that the Internet is connected, for the browser to perform redirection based on the real address Jump.
  • the network processing module is further configured to:
  • the network processing module is further configured to:
  • the legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality.
  • the network processing module is further configured to:
  • the embodiment of the invention further provides a wireless routing device, including:
  • a communication module configured to communicate with a user side browser
  • a memory configured to store an HTTP redirector
  • a processor configured to execute the HTTP redirector to implement the HTTP redirect method described above.
  • the embodiment of the present invention further provides a storage medium, where the computer program stores a computer program, and when the computer program is executed by the processor, the HTTP redirect method is implemented.
  • the HTTP redirection method, the device, the routing device, and the storage medium are used in the embodiment of the present invention, and are mainly used for the end user to access the wireless routing device through Wi-Fi or other means, and are solved by the browser cache during the process of using the browser to access the Internet.
  • the problems encountered by the mechanism are timely processed in a timely manner by detecting the state of the wireless routing device and the Internet connection state, thereby avoiding various problems caused by the browser cache and improving the user's online experience.
  • FIG. 1 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of an HTTP redirection device according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic structural diagram of an HTTP redirection device according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present invention.
  • An embodiment of the present invention provides an HTTP redirection method, which is applied to a wireless routing device. As shown in FIG. 1 , the method includes:
  • Step S101 detecting a connection state with the Internet in real time
  • Step S102 In the state that the Internet is not connected, the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser;
  • Step S103 when the browser initiates an access request based on the virtual address, redirecting the access request to a setting webpage.
  • step S103 includes:
  • A1 When receiving an access request initiated by the browser based on the virtual address, establishing a connection by using a handshake manner with the browser;
  • A2 After the connection is successfully established, the operating system kernel listens and intercepts the HTTP access request message for the set port sent by the browser, and jumps the HTTP access request of the browser to the set port to Set on the web page.
  • step A2 for example, the hook function of the kernel kernel of the Linux operating system can be used to listen for an HTTP GET request message with an intercepted port of 80.
  • the browser when the browser does not connect to the Internet and the browser accesses the webpage corresponding to the external domain name for the second time, according to the existing caching mechanism, the browser will initiate an access request according to the cached corresponding virtual address. You can establish a connection by shaking hands with the browser.
  • the HTTP access request of the browser for the set port is jumped to the setting webpage in step A2, including:
  • the browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
  • the set webpage address information may be gateway address information.
  • a virtual address is introduced in the route forwarding process.
  • the wireless routing device does not connect to the Internet
  • the wireless routing device receives the virtual user-based access request of the browser
  • the wireless routing device replaces the virtual address.
  • the server communicates with the browser user as the proxy of the server, and the browser user considers that the server corresponding to the virtual address communicates, and in fact communicates with the wireless routing device.
  • the wireless router redirects the browser's access to the external domain name to a unified page such as a gateway, so that the user can immediately know the state of the network without being cached by the existing browser.
  • the page displayed based on the cached information is confusing, improving the user's online experience.
  • the HTTP redirect method of an embodiment of the present invention further includes processing steps regarding a networked state.
  • the HTTP redirection method in the embodiment of the present invention is applied to a wireless routing device. As shown in FIG. 2, the method includes:
  • step S101 the connection status with the Internet is detected in real time.
  • Step S102 In the state that the Internet is not connected, the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser.
  • Step S103 when the browser initiates an access request based on the virtual address, redirecting the access request to a setting webpage.
  • Step S104 saving the external network domain name that the browser requests to parse in a state where the Internet is not connected.
  • Step S105 In the state that the Internet is connected, the browser provides a corresponding parsed real address to the browser based on the saved external network domain name, so that the browser performs a redirect jump based on the real address.
  • the wireless routing device in a state where the user does not log out using the browser, is changed from a state in which the Internet is not connected to a state in which the Internet is connected. At this time, the wireless routing device side still detects the connection state with the Internet in real time. Once the connection to the Internet is found, all the external domain names that have been parsed by the browser in the state that are not connected to the Internet are parsed one by one, and can be parsed by the Domain Name System (DNS) server. The returned real address is returned to the browser for the browser to access the correct web page information based on the real address.
  • DNS Domain Name System
  • the method further includes:
  • the network domain name resolution failure may be caused by factors such as weak network signal and slow response of the DNS server after the network connection, and the probability of obtaining the real address is increased as much as possible to meet the user's Internet access requirement.
  • the parsing failed external network domain name provides a set number of parsing operations, including:
  • the legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality. For example, a whitelist is created for a legitimate external domain name, and the whitelist is filtered to an illegal external domain name. This can prevent some illegally prohibited external domain names from occupying limited network resources.
  • the method further includes:
  • the scenario in which the implementation can be applied is: when the browser is in the state of connecting to the Internet when the browser is turned on and the webpage corresponding to the virtual address is accessed for the second time, since the user has already cached the virtual address corresponding to the external domain name to be accessed, According to the existing browser utilizing the cache mechanism, the virtual address is directly used to initiate an access request, and the wireless routing device no longer redirects the access request to the set webpage as if it was not connected to the network, but instead The access request redirects to the webpage corresponding to the real address.
  • the innovative embodiment of the present invention proposes a scheme in which a virtual address and a real address are in one-to-one correspondence, so that the user's online behavior can be monitored in real time to obtain a real address, so that under the influence of the browser cache mechanism, the signal intensity of the user in the network coverage is not too strong. When it is stable, or when switching back and forth from inside and outside the signal coverage, it can also enable the user to open the page smoothly when accessing the external network.
  • the embodiment of the present invention further provides an HTTP redirection device, which is applied to a wireless routing device.
  • the device further includes the following components:
  • the state detecting module 100 is configured to detect a connection state with the Internet in real time
  • the execution time of this module will be throughout the entire HTTP redirect process of the embodiment of the present invention.
  • the non-network processing module 200 is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in the state that the Internet is not connected to the browser; When an access request is initiated based on the virtual address, the access request is redirected to a set web page.
  • the non-networked processing module 200 is configured to:
  • the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
  • the hook function of the kernel kernel of the Linux operating system is used to listen for an HTTP GET request message with an intercepted port of 80.
  • the browser may initiate an access request according to the cached corresponding virtual address. You can establish a connection by shaking hands with the browser.
  • the unnetworked processing module is further configured to:
  • the browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
  • the browser can be jumped to access the URL corresponding to the set webpage.
  • the wireless routing device when the wireless routing device receives the access request of the browser user based on the virtual address when the wireless routing device is not connected to the Internet, the wireless routing device replaces the server corresponding to the virtual address as the proxy and browser user of the server.
  • the browser user believes that the server corresponding to the virtual address communicates, and in fact communicates with the wireless routing device.
  • the wireless router redirects the browser's access to the external domain name to a unified page such as a gateway, so that the user can immediately know the state of the network without being cached by the existing browser.
  • the page displayed based on the cached information is confusing, improving the user's online experience.
  • the embodiment of the invention further provides an HTTP redirection device, the device further comprising a processing module about the networked state.
  • the HTTP redirection device of the embodiment of the present invention is applied to a wireless routing device. As shown in FIG. 4, the device includes the following components:
  • the state detection module 100 is configured to detect the connection state with the Internet in real time; the execution time of this module will be throughout the entire HTTP redirection process of the embodiment of the present invention.
  • the non-network processing module 200 is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in the state that the Internet is not connected to the browser; When an access request is initiated based on the virtual address, the access request is redirected to a set web page.
  • the non-network processing module 200 is further configured to save the external network domain name that the browser requests to parse in a state that is not connected to the Internet;
  • the network processing module 300 is configured to provide a corresponding parsed real address to the browser based on the saved external network domain name in a state that the Internet is connected, so that the browser is based on the real address. Perform a redirect jump.
  • the wireless routing device in a state where the user does not quit using the browser, the wireless routing device is changed from the state in which the Internet is not connected to the state in which the Internet is connected.
  • the state detecting module 100 on the wireless routing device side is still detecting in real time.
  • the connection status with the Internet once the connection to the Internet is found, all the external domain names that the browser requests to resolve in the state of the Internet that is not connected to the Internet are analyzed in a timely manner, for example, by sending to the DNS (Domain Name System, domain name)
  • the system parses the server and returns the parsed real address to the browser for the browser to access the correct web page information based on the real address.
  • the network processing module 300 is further configured to:
  • the network domain name resolution failure may be caused by factors such as weak network signal and slow response of the DNS server after the network connection, and the probability of obtaining the real address is increased as much as possible to meet the user's Internet access requirement.
  • the network processing module 300 is further configured to:
  • the legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality. For example, a whitelist is created for a legitimate external domain name, and the whitelist is filtered to an illegal external domain name. This can prevent some illegally prohibited external domain names from occupying limited network resources.
  • the network processing module 300 is further configured to:
  • the scenario in which the implementation can be applied is: when the browser is in the state of connecting to the Internet when the browser is turned on and the webpage corresponding to the virtual address is accessed for the second time, since the user has already cached the virtual address corresponding to the external domain name to be accessed, According to the existing browser utilizing the cache mechanism, the virtual address is directly used to initiate an access request, and the wireless routing device no longer redirects the access request to the set webpage as if it was not connected to the network, but instead The access request redirects to the webpage corresponding to the real address.
  • Embodiments of the present invention also provide a wireless router including a memory, a processor, and a computer program stored on the memory and operable on the processor, the computer program being implemented by the processor to implement the present invention
  • a wireless router including a memory, a processor, and a computer program stored on the memory and operable on the processor, the computer program being implemented by the processor to implement the present invention
  • the related technology is easily affected by the browser cache, which causes the user to open the page or open the wrong page during the process of accessing the external network.
  • the browser cache Under the influence of the browser cache, the browser caches the IP address without closing the current browser. After the networked state of the wireless routing device is switched, the subsequent domain name access request does not quickly resend the DNS request. Directly use the buffered IP to initiate the Transmission Control Protocol (TCP) three-way handshake, which is easy to appear on the previous page and cannot open the correct page.
  • TCP Transmission Control Protocol
  • the embodiment of the present invention can overcome the above problems, and monitor the online behavior of the user in real time to start the corresponding iptables routing and forwarding rule, so that the wireless routing device accesses the wireless routing device to use the browser whether the network is not connected or connected. Accessing the page is not affected by the browser cache.
  • the user's online behavior is dynamically monitored by the wireless routing device, and is not affected by the browser cache. The user accessing the wireless routing device can access the correct page and improve the user experience.
  • FIG. 5 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present invention. As shown in FIG. 5, the flow of HTTP redirection execution in this embodiment is as follows:
  • Step S1 The wireless routing device determines whether the current device is connected to the network. If the network is connected, step S5 is performed. If the network is not connected, step S2 is performed.
  • the wireless routing device detects the networking state of the device, initializes a routing forwarding rule according to the networking state, and adds or deletes a corresponding redirect forwarding rule.
  • Step S2 Initialize the routing rule and notify the kernel to enable the HTTP redirect gateway function.
  • the routing rule is initialized, and the route redirection forwarding rule added during the networking is cleared, and according to the current state that the wireless routing device is not connected, the kernel is notified to enable the HTTP redirection gateway function, and all
  • the destination port is the 80-port HTTP request packet redirected to the gateway address, paving the way for the TCP three-way handshake to be simulated in step S3 (including S31-S33).
  • the three-way handshake between the subsequent terminal-side browser and the virtual IP address is actually the interaction between the browser and the wireless routing device, because the browser sends the HTTP GET request packet only after the handshake is successful, which is convenient for step S4.
  • the intercepted HTTP GET request message is processed.
  • Step S31 It is judged whether a DNS request is received, if yes, step S32 is performed, and if not received, step S33 is performed.
  • Step S32 Returning the virtual IP address, and then performing step S33.
  • Step S33 Perform a TCP three-way handshake directly.
  • the wireless routing device monitors whether the browser currently receives a DNS request for the external network domain name, and if received, returns a dynamically generated virtual IP address, and if the browser sends a virtual IP address based on the direct IP address. Three handshakes.
  • Step S4 intercepting the HTTP GET request packet initiated by the user, and completing the HTTP redirect to the gateway function.
  • the HTTP hook function of the Linux operating system kernel is used to intercept the HTTP GET request packet with the destination port being 80.
  • the HTTP 300 status code is used to simulate the DNS server to form an HTTP 302 response message, and the gateway address is filled into the Location. Field to have the browser re-jump to the URL of the gateway.
  • Step S5 Initialize the routing rule and notify the kernel to turn off the redirection gateway function before networking.
  • the routing rule is initialized, and the rule of redirecting to the gateway address before the network is cleared after the network is connected, and the Linux operating system kernel is notified to disable the HTTP redirecting gateway function according to the networking state.
  • Step S6 Release all the intercepted messages.
  • Step S71 It is determined whether the real IP corresponding to the virtual IP is obtained, and if yes, step S75 is performed; otherwise, step S72 is performed.
  • Step S72 sequentially select the domain name that failed to be parsed.
  • Step S73 Verify that the domain name is legal. If yes, go to step S74; otherwise, go to step S72.
  • Step S74 Perform DNS resolution on the domain name that failed to be parsed, and determine whether the three parsing fails. If the three parsing fails, step S72 is performed; otherwise, step S75 is performed.
  • Step S75 Add a routing rule and redirect the IP address.
  • the wireless routing device resolves the external domain name accessed by the browser before the network to the corresponding real IP address.
  • the external domain name, the virtual IP address, and the real IP address have a unique correspondence. If the domain name resolution fails, it is preferred to traverse the domain names that failed to be resolved.
  • the legality detection is performed first.
  • the DNS domain name resolution is given three times for the legal domain name, and the real IP address is guaranteed to be more likely. .
  • the route redirection forwarding rule under the real IP address corresponding to the virtual IP address is added to prevent the page that the user wants to access from being opened normally due to the influence of the browser cache.
  • the Linux operating system provides powerful routing forwarding and data stream interception functions, and combines routing forwarding with hook intercepting HTTP packet technology to solve the problem caused by the browser DNS cache. Directed forwarding rules and HTTP jump protocols to implement the corresponding redirection function.
  • the corresponding redirect forwarding rule is added to forcibly redirect all HTTP requests whose destination port is port 80 to the gateway, simulating the TCP three-way handshake of all HTTP requests.
  • the wireless routing device finds that the network is disconnected, and a virtual IP address is returned to the browser, and the virtual IP address is dynamically generated.
  • the virtual IP addresses corresponding to each external domain name accessed by the device are different, but they are all private network IP addresses.
  • the browser communicates with the server corresponding to the virtual IP address. In fact, the browser communicates with the wireless routing device.
  • a hook function is hooked in the Linux operating system kernel to listen for intercepted HTTP request packets. And use the feedback of the status code of HTTP 302 to redirect the browser to the gateway page.
  • each domain name accessed before the network is parsed into the real IP address of the website.
  • the external domain name, virtual IP address, and real IP address have a unique correspondence.
  • the real-time monitoring and analysis results if the network signal strength and the DNS server response are slow, etc., the network domain name of the wireless routing device fails to obtain the real IP address.
  • IP address add the corresponding redirect forwarding rule to ensure that the HTTP request to access the virtual IP address is redirected to the real IP address. Ensure that users accessing the wireless routing device can switch back and forth between the wireless router device and the networked state.
  • the browser can be unaffected by the browser's cached IP; it will not be re-initiated quickly in the browser.
  • the browser can still correctly display the external web page that the user wants to access.
  • the embodiment of the present invention further provides a storage medium, where the storage medium includes a stored program, where the program is executed to execute the HTTP redirection method provided by the embodiment of the present invention.
  • the embodiment of the present invention can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is a better implementation.
  • the flow of the HTTP request redirection of the present invention can be embodied in the form of a computer software product stored in a storage medium (such as Read-Only Memory (ROM)/random access memory).
  • the memory RAM, Random Access Memory
  • the disk, and the optical disk include a plurality of instructions for causing a device (which may be a network device such as a wireless router) to perform the HTTP request redirection process of the embodiment of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed by the present invention is a hypertext transfer protocol (HTTP) redirecting method, device, routing device and storage medium, the method comprising: detecting a state of connection to the Internet in real time; in a state of not being connected to the internet, returning a virtual address corresponding to an external network domain name to a browser on the basis of said external network domain name which the browser is requesting to analyze; and when the browser triggers an access request on the basis of the virtual address, redirecting the access request to a configuration page.

Description

超文本传输协议重定向方法、装置、路由设备及存储介质Hypertext transfer protocol redirection method, device, routing device and storage medium
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201810475748.5、申请日为2018年05月17日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。The present application is filed on the basis of the Chinese Patent Application Serial No. 20, 181, 074, s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s
技术领域Technical field
本发明涉及网络技术领域,尤其涉及一种超文本传输协议(HTTP,HyperText Transfer Protocol)重定向方法、装置、路由设备及存储介质。The present invention relates to the field of network technologies, and in particular, to a Hypertext Transfer Protocol (HTTP) redirection method, apparatus, routing device, and storage medium.
背景技术Background technique
浏览器缓存(Browser Caching)是为了节约网络的资源加速浏览,浏览器在用户磁盘上对最近请求过的文档进行存储,当访问者再次请求这个页面时,浏览器就可以从本地磁盘显示文档,这样就可以加速页面的阅览。浏览器的缓存机智的使用在一些情况下能够减少网络的延迟,明显加快页面的打开速度,让用户达到更好的体验。但是该机制也并十全十美,另一方面也会带来一些负面影响,导致用户不得不通过清理缓存才能让浏览器恢复正常工作。如果用户上网比较多,会留下很多上网痕迹及缓存记录,如果缓存信息过多,会影响用户的上网质量,影响用户的上网体验。而且用户有时会因为读取了缓存而展示了错误的页面。Browser Caching is to save the resources of the network to speed up browsing. The browser stores the recently requested documents on the user's disk. When the visitor requests the page again, the browser can display the documents from the local disk. This will speed up the reading of the page. The use of the browser's cache wit can reduce network latency in some cases, significantly speed up the opening of the page, and allow users to achieve a better experience. However, the mechanism is also perfect, and on the other hand, it will bring some negative effects, resulting in users having to clean up the cache to get the browser back to normal work. If users have more Internet access, they will leave a lot of Internet traces and cache records. If there are too many cached messages, it will affect the user's Internet access quality and affect the user's online experience. And users sometimes show the wrong page because they read the cache.
发明内容Summary of the invention
有鉴于此,本发明实施例期望提供一种HTTP重定向方法、装置、路由设备及存储介质,克服并避免了由于浏览器缓存导致的问题,提升用户的上网体验。In view of this, the embodiment of the present invention is to provide an HTTP redirection method, device, routing device, and storage medium, which overcomes and avoids problems caused by browser caching and improves the user's online experience.
本发明实施例提供了一种HTTP重定向方法,包括:The embodiment of the invention provides an HTTP redirection method, including:
实时检测与互联网的连接状态;Real-time detection of the connection status with the Internet;
在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;In the state that the Internet is not connected, the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser;
当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。When the browser initiates an access request based on the virtual address, the access request is redirected to a set webpage.
上述方案中,所述当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上,包括:In the above solution, when the browser initiates an access request based on the virtual address, redirecting the access request to the setting webpage includes:
接收到所述浏览器基于所述虚拟地址发起的访问请求时,与所述浏览器采用握手的方式建立连接;When receiving the access request initiated by the browser based on the virtual address, establishing a connection with the browser by using a handshake manner;
建立连接成功后,利用操作系统内核监听并截获到所述浏览器发出的针对设定端口的HTTP访问请求报文时,将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上。After the connection is successfully established, when the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
上述方案中,所述将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上,包括:In the above solution, the jumping, by the browser, the HTTP access request for the set port to the setting webpage includes:
通过向所述浏览器返回携带有所述设定网页地址信息的HTTP响应报文,来使所述浏览器跳转到访问所述设定网页。The browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
上述方案中,所述方法还包括:In the above solution, the method further includes:
保存在未连接互联网的状态下所述浏览器请求解析的外网域名;The external domain name that the browser requests to parse in a state where the Internet is not connected;
在已连接互联网的状态下,基于保存的所述外网域名向所述浏览器提供对应的解析后的真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。The browser provides a corresponding parsed real address to the browser based on the saved external network domain name, so that the browser performs a redirect jump based on the real address.
上述方案中,所述方法还包括:In the above solution, the method further includes:
在向所述浏览器提供所述真实地址的过程中,针对解析失败的外网域名,提供设定次数的重新解析操作。In the process of providing the real address to the browser, a re-analysis operation of a set number of times is provided for the external network domain name that fails to be parsed.
上述方案中,所述针对解析失败的外网域名,提供设定次数的解析操 作,包括:In the above solution, the external network domain name that fails to be parsed is provided with a set number of parsing operations, including:
对解析失败的外网域名进行合法性检测,对于通过合法性检测的外网域名提供设定次数的重新解析操作。The legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality.
上述方案中,所述方法还包括:In the above solution, the method further includes:
在连接互联网的状态下,建立保存的所述外网域名、所述虚拟地址以及所述真实地址之间的对应关系;Establishing a stored correspondence between the external network domain name, the virtual address, and the real address in a state of connecting to the Internet;
当所述浏览器基于缓存的所述虚拟地址发起访问请求时,向所述浏览器提供所述虚拟地址对应的所述真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。When the browser initiates an access request based on the cached virtual address, providing the browser with the real address corresponding to the virtual address, so that the browser performs a redirect jump based on the real address. .
本发明实施例还提供一种HTTP重定向装置,包括:The embodiment of the invention further provides an HTTP redirection device, including:
联网检测模块,配置为实时检测与互联网的连接状态;a networked detection module configured to detect the connection status with the Internet in real time;
未联网处理模块,配置为在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。The non-network processing module is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in a state that is not connected to the Internet; when the browser is based on the When the virtual address initiates an access request, the access request is redirected to the set web page.
上述方案中,所述未联网处理模块,配置为:In the above solution, the unnetworked processing module is configured to:
接收到所述浏览器基于所述虚拟地址发起的访问请求时,与所述浏览器采用握手的方式建立连接;When receiving the access request initiated by the browser based on the virtual address, establishing a connection with the browser by using a handshake manner;
建立连接成功后,利用操作系统内核监听并截获到所述浏览器发出的针对设定端口的HTTP访问请求报文时,将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上。After the connection is successfully established, when the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
上述方案中,所述未联网处理模块,还配置为:In the above solution, the unnetworked processing module is further configured to:
通过向所述浏览器返回携带有所述设定网页地址信息的HTTP响应报文,来使所述浏览器跳转到访问所述设定网页。The browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
上述方案中,所述未联网处理模块,还配置为保存在未连接互联网的状态下所述浏览器请求解析的外网域名;In the above solution, the non-network processing module is further configured to save an external network domain name that the browser requests to parse in a state that is not connected to the Internet;
所述装置,还包括:The device further includes:
联网处理模块,配置为在已连接互联网的状态下,基于保存的所述外网域名向所述浏览器提供对应的解析后的真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。a network processing module, configured to provide a corresponding parsed real address to the browser based on the saved external network domain name in a state that the Internet is connected, for the browser to perform redirection based on the real address Jump.
上述方案中,所述联网处理模块,还配置为:In the above solution, the network processing module is further configured to:
在向所述浏览器提供所述真实地址的过程中,针对解析失败的外网域名,提供设定次数的重新解析操作。In the process of providing the real address to the browser, a re-analysis operation of a set number of times is provided for the external network domain name that fails to be parsed.
上述方案中,所述联网处理模块,还配置为:In the above solution, the network processing module is further configured to:
对解析失败的外网域名进行合法性检测,对于通过合法性检测的外网域名提供设定次数的重新解析操作。The legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality.
上述方案中,所述联网处理模块,还配置为:In the above solution, the network processing module is further configured to:
在连接互联网的状态下,建立保存的所述外网域名、所述虚拟地址以及所述真实地址之间的对应关系;Establishing a stored correspondence between the external network domain name, the virtual address, and the real address in a state of connecting to the Internet;
当所述浏览器基于缓存的所述虚拟地址发起通信请求时,向所述浏览器提供所述虚拟地址对应的所述真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。When the browser initiates a communication request based on the cached virtual address, providing the browser with the real address corresponding to the virtual address, so that the browser performs a redirect jump based on the real address. .
本发明实施例还提供一种无线路由设备,包括:The embodiment of the invention further provides a wireless routing device, including:
通信模块,配置为与用户侧浏览器进行通信交互;a communication module configured to communicate with a user side browser;
存储器,配置为存储有HTTP重定向程序;以及,a memory configured to store an HTTP redirector; and,
处理器,配置为执行所述HTTP重定向程序以实现上述的HTTP重定向方法。a processor configured to execute the HTTP redirector to implement the HTTP redirect method described above.
本发明实施例还提供一种存储介质,所述存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述的HTTP重定向方法。The embodiment of the present invention further provides a storage medium, where the computer program stores a computer program, and when the computer program is executed by the processor, the HTTP redirect method is implemented.
应用本发明实施例所述HTTP重定向方法、装置、路由设备及存储介质,主要针对终端用户通过Wi-Fi或其他方式接入无线路由设备后,解决使用浏览器上网的过程中受到浏览器缓存机制的影响遇到的问题,通过实时 检测无线路由设备与互联网连接状态的方式及时进行相应的处理,避免了各种由于浏览器缓存导致的问题,提升用户的上网体验。The HTTP redirection method, the device, the routing device, and the storage medium are used in the embodiment of the present invention, and are mainly used for the end user to access the wireless routing device through Wi-Fi or other means, and are solved by the browser cache during the process of using the browser to access the Internet. The problems encountered by the mechanism are timely processed in a timely manner by detecting the state of the wireless routing device and the Internet connection state, thereby avoiding various problems caused by the browser cache and improving the user's online experience.
附图说明DRAWINGS
图1为本发明实施例提供的HTTP重定向方法流程示意图;FIG. 1 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present disclosure;
图2为本发明实施例提供的HTTP重定向方法流程示意图;2 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present invention;
图3为本发明实施例提供的HTTP重定向装置组成结构示意图;FIG. 3 is a schematic structural diagram of an HTTP redirection device according to an embodiment of the present disclosure;
图4为本发明实施例提供的HTTP重定向装置组成结构示意图;4 is a schematic structural diagram of an HTTP redirection device according to an embodiment of the present invention;
图5为本发明实施例提供的HTTP重定向方法流程示意图。FIG. 5 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present invention.
具体实施方式Detailed ways
以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
本发明实施例提供了一种HTTP重定向方法,应用于无线路由设备,如图1所示,该方法包括:An embodiment of the present invention provides an HTTP redirection method, which is applied to a wireless routing device. As shown in FIG. 1 , the method includes:
步骤S101,实时检测与互联网的连接状态;Step S101, detecting a connection state with the Internet in real time;
这一步骤将贯穿本发明实施例的整个HTTP重定向过程中。This step will be throughout the entire HTTP redirect process of embodiments of the present invention.
步骤S102,在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;Step S102: In the state that the Internet is not connected, the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser;
步骤S103,当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。Step S103, when the browser initiates an access request based on the virtual address, redirecting the access request to a setting webpage.
在一些实施例中,步骤S103包括:In some embodiments, step S103 includes:
A1:接收到所述浏览器基于所述虚拟地址发起的访问请求时,与所述浏览器采用握手的方式建立连接;A1: When receiving an access request initiated by the browser based on the virtual address, establishing a connection by using a handshake manner with the browser;
A2:建立连接成功后,利用操作系统内核监听并截获、到所述浏览器发出的针对设定端口的HTTP访问请求报文时,将所述浏览器针对设定端 口的HTTP访问请求跳转到设定网页上。A2: After the connection is successfully established, the operating system kernel listens and intercepts the HTTP access request message for the set port sent by the browser, and jumps the HTTP access request of the browser to the set port to Set on the web page.
在步骤A2中例如,可以利用Linux操作系统的kernel内核的hook函数监听截获端口是80的HTTP GET请求报文。In step A2, for example, the hook function of the kernel kernel of the Linux operating system can be used to listen for an HTTP GET request message with an intercepted port of 80.
另外,在未连接互联网的状态下且浏览器第二次访问外网域名对应的网页时,根据现有的缓存机制,浏览器会根据已缓存的相应虚拟地址发起的访问请求,此时,直接采用与浏览器握手的方式建立连接即可。In addition, when the browser does not connect to the Internet and the browser accesses the webpage corresponding to the external domain name for the second time, according to the existing caching mechanism, the browser will initiate an access request according to the cached corresponding virtual address. You can establish a connection by shaking hands with the browser.
在一些实施例中,在步骤A2中将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上,包括:In some embodiments, the HTTP access request of the browser for the set port is jumped to the setting webpage in step A2, including:
通过向所述浏览器返回携带有所述设定网页地址信息的HTTP响应报文,来使所述浏览器跳转到访问所述设定网页。The browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
例如,将所述设定网页地址信息填写在HTTP 302响应报文中的Location字段中,就能实现将所述浏览器跳转到访问所述设定网页对应的URL。该设定网页地址信息可以是网关地址信息。For example, by filling in the set webpage address information in the Location field in the HTTP 302 response message, the browser can be jumped to access the URL corresponding to the set webpage. The set webpage address information may be gateway address information.
本发明实施例创新的在路由转发过程中引入虚拟地址,在无线路由设备未连接互联网的情况下,无线路由设备接收到浏览器用户基于虚拟地址的访问请求时,无线路由设备代替该虚拟地址对应的服务器即作为该服务器的代理与浏览器用户进行通信,浏览器用户认为是与此虚拟地址对应的服务器进行通信,实则是和无线路由设备进行通信。无线路由器此时是要把浏览器对于外网域名的访问都重定向到一个统一的设定网页比如网关的页面,让用户立即获知其未联网的状态,而不会被现有浏览器缓存机制中基于已缓存的信息显示的页面所迷惑,提升用户的上网体验。In the embodiment of the present invention, a virtual address is introduced in the route forwarding process. When the wireless routing device does not connect to the Internet, when the wireless routing device receives the virtual user-based access request of the browser, the wireless routing device replaces the virtual address. The server communicates with the browser user as the proxy of the server, and the browser user considers that the server corresponding to the virtual address communicates, and in fact communicates with the wireless routing device. At this time, the wireless router redirects the browser's access to the external domain name to a unified page such as a gateway, so that the user can immediately know the state of the network without being cached by the existing browser. The page displayed based on the cached information is confusing, improving the user's online experience.
在一些实施例中,本发明实施例的HTTP重定向方法还包括关于联网状态的处理步骤。In some embodiments, the HTTP redirect method of an embodiment of the present invention further includes processing steps regarding a networked state.
本发明实施例的HTTP重定向方法,应用于无线路由设备,如图2所示,该方法包括:The HTTP redirection method in the embodiment of the present invention is applied to a wireless routing device. As shown in FIG. 2, the method includes:
步骤S101,实时检测与互联网的连接状态。In step S101, the connection status with the Internet is detected in real time.
这一步骤将贯穿本发明实施例的整个HTTP重定向过程中。This step will be throughout the entire HTTP redirect process of embodiments of the present invention.
步骤S102,在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址。Step S102: In the state that the Internet is not connected, the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser.
步骤S103,当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。Step S103, when the browser initiates an access request based on the virtual address, redirecting the access request to a setting webpage.
步骤S101~S103的详细描述可参见前述实施例,此处不做赘述。For detailed descriptions of the steps S101 to S103, refer to the foregoing embodiments, and details are not described herein.
步骤S104,保存在未连接互联网的状态下所述浏览器请求解析的外网域名。Step S104, saving the external network domain name that the browser requests to parse in a state where the Internet is not connected.
步骤S105,在已连接互联网的状态下,基于保存的所述外网域名向所述浏览器提供对应的解析后的真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。Step S105: In the state that the Internet is connected, the browser provides a corresponding parsed real address to the browser based on the saved external network domain name, so that the browser performs a redirect jump based on the real address.
在一些实施例中,在用户使用浏览器未退出的状态下,无线路由设备由未连接互联网的状态转变成连接互联网的状态,此时,无线路由设备侧仍在实时检测与互联网的连接状态,一旦发现连接互联网,则及时对已保存的在未连接互联网的状态下所述浏览器请求解析的所有外网域名进行逐个解析,可以是通过发给域名系统(DNS,Domain Name System)服务器进行解析,将解析得到的真实地址返回给浏览器,以供浏览器基于真实地址进行访问得到正确的网页信息。In some embodiments, in a state where the user does not log out using the browser, the wireless routing device is changed from a state in which the Internet is not connected to a state in which the Internet is connected. At this time, the wireless routing device side still detects the connection state with the Internet in real time. Once the connection to the Internet is found, all the external domain names that have been parsed by the browser in the state that are not connected to the Internet are parsed one by one, and can be parsed by the Domain Name System (DNS) server. The returned real address is returned to the browser for the browser to access the correct web page information based on the real address.
在一些实施例中,所述方法还包括:In some embodiments, the method further includes:
在向所述浏览器提供所述真实地址的过程中,针对解析失败的外网域名,提供设定次数的重新解析操作。这样做可以针对联网后因网络信号弱以及DNS服务器响应慢等因素导致某个外网域名解析失败的情况,尽可能的增大真实地址的获取几率,满足用户的上网需求。In the process of providing the real address to the browser, a re-analysis operation of a set number of times is provided for the external network domain name that fails to be parsed. In this way, the network domain name resolution failure may be caused by factors such as weak network signal and slow response of the DNS server after the network connection, and the probability of obtaining the real address is increased as much as possible to meet the user's Internet access requirement.
在一些实施例中,所述针对解析失败的外网域名,提供设定次数的解析操作,包括:In some embodiments, the parsing failed external network domain name provides a set number of parsing operations, including:
对解析失败的外网域名进行合法性检测,对于通过合法性检测的外网域名提供设定次数的重新解析操作。例如为合法的外网域名建立一个白名单,通过该白名单过滤到非法的外网域名,这样做可以避免一些非法的禁止访问的外网域名占用有限的网络资源。The legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality. For example, a whitelist is created for a legitimate external domain name, and the whitelist is filtered to an illegal external domain name. This can prevent some illegally prohibited external domain names from occupying limited network resources.
在一些实施例中,还包括:In some embodiments, the method further includes:
在连接互联网的状态下,建立保存的所述外网域名、所述虚拟地址以及所述真实地址之间的对应关系;Establishing a stored correspondence between the external network domain name, the virtual address, and the real address in a state of connecting to the Internet;
当所述浏览器基于缓存的所述虚拟地址发起访问请求时,向所述浏览器提供所述虚拟地址对应的所述真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。When the browser initiates an access request based on the cached virtual address, providing the browser with the real address corresponding to the virtual address, so that the browser performs a redirect jump based on the real address. .
该实现方式可以应用的场景是:针对浏览器开启时就处于连接互联网的状态且第二次访问所述虚拟地址对应的网页时,由于用户已经缓存有欲访问的外网域名对应的虚拟地址,按照现有的浏览器利用缓存的机制,会直接利用所述虚拟地址发起访问请求,此时无线路由设备不再像未联网时一样将该访问请求重定向跳转到设定网页,而是将所述该访问请求重定向跳转到真实地址对应的网页去。The scenario in which the implementation can be applied is: when the browser is in the state of connecting to the Internet when the browser is turned on and the webpage corresponding to the virtual address is accessed for the second time, since the user has already cached the virtual address corresponding to the external domain name to be accessed, According to the existing browser utilizing the cache mechanism, the virtual address is directly used to initiate an access request, and the wireless routing device no longer redirects the access request to the set webpage as if it was not connected to the network, but instead The access request redirects to the webpage corresponding to the real address.
本发明实施例创新的提出虚拟地址与真实地址一一对应的方案,做到实时监控用户的上网行为以获取真实地址,从而在浏览器缓存机制的影响下,用户在网络覆盖的信号强度不太稳定时候,或者从信号覆盖范围内外来回切换移动的情况下,也能使用户访问外网时顺畅的打开页面。The innovative embodiment of the present invention proposes a scheme in which a virtual address and a real address are in one-to-one correspondence, so that the user's online behavior can be monitored in real time to obtain a real address, so that under the influence of the browser cache mechanism, the signal intensity of the user in the network coverage is not too strong. When it is stable, or when switching back and forth from inside and outside the signal coverage, it can also enable the user to open the page smoothly when accessing the external network.
本发明实施例还提供一种HTTP重定向装置,应用于无线路由设备,如图3所示,所述装置,还包括以下组成部分:The embodiment of the present invention further provides an HTTP redirection device, which is applied to a wireless routing device. As shown in FIG. 3, the device further includes the following components:
1)状态检测模块100,配置为实时检测与互联网的连接状态;1) The state detecting module 100 is configured to detect a connection state with the Internet in real time;
这一模块的执行时间将贯穿本发明实施例的整个HTTP重定向过程中。The execution time of this module will be throughout the entire HTTP redirect process of the embodiment of the present invention.
2)未联网处理模块200,配置为在未连接互联网的状态下,基于浏览 器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。2) The non-network processing module 200 is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in the state that the Internet is not connected to the browser; When an access request is initiated based on the virtual address, the access request is redirected to a set web page.
在一些实施例中,未联网处理模块200,配置为:In some embodiments, the non-networked processing module 200 is configured to:
接收到所述浏览器基于所述虚拟地址发起的访问请求时,与所述浏览器采用握手的方式建立连接;When receiving the access request initiated by the browser based on the virtual address, establishing a connection with the browser by using a handshake manner;
建立连接成功后,利用操作系统内核监听并截获到所述浏览器发出的针对设定端口的HTTP访问请求报文时,将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上。After the connection is successfully established, when the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
例如,利用Linux操作系统的kernel内核的hook函数监听截获端口是80的HTTP GET请求报文。For example, the hook function of the kernel kernel of the Linux operating system is used to listen for an HTTP GET request message with an intercepted port of 80.
另外,在未连接互联网的状态下且浏览器第二次访问外网域名时,根据现有的缓存机制,浏览器会根据已缓存的相应的所述虚拟地址发起的访问请求,此时,直接与浏览器采用握手的方式建立连接即可。In addition, when the Internet is not connected to the Internet and the browser accesses the external domain name for the second time, according to the existing caching mechanism, the browser may initiate an access request according to the cached corresponding virtual address. You can establish a connection by shaking hands with the browser.
在一些实施例中,所述未联网处理模块,还配置为:In some embodiments, the unnetworked processing module is further configured to:
通过向所述浏览器返回携带有所述设定网页地址信息的HTTP响应报文,来使所述浏览器跳转到访问所述设定网页。The browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
例如,将所述设定网页地址信息填写在HTTP 302响应报文中的Location字段中,就能实现将所述浏览器跳转到访问所述设定网页对应的URL。For example, by filling in the set webpage address information in the Location field in the HTTP 302 response message, the browser can be jumped to access the URL corresponding to the set webpage.
本发明实施例是在无线路由设备未连接互联网时,无线路由设备接收到浏览器用户基于虚拟地址的访问请求时,无线路由设备代替该虚拟地址对应的服务器即作为该服务器的代理与浏览器用户进行通信,浏览器用户认为是与此虚拟地址对应的服务器进行通信,实则是和无线路由设备进行通信。无线路由器此时是要把浏览器对于外网域名的访问都重定向到一个统一的设定网页比如网关的页面,让用户立即获知其未联网的状态,而不 会被现有浏览器缓存机制中基于已缓存的信息显示的页面所迷惑,提升用户的上网体验。In the embodiment of the present invention, when the wireless routing device receives the access request of the browser user based on the virtual address when the wireless routing device is not connected to the Internet, the wireless routing device replaces the server corresponding to the virtual address as the proxy and browser user of the server. To communicate, the browser user believes that the server corresponding to the virtual address communicates, and in fact communicates with the wireless routing device. At this time, the wireless router redirects the browser's access to the external domain name to a unified page such as a gateway, so that the user can immediately know the state of the network without being cached by the existing browser. The page displayed based on the cached information is confusing, improving the user's online experience.
本发明实施例还提供一种HTTP重定向装置,该装置的组成还包括关于联网状态的处理模块。The embodiment of the invention further provides an HTTP redirection device, the device further comprising a processing module about the networked state.
本发明实施例的HTTP重定向装置,应用于无线路由设备,如图4所示,所述装置,包括以下组成部分:The HTTP redirection device of the embodiment of the present invention is applied to a wireless routing device. As shown in FIG. 4, the device includes the following components:
1)状态检测模块100,配置为实时检测与互联网的连接状态;这一模块的执行时间将贯穿本发明实施例的整个HTTP重定向过程中。1) The state detection module 100 is configured to detect the connection state with the Internet in real time; the execution time of this module will be throughout the entire HTTP redirection process of the embodiment of the present invention.
2)未联网处理模块200,配置为在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。2) The non-network processing module 200 is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in the state that the Internet is not connected to the browser; When an access request is initiated based on the virtual address, the access request is redirected to a set web page.
在本发明实施例中,未联网处理模块200,还配置为保存在未连接互联网的状态下所述浏览器请求解析的外网域名;In the embodiment of the present invention, the non-network processing module 200 is further configured to save the external network domain name that the browser requests to parse in a state that is not connected to the Internet;
3)联网处理模块300,配置为在已连接互联网的状态下,基于保存的所述外网域名向所述浏览器提供对应的解析后的真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。3) The network processing module 300 is configured to provide a corresponding parsed real address to the browser based on the saved external network domain name in a state that the Internet is connected, so that the browser is based on the real address. Perform a redirect jump.
在本发明实施例中,在用户使用浏览器未退出的状态下,无线路由设备由未连接互联网的状态转变成连接互联网的状态,此时,无线路由设备侧的状态检测模块100仍在实时检测与互联网的连接状态,一旦发现连接互联网,则及时对已保存的在未连接互联网的状态下所述浏览器请求解析的所有外网域名进行逐个解析,如通过发给DNS(Domain Name System,域名系统)服务器进行解析,将解析得到的真实地址返回给浏览器,以供浏览器基于真实地址进行访问得到正确的网页信息。In the embodiment of the present invention, in a state where the user does not quit using the browser, the wireless routing device is changed from the state in which the Internet is not connected to the state in which the Internet is connected. At this time, the state detecting module 100 on the wireless routing device side is still detecting in real time. The connection status with the Internet, once the connection to the Internet is found, all the external domain names that the browser requests to resolve in the state of the Internet that is not connected to the Internet are analyzed in a timely manner, for example, by sending to the DNS (Domain Name System, domain name) The system) parses the server and returns the parsed real address to the browser for the browser to access the correct web page information based on the real address.
在一些实施例中,联网处理模块300,还配置为:In some embodiments, the network processing module 300 is further configured to:
在向所述浏览器提供所述真实地址的过程中,针对解析失败的外网域名,提供设定次数的重新解析操作。这样做可以针对联网后因网络信号弱以及DNS服务器响应慢等因素导致某个外网域名解析失败的情况,尽可能的增大真实地址的获取几率,满足用户的上网需求。In the process of providing the real address to the browser, a re-analysis operation of a set number of times is provided for the external network domain name that fails to be parsed. In this way, the network domain name resolution failure may be caused by factors such as weak network signal and slow response of the DNS server after the network connection, and the probability of obtaining the real address is increased as much as possible to meet the user's Internet access requirement.
在一些实施例中,联网处理模块300,还配置为:In some embodiments, the network processing module 300 is further configured to:
对解析失败的外网域名进行合法性检测,对于通过合法性检测的外网域名提供设定次数的重新解析操作。例如为合法的外网域名建立一个白名单,通过该白名单过滤到非法的外网域名,这样做可以避免一些非法的禁止访问的外网域名占用有限的网络资源。The legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality. For example, a whitelist is created for a legitimate external domain name, and the whitelist is filtered to an illegal external domain name. This can prevent some illegally prohibited external domain names from occupying limited network resources.
在一些实施例中,联网处理模块300,还配置为:In some embodiments, the network processing module 300 is further configured to:
在连接互联网的状态下,建立保存的所述外网域名、所述虚拟地址以及所述真实地址之间的对应关系;Establishing a stored correspondence between the external network domain name, the virtual address, and the real address in a state of connecting to the Internet;
当所述浏览器基于缓存的所述虚拟地址发起通信请求时,向所述浏览器提供所述虚拟地址对应的所述真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。When the browser initiates a communication request based on the cached virtual address, providing the browser with the real address corresponding to the virtual address, so that the browser performs a redirect jump based on the real address. .
该实现方式可以应用的场景是:针对浏览器开启时就处于连接互联网的状态且第二次访问所述虚拟地址对应的网页时,由于用户已经缓存有欲访问的外网域名对应的虚拟地址,按照现有的浏览器利用缓存的机制,会直接利用所述虚拟地址发起访问请求,此时无线路由设备不再像未联网时一样将该访问请求重定向跳转到设定网页,而是将所述该访问请求重定向跳转到真实地址对应的网页去。The scenario in which the implementation can be applied is: when the browser is in the state of connecting to the Internet when the browser is turned on and the webpage corresponding to the virtual address is accessed for the second time, since the user has already cached the virtual address corresponding to the external domain name to be accessed, According to the existing browser utilizing the cache mechanism, the virtual address is directly used to initiate an access request, and the wireless routing device no longer redirects the access request to the set webpage as if it was not connected to the network, but instead The access request redirects to the webpage corresponding to the real address.
本发明实施例还提供一种无线路由器,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现本发明实施例提供的上述HTTP重定向方法。Embodiments of the present invention also provide a wireless router including a memory, a processor, and a computer program stored on the memory and operable on the processor, the computer program being implemented by the processor to implement the present invention The above HTTP redirection method provided by the embodiment.
相关技术容易受到浏览器缓存的影响,导致用户在访问外网的过程中出现打不开页面,或者打开错误页面的现象。在浏览器缓存的影响下,在不关闭当前浏览器的情况下,浏览器会缓存该IP地址,当无线路由设备的联网状态切换后,后续域名访问请求不会快速重新发送DNS请求,而是直接用该缓存的IP发起传输控制协议(Transmission Control Protocol,TCP)三次握手,这样容易出现停留在之前的页面,无法打开正确页面的现象。The related technology is easily affected by the browser cache, which causes the user to open the page or open the wrong page during the process of accessing the external network. Under the influence of the browser cache, the browser caches the IP address without closing the current browser. After the networked state of the wireless routing device is switched, the subsequent domain name access request does not quickly resend the DNS request. Directly use the buffered IP to initiate the Transmission Control Protocol (TCP) three-way handshake, which is easy to appear on the previous page and cannot open the correct page.
本发明实施例能够克服上述的问题,实时监控用户的上网行为而启动对应的iptables路由转发规则,使得无线路由设备不论是在未联网还是联网的状态下,接入无线路由设备的用户使用浏览器访问页面都不会受到浏览器缓存的影响。采用本发明实施例的技术方案后,用户的上网行为被无线路由设备动态监控,不受限于浏览器缓存的影响,接入无线路由设备的用户可以访问正确的页面,提升用户体验。The embodiment of the present invention can overcome the above problems, and monitor the online behavior of the user in real time to start the corresponding iptables routing and forwarding rule, so that the wireless routing device accesses the wireless routing device to use the browser whether the network is not connected or connected. Accessing the page is not affected by the browser cache. After the technical solution of the embodiment of the present invention is used, the user's online behavior is dynamically monitored by the wireless routing device, and is not affected by the browser cache. The user accessing the wireless routing device can access the correct page and improve the user experience.
图5为本发明实施例提供的HTTP重定向方法流程示意图,如图5所示,本实施例HTTP重定向执行的流程,如下:FIG. 5 is a schematic flowchart of an HTTP redirection method according to an embodiment of the present invention. As shown in FIG. 5, the flow of HTTP redirection execution in this embodiment is as follows:
步骤S1:无线路由设备判断当前设备是否联网,如果联网,执行步骤S5,如果未联网,执行步骤S2。Step S1: The wireless routing device determines whether the current device is connected to the network. If the network is connected, step S5 is performed. If the network is not connected, step S2 is performed.
在实际实施时,无线路由设备检测本设备联网状态,根据联网状态初始化路由转发规则,添加或者删除相应的重定向转发规则。In actual implementation, the wireless routing device detects the networking state of the device, initializes a routing forwarding rule according to the networking state, and adds or deletes a corresponding redirect forwarding rule.
步骤S2:初始化路由规则,并通知内核开启HTTP重定向网关功能。Step S2: Initialize the routing rule and notify the kernel to enable the HTTP redirect gateway function.
在实际实施时,若当前无线路由设备未联网则初始化路由规则,清除联网时添加的路由重定向转发规则,根据当前无线路由设备未联网的状态,通知内核开启HTTP重定向网关功能,并将所有目的端口是80端口的HTTP请求报文重定向到网关地址,为步骤S3(包括S31-S33)模拟完成TCP三次握手做铺垫。后续终端侧浏览器与虚拟IP地址之间的三次握手实则是浏览器与无线路由设备之间的交互,因为只有当握手成功后,浏览器才会下发HTTP的GET请求报文,便于步骤S4对截获的HTTP的GET请求报文 进行处理。In actual implementation, if the current wireless routing device is not connected to the network, the routing rule is initialized, and the route redirection forwarding rule added during the networking is cleared, and according to the current state that the wireless routing device is not connected, the kernel is notified to enable the HTTP redirection gateway function, and all The destination port is the 80-port HTTP request packet redirected to the gateway address, paving the way for the TCP three-way handshake to be simulated in step S3 (including S31-S33). The three-way handshake between the subsequent terminal-side browser and the virtual IP address is actually the interaction between the browser and the wireless routing device, because the browser sends the HTTP GET request packet only after the handshake is successful, which is convenient for step S4. The intercepted HTTP GET request message is processed.
步骤S31:判断是否收到DNS请求,如果收到,执行步骤S32,如果未收到,执行步骤S33。Step S31: It is judged whether a DNS request is received, if yes, step S32 is performed, and if not received, step S33 is performed.
步骤S32:返回虚拟IP地址,然后执行步骤S33。Step S32: Returning the virtual IP address, and then performing step S33.
步骤S33:直接进行TCP三次握手。Step S33: Perform a TCP three-way handshake directly.
在实际实施时,无线路由设备监测当前是否收到浏览器针对外网域名的DNS请求,若收到则返回一个动态随机生成的虚拟IP地址,若浏览器发来基于虚拟IP地址时直接进行TCP三次握手。In actual implementation, the wireless routing device monitors whether the browser currently receives a DNS request for the external network domain name, and if received, returns a dynamically generated virtual IP address, and if the browser sends a virtual IP address based on the direct IP address. Three handshakes.
步骤S4:截获用户发起的HTTP GET请求报文,并完成HTTP重定向到网关功能。Step S4: intercepting the HTTP GET request packet initiated by the user, and completing the HTTP redirect to the gateway function.
通过Linux操作系统内核的hook钩子函数截获目的端口是80的HTTP GET请求报文,采用反馈HTTP 302的状态码的方式,模拟DNS服务器组建一条HTTP 302的响应报文,将网关地址填入到Location字段以使浏览器重新跳转到网关的URL中。The HTTP hook function of the Linux operating system kernel is used to intercept the HTTP GET request packet with the destination port being 80. The HTTP 300 status code is used to simulate the DNS server to form an HTTP 302 response message, and the gateway address is filled into the Location. Field to have the browser re-jump to the URL of the gateway.
步骤S5:初始化路由规则,并通知内核关闭联网前重定向网关功能。Step S5: Initialize the routing rule and notify the kernel to turn off the redirection gateway function before networking.
若当前无线路由设备联网则初始化路由规则,联网后清除联网前重定向到网关地址的规则,并根据联网状态通知Linux操作系统内核关闭HTTP重定向网关功能。If the current wireless routing device is networked, the routing rule is initialized, and the rule of redirecting to the gateway address before the network is cleared after the network is connected, and the Linux operating system kernel is notified to disable the HTTP redirecting gateway function according to the networking state.
步骤S6:放行截获的全部报文。Step S6: Release all the intercepted messages.
在实际实施时,将Linux操作系统内核的hook钩子函数获取的所有报文进行放行,不做任何处理。In actual implementation, all the messages obtained by the hook function of the Linux operating system kernel are released, and no processing is performed.
步骤S71:判断是否获取到虚拟IP对应的真实IP,如果是,执行步骤S75;否则,执行步骤S72。Step S71: It is determined whether the real IP corresponding to the virtual IP is obtained, and if yes, step S75 is performed; otherwise, step S72 is performed.
步骤S72:顺序选择解析失败的域名。Step S72: sequentially select the domain name that failed to be parsed.
步骤S73:校验域名是否合法,如果是,执行步骤S74;否则,执行步骤S72。Step S73: Verify that the domain name is legal. If yes, go to step S74; otherwise, go to step S72.
步骤S74:对解析失败的域名重新进行DNS解析,并判断三次解析是否均失败,如果三次解析均失败,执行步骤S72;否则,执行步骤S75。Step S74: Perform DNS resolution on the domain name that failed to be parsed, and determine whether the three parsing fails. If the three parsing fails, step S72 is performed; otherwise, step S75 is performed.
步骤S75:添加路由规则,IP地址重定向。Step S75: Add a routing rule and redirect the IP address.
无线路由设备将联网前浏览器访问过的外网域名依次解析为对应的真实IP地址,此时外网域名、虚拟IP地址、真实IP地址就有了唯一的对应关系。若存在外网域名解析失败,则优选的,对这些解析失败的域名进行遍历,先进行合法性检测,对于合法的域名再给予三次DNS域名解析的机会,更大几率的保证真实IP地址的获取。最后添加虚拟IP地址对应的真实IP地址下的路由重定向转发规则,防止因为浏览器缓存的影响无法正常打开用户要访问的页面。The wireless routing device resolves the external domain name accessed by the browser before the network to the corresponding real IP address. At this time, the external domain name, the virtual IP address, and the real IP address have a unique correspondence. If the domain name resolution fails, it is preferred to traverse the domain names that failed to be resolved. The legality detection is performed first. The DNS domain name resolution is given three times for the legal domain name, and the real IP address is guaranteed to be more likely. . Finally, the route redirection forwarding rule under the real IP address corresponding to the virtual IP address is added to prevent the page that the user wants to access from being opened normally due to the influence of the browser cache.
在本发明实施例中,Linux操作系统提供了强大的路由转发和数据流截获的功能,用路由转发来和hook截获HTTP的报文技术结合来解决浏览器DNS的缓存导致的问题,通过路由重定向转发规则和HTTP的跳转协议来实现相应的重定向功能。In the embodiment of the present invention, the Linux operating system provides powerful routing forwarding and data stream interception functions, and combines routing forwarding with hook intercepting HTTP packet technology to solve the problem caused by the browser DNS cache. Directed forwarding rules and HTTP jump protocols to implement the corresponding redirection function.
在无线路由设备未联网的状态下,添加相应的重定向转发规则,强制将所有目的端口是80端口的HTTP请求重定向到网关,模拟所有HTTP请求的TCP三次握手。若在标签页内的地址栏内输入某个外网域名时,无线路由设备发现此时网络断开,就会返回一个虚拟IP地址给浏览器,且此虚拟IP地址是动态随机产生的,浏览器访问的每个外网域名所对应的虚拟IP地址均不同,但是均为私网IP地址。浏览器与此虚拟IP地址对应的服务器进行通信实则是浏览器和无线路由设备进行通信,完成TCP三次握手后,在Linux操作系统内核里面挂一个hook钩子函数,用来监听截获HTTP的请求报文,并采用反馈HTTP 302的状态码的方式来使浏览器重定向到网关页面上。In the state where the wireless routing device is not connected to the network, the corresponding redirect forwarding rule is added to forcibly redirect all HTTP requests whose destination port is port 80 to the gateway, simulating the TCP three-way handshake of all HTTP requests. If an external domain name is entered in the address bar of the tab page, the wireless routing device finds that the network is disconnected, and a virtual IP address is returned to the browser, and the virtual IP address is dynamically generated. The virtual IP addresses corresponding to each external domain name accessed by the device are different, but they are all private network IP addresses. The browser communicates with the server corresponding to the virtual IP address. In fact, the browser communicates with the wireless routing device. After completing the TCP three-way handshake, a hook function is hooked in the Linux operating system kernel to listen for intercepted HTTP request packets. And use the feedback of the status code of HTTP 302 to redirect the browser to the gateway page.
无线路由设备联网后,将每个在联网前访问的域名依次解析为该网站对应真实IP地址,此时外网域名、虚拟IP地址、真实IP地址就有了唯一 的对应关系。同时再添加相应的重定向转发规则,将访问虚拟IP地址的HTTP请求重定向到真实IP地址。并且实时监控解析结果,联网后若因网络信号强度以及DNS服务器响应慢等因素导致无线路由设备内某个外网域名未能获得真实的IP地址,此时对此外网域名再次进行DNS解析获取真实IP地址,添加对应的重定向转发规则,保证访问虚拟IP地址的HTTP请求重定向到真实IP地址。确保接入无线路由设备的用户能在无线路由设备未联网状态和联网状态下来回切换时,只要不关闭当前浏览器,就可以不受浏览器缓存IP的影响;在浏览器不会快速重新发起新的DNS请求的情况下,浏览器依然能够正确显示用户要访问的外网页面。After the wireless routing device is connected to the network, each domain name accessed before the network is parsed into the real IP address of the website. In this case, the external domain name, virtual IP address, and real IP address have a unique correspondence. At the same time, add the corresponding redirect forwarding rule to redirect the HTTP request to access the virtual IP address to the real IP address. And the real-time monitoring and analysis results, if the network signal strength and the DNS server response are slow, etc., the network domain name of the wireless routing device fails to obtain the real IP address. IP address, add the corresponding redirect forwarding rule to ensure that the HTTP request to access the virtual IP address is redirected to the real IP address. Ensure that users accessing the wireless routing device can switch back and forth between the wireless router device and the networked state. As long as the current browser is not closed, it can be unaffected by the browser's cached IP; it will not be re-initiated quickly in the browser. In the case of a new DNS request, the browser can still correctly display the external web page that the user wants to access.
本发明实施例还提供一种存储介质,所述存储介质包括存储的程序,其中,所述程序运行时执行本发明实施例提供的HTTP重定向方法。在工程实现上,本发明实施例可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的HTTP请求重定向的流程可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如只读存储器(ROM,Read-Only Memory)/随机存取存储器(RAM,Random Access Memory)、磁碟、光盘)中,包括若干指令用以使得一台设备(可以是无线路由器等网络设备)执行本发明实施例的HTTP请求重定向的流程。The embodiment of the present invention further provides a storage medium, where the storage medium includes a stored program, where the program is executed to execute the HTTP redirection method provided by the embodiment of the present invention. In engineering implementation, the embodiment of the present invention can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is a better implementation. Based on this understanding, the flow of the HTTP request redirection of the present invention can be embodied in the form of a computer software product stored in a storage medium (such as Read-Only Memory (ROM)/random access memory). The memory (RAM, Random Access Memory), the disk, and the optical disk include a plurality of instructions for causing a device (which may be a network device such as a wireless router) to perform the HTTP request redirection process of the embodiment of the present invention.
通过具体实施方式的说明,应当可对本发明为达成预定目的所采取的技术手段及功效得以更加深入且具体的了解,然而所附图示仅是提供参考与说明之用,并非用来对本发明加以限制。The technical means and functions of the present invention for achieving the intended purpose can be more deeply and specifically understood by the description of the specific embodiments. However, the accompanying drawings are only for the purpose of illustration and description, and are not intended to limit.

Claims (16)

  1. 一种超文本传输协议HTTP重定向方法,包括:A hypertext transfer protocol HTTP redirection method, comprising:
    实时检测与互联网的连接状态;Real-time detection of the connection status with the Internet;
    在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;In the state that the Internet is not connected, the external network domain name that is parsed based on the browser request returns a virtual address corresponding to the external network domain name to the browser;
    当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。When the browser initiates an access request based on the virtual address, the access request is redirected to a set webpage.
  2. 根据权利要求1所述的HTTP重定向方法,其中,所述当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上,包括:The HTTP redirecting method according to claim 1, wherein the redirecting the access request to the setting webpage when the browser initiates the access request based on the virtual address comprises:
    接收到所述浏览器基于所述虚拟地址发起的访问请求时,与所述浏览器采用握手的方式建立连接;When receiving the access request initiated by the browser based on the virtual address, establishing a connection with the browser by using a handshake manner;
    建立连接成功后,利用操作系统内核监听并截获到所述浏览器发出的针对设定端口的HTTP访问请求报文时,将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上。After the connection is successfully established, when the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
  3. 根据权利要求2所述的HTTP重定向方法,其中,所述将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上,包括:The HTTP redirecting method according to claim 2, wherein the jumping the HTTP access request of the browser to the set port to the setting webpage comprises:
    通过向所述浏览器返回携带有所述设定网页地址信息的HTTP响应报文,来使所述浏览器跳转到访问所述设定网页。The browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
  4. 根据权利要求1所述的HTTP重定向方法,其中,所述方法还包括:The HTTP redirecting method according to claim 1, wherein the method further comprises:
    保存在未连接互联网的状态下所述浏览器请求解析的外网域名;The external domain name that the browser requests to parse in a state where the Internet is not connected;
    在已连接互联网的状态下,基于保存的所述外网域名向所述浏览器提供对应的解析后的真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。The browser provides a corresponding parsed real address to the browser based on the saved external network domain name, so that the browser performs a redirect jump based on the real address.
  5. 根据权利要求4所述的HTTP重定向方法,其中,所述方法还包括:The HTTP redirecting method of claim 4, wherein the method further comprises:
    在向所述浏览器提供所述真实地址的过程中,针对解析失败的外网域名,提供设定次数的重新解析操作。In the process of providing the real address to the browser, a re-analysis operation of a set number of times is provided for the external network domain name that fails to be parsed.
  6. 根据权利要求5所述的HTTP重定向方法,其中,所述针对解析失败的外网域名,提供设定次数的解析操作,包括:The HTTP redirection method according to claim 5, wherein the parsing failure of the external network domain name provides a set number of parsing operations, including:
    对解析失败的外网域名进行合法性检测,对于通过合法性检测的外网域名提供设定次数的重新解析操作。The legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality.
  7. 根据权利要求4所述的HTTP重定向方法,其中,所述方法还包括:The HTTP redirecting method of claim 4, wherein the method further comprises:
    在连接互联网的状态下,建立保存的所述外网域名、所述虚拟地址以及所述真实地址之间的对应关系;Establishing a stored correspondence between the external network domain name, the virtual address, and the real address in a state of connecting to the Internet;
    当所述浏览器基于缓存的所述虚拟地址发起访问请求时,向所述浏览器提供所述虚拟地址对应的所述真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。When the browser initiates an access request based on the cached virtual address, providing the browser with the real address corresponding to the virtual address, so that the browser performs a redirect jump based on the real address. .
  8. 一种超文本传输协议HTTP重定向装置,包括:A hypertext transfer protocol HTTP redirection device, comprising:
    联网检测模块,配置为实时检测与互联网的连接状态;a networked detection module configured to detect the connection status with the Internet in real time;
    未联网处理模块,配置为在未连接互联网的状态下,基于浏览器请求解析的外网域名向所述浏览器返回一个与所述外网域名对应的虚拟地址;当所述浏览器基于所述虚拟地址发起访问请求时,将所述访问请求重定向到设定网页上。The non-network processing module is configured to return, to the browser, a virtual address corresponding to the external network domain name based on the external network domain name that is parsed by the browser request in a state that is not connected to the Internet; when the browser is based on the When the virtual address initiates an access request, the access request is redirected to the set web page.
  9. 根据权利要求8所述的HTTP重定向装置,其中,所述未联网处理模块,配置为:The HTTP redirection device of claim 8, wherein the unnetworked processing module is configured to:
    接收到所述浏览器基于所述虚拟地址发起的访问请求时,与所述浏览器采用握手的方式建立连接;When receiving the access request initiated by the browser based on the virtual address, establishing a connection with the browser by using a handshake manner;
    建立连接成功后,利用操作系统内核监听并截获到所述浏览器发出的针对设定端口的HTTP访问请求报文时,将所述浏览器针对设定端口的HTTP访问请求跳转到设定网页上。After the connection is successfully established, when the operating system kernel listens and intercepts the HTTP access request message sent by the browser for the set port, the browser accesses the HTTP access request for the set port to the setting webpage. on.
  10. 根据权利要求9所述的HTTP重定向装置,其中,所述未联网处 理模块,还配置为:The HTTP redirection device of claim 9, wherein the unnetworked processing module is further configured to:
    通过向所述浏览器返回携带有所述设定网页地址信息的HTTP响应报文,来使所述浏览器跳转到访问所述设定网页。The browser is caused to jump to access the set webpage by returning an HTTP response message carrying the set webpage address information to the browser.
  11. 根据权利要求8所述的HTTP重定向装置,其中,所述未联网处理模块,还配置为保存在未连接互联网的状态下所述浏览器请求解析的外网域名;The HTTP redirection device according to claim 8, wherein the non-network processing module is further configured to save an external network domain name that the browser requests to parse in a state in which the Internet is not connected;
    所述装置,还包括:The device further includes:
    联网处理模块,配置为在已连接互联网的状态下,基于保存的所述外网域名向所述浏览器提供对应的解析后的真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。a network processing module, configured to provide a corresponding parsed real address to the browser based on the saved external network domain name in a state that the Internet is connected, for the browser to perform redirection based on the real address Jump.
  12. 根据权利要求11所述的HTTP重定向装置,其中,所述联网处理模块,还配置为:The HTTP redirection device of claim 11, wherein the network processing module is further configured to:
    在向所述浏览器提供所述真实地址的过程中,针对解析失败的外网域名,提供设定次数的重新解析操作。In the process of providing the real address to the browser, a re-analysis operation of a set number of times is provided for the external network domain name that fails to be parsed.
  13. 根据权利要求12所述的HTTP重定向装置,其中,所述联网处理模块,还配置为:The HTTP redirection device of claim 12, wherein the network processing module is further configured to:
    对解析失败的外网域名进行合法性检测,对于通过合法性检测的外网域名提供设定次数的重新解析操作。The legality detection of the external domain name that failed the parsing is performed, and the re-analysis operation of the set number of times is provided for the external network domain name detected by the legality.
  14. 根据权利要求11所述的HTTP重定向装置,其中,所述联网处理模块,还配置为:The HTTP redirection device of claim 11, wherein the network processing module is further configured to:
    在连接互联网的状态下,建立保存的所述外网域名、所述虚拟地址以及所述真实地址之间的对应关系;Establishing a stored correspondence between the external network domain name, the virtual address, and the real address in a state of connecting to the Internet;
    当所述浏览器基于缓存的所述虚拟地址发起通信请求时,向所述浏览器提供所述虚拟地址对应的所述真实地址,以供所述浏览器基于所述真实地址进行重定向跳转。When the browser initiates a communication request based on the cached virtual address, providing the browser with the real address corresponding to the virtual address, so that the browser performs a redirect jump based on the real address. .
  15. 一种无线路由设备,包括:A wireless routing device comprising:
    通信模块,配置为与用户侧浏览器进行通信交互;a communication module configured to communicate with a user side browser;
    存储器,配置为存储有超文本传输协议HTTP重定向程序;以及,a memory configured to store a hypertext transfer protocol HTTP redirector; and,
    处理器,配置为执行所述HTTP重定向程序以实现如权利要求1至7中任一项所述的HTTP重定向方法。A processor configured to execute the HTTP redirector to implement the HTTP redirect method of any one of claims 1-7.
  16. 一种存储介质,所述存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述的超文本传输协议HTTP重定向方法。A storage medium storing a computer program, the computer program being executed by a processor to implement the hypertext transfer protocol HTTP redirection method according to any one of claims 1 to 7.
PCT/CN2019/083604 2018-05-17 2019-04-22 Hypertext transfer protocol redirecting method, device, routing device and storage medium WO2019218845A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810475748.5 2018-05-17
CN201810475748.5A CN108712492A (en) 2018-05-17 2018-05-17 A kind of HTTP redirection method, apparatus, routing device and computer storage media

Publications (1)

Publication Number Publication Date
WO2019218845A1 true WO2019218845A1 (en) 2019-11-21

Family

ID=63868287

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/083604 WO2019218845A1 (en) 2018-05-17 2019-04-22 Hypertext transfer protocol redirecting method, device, routing device and storage medium

Country Status (2)

Country Link
CN (1) CN108712492A (en)
WO (1) WO2019218845A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111770168A (en) * 2020-06-28 2020-10-13 杭州迪普科技股份有限公司 Webpage redirection protection method and device and electronic equipment
CN114884730A (en) * 2022-05-07 2022-08-09 深信服科技股份有限公司 Request detection method, device, equipment and readable storage medium
CN115277837A (en) * 2022-07-22 2022-11-01 杭州迪普科技股份有限公司 Redirection method and device based on proxy
CN115378905A (en) * 2022-07-22 2022-11-22 北京华顺信安科技有限公司 Domain name collection method, device, equipment and computer readable storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108712492A (en) * 2018-05-17 2018-10-26 中兴通讯股份有限公司 A kind of HTTP redirection method, apparatus, routing device and computer storage media
CN109495600B (en) * 2018-11-19 2022-04-29 北京知道创宇信息技术股份有限公司 Website access method and device and readable storage medium
CN113613274B (en) * 2021-09-01 2023-08-18 四川九州电子科技股份有限公司 Intelligent access configuration method based on Mesh networking
CN115118775B (en) * 2022-06-21 2023-04-25 杭州迪普科技股份有限公司 Browser access request processing method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101741769A (en) * 2008-11-25 2010-06-16 华为终端有限公司 Redirection method for gateway and webpage
CN104243506A (en) * 2013-06-06 2014-12-24 中兴通讯股份有限公司 Browser redirection method and device
CN105338072A (en) * 2015-10-20 2016-02-17 上海斐讯数据通信技术有限公司 HTTP (hyper text transport protocol) redirecting method and routing equipment
US20180070231A1 (en) * 2016-09-02 2018-03-08 Blackberry Limited Method and device for facilitating authentication over a wireless network
CN108712492A (en) * 2018-05-17 2018-10-26 中兴通讯股份有限公司 A kind of HTTP redirection method, apparatus, routing device and computer storage media

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040054898A1 (en) * 2002-08-28 2004-03-18 International Business Machines Corporation Authenticating and communicating verifiable authorization between disparate network domains
CN101478387B (en) * 2008-12-31 2012-02-15 成都市华为赛门铁克科技有限公司 Defense method, apparatus and system for hyper text transmission protocol attack
US10007925B2 (en) * 2011-03-02 2018-06-26 Genband Us Llp Local advertisement insertion through web request redirection
CN105592175A (en) * 2014-10-24 2016-05-18 中兴通讯股份有限公司 Method and apparatus for redirection to web page

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101741769A (en) * 2008-11-25 2010-06-16 华为终端有限公司 Redirection method for gateway and webpage
CN104243506A (en) * 2013-06-06 2014-12-24 中兴通讯股份有限公司 Browser redirection method and device
CN105338072A (en) * 2015-10-20 2016-02-17 上海斐讯数据通信技术有限公司 HTTP (hyper text transport protocol) redirecting method and routing equipment
US20180070231A1 (en) * 2016-09-02 2018-03-08 Blackberry Limited Method and device for facilitating authentication over a wireless network
CN108712492A (en) * 2018-05-17 2018-10-26 中兴通讯股份有限公司 A kind of HTTP redirection method, apparatus, routing device and computer storage media

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111770168A (en) * 2020-06-28 2020-10-13 杭州迪普科技股份有限公司 Webpage redirection protection method and device and electronic equipment
CN114884730A (en) * 2022-05-07 2022-08-09 深信服科技股份有限公司 Request detection method, device, equipment and readable storage medium
CN114884730B (en) * 2022-05-07 2023-12-29 深信服科技股份有限公司 Request detection method, device, equipment and readable storage medium
CN115277837A (en) * 2022-07-22 2022-11-01 杭州迪普科技股份有限公司 Redirection method and device based on proxy
CN115378905A (en) * 2022-07-22 2022-11-22 北京华顺信安科技有限公司 Domain name collection method, device, equipment and computer readable storage medium
CN115277837B (en) * 2022-07-22 2023-04-25 杭州迪普科技股份有限公司 Agent-based redirection method and device
CN115378905B (en) * 2022-07-22 2023-11-14 北京华顺信安科技有限公司 Domain name collection method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN108712492A (en) 2018-10-26

Similar Documents

Publication Publication Date Title
WO2019218845A1 (en) Hypertext transfer protocol redirecting method, device, routing device and storage medium
US10904204B2 (en) Incompatible network gateway provisioned through DNS
CN109067914B (en) web service proxy method, device, equipment and storage medium
KR101232768B1 (en) Process for managing resource address requests and associated gateway device
US9319315B2 (en) Distributing transmission of requests across multiple IP addresses of a proxy server in a cloud-based proxy service
US9294541B2 (en) Method and system for correlation of session activities to a browser window in a client-server enviroment
WO2020035046A1 (en) Access authentication method and device, and authentication apparatus
EP2830280B1 (en) Web caching with security as a service
US20120297457A1 (en) Interactive Malware Detector
US8924505B2 (en) Method and device for configuring a user agent to operate as a web server
CN104506802B (en) The method of video monitoring system, passing through NAT monitor video data
CN110557358A (en) Honeypot server communication method, SSLStrip man-in-the-middle attack perception method and related device
CN105338072A (en) HTTP (hyper text transport protocol) redirecting method and routing equipment
US7599365B1 (en) System and method for detecting a network packet handling device
KR101281160B1 (en) Intrusion Prevention System using extract of HTTP request information and Method URL cutoff using the same
CN108418847A (en) A kind of network traffic cache system, method and device
JP2011100207A (en) Remote access device, program, method and system
CN110995763B (en) Data processing method and device, electronic equipment and computer storage medium
CN112870692A (en) Game acceleration method, acceleration system, acceleration device and storage medium
JP6623702B2 (en) A network monitoring device and a virus detection method in the network monitoring device.
EP3185510B1 (en) Method for data packet inspection, related device and computer-program product
Secci et al. ONOS Security & Performance Analysis (Report No. 1)
KR101266171B1 (en) Defense apparatus and method for distributed denial of service attacks
US8817800B2 (en) Gateway with HTTP processing
JP6733915B2 (en) Router device, upper web filtering detection method, and upper web filtering detection program

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: 19802652

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 16.04.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19802652

Country of ref document: EP

Kind code of ref document: A1