WO2021042815A1 - Http重定向状态码捕获方法、装置和计算机设备 - Google Patents

Http重定向状态码捕获方法、装置和计算机设备 Download PDF

Info

Publication number
WO2021042815A1
WO2021042815A1 PCT/CN2020/096996 CN2020096996W WO2021042815A1 WO 2021042815 A1 WO2021042815 A1 WO 2021042815A1 CN 2020096996 W CN2020096996 W CN 2020096996W WO 2021042815 A1 WO2021042815 A1 WO 2021042815A1
Authority
WO
WIPO (PCT)
Prior art keywords
status code
response message
message
response
redirection
Prior art date
Application number
PCT/CN2020/096996
Other languages
English (en)
French (fr)
Inventor
蔡森林
费渠钢
陈嵚
Original Assignee
苏宁易购集团股份有限公司
苏宁云计算有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏宁易购集团股份有限公司, 苏宁云计算有限公司 filed Critical 苏宁易购集团股份有限公司
Priority to CA3153431A priority Critical patent/CA3153431A1/en
Publication of WO2021042815A1 publication Critical patent/WO2021042815A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • 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]

Definitions

  • This application relates to the field of Internet technology, and in particular to a method, device, computer equipment, and storage medium for capturing Http redirection status codes.
  • a small program refers to an application that can be used on other platforms (such as WeChat platform, Baidu platform and Toutiao platform) without downloading and installing.
  • restricted resources In the Web system, based on security considerations, many requests require users to be logged in (referred to as restricted resources). When dealing with restricted resources, a common practice is to force a jump to the login page when it is determined that the user is not in the login state. However, because the underlying request of the applet is not like a browser request, the request of the applet does not support the Http (Hypertext Transfer Protocol) redirection status code.
  • Http Hypertext Transfer Protocol
  • a method for capturing Http redirection status code includes:
  • the first status code is the status code in the response header of the first response message
  • the first response message is the Http response message returned by the business system after the Http request is initiated to the business system
  • the first status code is a redirection status code
  • a second response message is returned, and the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the header of the second response message described above carries a second status code
  • the second status code is a status code supported by the receiver and different from the first status code
  • constructing the second response message according to the preset message protocol format and the first status code includes: When the status code is directed, the network location information in the response header of the first response message is acquired; the second response message is constructed according to the preset message protocol format, the first status code, and the network location information.
  • the body of the message also carries network location information.
  • constructing the second response message according to the preset message protocol format and the first status code includes: When the status code is directed, the network location information in the response header of the first response message and the cookie data in the response header of the first response message are obtained; according to the preset message protocol format, the first status code, and the network location information And Cookie data to construct a second response message.
  • the message body of the second response message also carries network location information and Cookie data.
  • the above method further includes:
  • the received response message When the received response message satisfies the user agent screening rule or/and the description information screening rule, the received response message is used as the first response message, and the step of obtaining the first status code is entered.
  • the above method further includes:
  • the first response message is returned.
  • the above-mentioned method is applied to a gateway, and the above-mentioned receiver is a terminal, and an applet application runs on the terminal, and the applet application obtains the redirection status code according to the message protocol format.
  • a method for capturing Http redirection status code includes:
  • the redirection status code carried in the body of the second response message is obtained according to the preset message protocol format, and the redirection status code is the first state Code, the second response message is constructed according to the message protocol format and the first status code.
  • a device for capturing Http redirection status codes comprising:
  • the status code acquisition module is used to acquire the first status code, the first status code is the status code in the response header of the first response message, and the first response message is the Http returned by the business system after the Http request is initiated to the business system Response message
  • the message construction module is used to construct a second response message according to the preset message protocol format and the first status code when the first status code is the redirection status code, and the first status code is carried in the second response message In the body of the text;
  • the return module is used to return a second response message, and the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • a computer device includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the following steps when the processor executes the computer program:
  • the first status code is the status code in the response header of the first response message
  • the first response message is the Http response message returned by the business system after the Http request is initiated to the business system
  • the first status code is a redirection status code
  • a second response message is returned, and the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • a computer device includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the following steps when the processor executes the computer program:
  • the redirection status code carried in the body of the second response message is obtained according to the preset message protocol format, and the redirection status code is the first state Code, the second response message is constructed according to the message protocol format and the first status code.
  • the computer program is executed by a processor, the following steps are implemented:
  • the first status code is the status code in the response header of the first response message
  • the first response message is the Http response message returned by the business system after the Http request is initiated to the business system
  • the first status code is a redirection status code
  • a second response message is returned, and the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the computer program is executed by a processor, the following steps are implemented:
  • the redirection status code carried in the body of the second response message is obtained according to the preset message protocol format, and the redirection status code is the first state Code, the second response message is constructed according to the message protocol format and the first status code.
  • the above-mentioned method, device, computer equipment and storage medium for capturing Http redirection status code are to obtain the first status code, the first status code is the status code in the response header of the first response message, and the first response message is the service
  • the first status code is the status code in the response header of the first response message
  • the first response message is the service
  • a second response message is constructed according to the preset message protocol format and the first status code.
  • the status code is carried in the body of the second response message, and the second response message is returned.
  • the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the response message is converted according to the preset message protocol format, and the redirection status code that is not originally supported by the receiver is carried in the message body of the second response message, and the second response message is obtained.
  • the receiver for example, the applet
  • the redirection status code according to the message protocol format. In this way, there is no need to call the user login status judgment interface on the server side. On the one hand, the frequency of calling the user login status judgment interface can be reduced, and on the other hand, the response delay can also be reduced, and the user experience can be improved.
  • Figure 1-1 is an application environment diagram of a method for capturing Http redirection status codes in an embodiment
  • Figure 1-2 is an application environment diagram of the Http redirection status code capture method in an embodiment
  • Figure 2 is a schematic flowchart of a method for capturing Http redirection status codes in an embodiment
  • FIG. 3 is a schematic flowchart of a second response message construction step in an embodiment
  • FIG. 5 is a schematic flowchart of a method for capturing Http redirection status codes in another embodiment
  • FIG. 6 is a schematic flowchart of a method for capturing Http redirection status codes in another embodiment
  • FIG. 7 is a schematic flowchart of a method for capturing Http redirection status codes in another embodiment
  • FIG. 8 is a structural block diagram of a device for capturing Http redirection status codes in an embodiment
  • FIG. 9 is a structural block diagram of a device for capturing Http redirection status codes in another embodiment
  • Figure 10 is an internal structure diagram of a computer device in an embodiment
  • Figure 11 is a diagram of the internal structure of a computer device in another embodiment
  • Fig. 12 is a diagram of the internal structure of a computer device in another embodiment.
  • first, second, etc. used in this application can be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element.
  • first client can be referred to as the second client
  • second client can be referred to as the first client. Both the first client and the second client are clients, but they are not the same client.
  • or/and used in this application describes the association relationship of associated objects, indicating that there can be three types of relationships, for example, A or/and B can mean that A alone exists, and both A and A exist at the same time. B, there are three cases of B alone.
  • the character "/" generally indicates that the associated objects before and after are in an "or” relationship.
  • the Http redirection status code capture method provided by this application can be applied to the application environment shown in Figure 1-1.
  • the application environment includes a terminal 102, a network 104, and a business system 106, and the terminal 102 and the business system 106 can be connected to each other through the network 104 for communication.
  • the network system composed of the terminal 102, the network 104, and the server 106 may be based on the Internet, or a local area network, or a combined network of the Internet and a local area network, which will not be repeated here.
  • the terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. Meanwhile, FIG. 1-1 shows a case where the terminal 102 includes two terminals such as a terminal 1022 and a terminal 1024, but the present application does not limit the number of terminals 102, and may include more or fewer terminals.
  • An applet application refers to an application that can be used without downloading and installing, for example, a WeChat applet running in a WeChat environment, and a Baidu applet running in a Baidu environment.
  • the network 104 is used to implement a network connection between the terminal 102 and the service system 106, and may include multiple types of wired or wireless networks.
  • the network 104 may include the Internet, a local area network ("LAN”), a wide area network ("WAN"), an intranet, a mobile phone network, a virtual private network (VPN), a cellular or other mobile communication network, Bluetooth, NFC, or any combination thereof .
  • the data transmission on the network 104 is also based on the corresponding communication protocol. For example, when the web browser receives the corresponding service code of the webpage, it will be based on the HTTP communication protocol, and the service code received by the mobile application may be based on the Websocket communication protocol.
  • the business system 106 may include one or more servers.
  • the business system 106 includes two servers such as a server 1062 and a server 1064.
  • this application does not limit the number of servers.
  • Each server can be implemented as an independent server or a server cluster composed of multiple servers.
  • the Http redirection status code capture method provided by this application can also be applied to the application environment shown in Figure 1-2.
  • the application environment may also include a gateway 108.
  • the gateway 108 deploys a gateway layer, which is generally one layer before the WEB server.
  • the gateway 108 uniformly converts the redirection response of the business system to the applet running on each terminal to ensure that the applet running on each terminal can respond to the redirection status code of the business system.
  • the number of business systems 106 may also be multiple. Multiple service systems 106 correspond to the same gateway.
  • a method for capturing Http redirection status code is provided. Taking the method applied to the gateway in Fig. 1-2 as an example, the method includes the following steps:
  • Step 202 Obtain a first status code, where the first status code is the status code in the response header of the first response message, and the first response message is the response message returned by the business system after the Http request is initiated to the business system;
  • the status code refers to the status code, generally refers to the 3-digit code assigned to the received request (for example, web page click), generally Http Status Code (Http Status Code), Http status code is used to indicate that the web server is over The 3-digit code of the text transfer protocol response status.
  • the Http request is used to request the first response message.
  • the service system obtains a first response message according to the service request; the gateway initiates an Http request to the service system to obtain the first response message After obtaining the first response message, obtain the status code in the response header of the first response message, that is, the first status code.
  • Step 204 When the first status code is the redirection status code, construct a second response message according to the preset message protocol format and the first status code, and the first status code is carried in the body of the second response message in;
  • redirection status codes generally refer to status codes related to redirection in HTTP status codes, for example, status codes such as 301, 302, 303, and 307.
  • Redirect is to redirect various network requests to other locations through various methods, such as web page redirection or domain name redirection.
  • the message protocol format is a message protocol format agreed in advance between the gateway and the following recipients, and the message protocol format includes at least a configuration mode of the first status code.
  • the gateway first determines whether the first status code is a redirection status code, and if so, it constructs a second response message according to the preset message protocol format and the first status code, where the first status code is carried in the first status code. 2. In the body of the response message. According to needs, the process of judging whether the first status code is a redirection status code can also be completed by other devices, and the gateway obtains the judgment result.
  • Step 206 Return a second response message, where the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the gateway returns a second response message to the terminal (or a small program running on the terminal),
  • the first status code is obtained, the first status code is the status code in the response header of the first response message, and the first response message is the business system after the HTTP request is initiated to the business system.
  • the first status code is the redirection status code
  • a second response message is constructed according to the preset message protocol format and the first status code, and the first status code is carried in the second response
  • a second response message is returned, and the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the response message is converted according to the preset message protocol format, and the redirection status code that is not originally supported by the receiver is carried in the body of the second response message, and the second response message is obtained.
  • the recipient for example, the applet
  • the header of the second response message described above carries a second status code
  • the second status code is a status code supported by the receiver and different from the first status code
  • the second status code may be a 200 status code, and the 200 status code indicates that the request has been successfully processed.
  • the second status code can also be other status codes other than the 200 status code, for example, other 2xx status codes.
  • the second response message is constructed according to the preset message protocol format and the first status code, which may include the following step:
  • Step 302 When the first status code is the redirection status code, obtain the network location information in the response header of the first response message;
  • the network location information may also be referred to as webpage address information, which is the address of a standard resource on the Internet.
  • the network location information is often the Location in the response header of the response message.
  • the gateway first determines whether the first status code is a redirection status code, and if so, it acquires the network location information in the response header of the first response message.
  • Step 304 Construct a second response message according to the preset message protocol format, the first status code and the network location information, and the message body of the second response message also carries the network location information.
  • the message protocol format also includes the configuration mode of the message protocol format.
  • the network location information is used as the redirected webpage address information (redirectUrl).
  • the gateway may configure the first status code and network location information in the body of the second response message according to a preset message protocol format.
  • the first status code and network location information can be configured in the same message body.
  • the first status code and network location information can also be configured in different message bodies. in.
  • the body of the second response message also carries network location information, it is convenient for the terminal (or a small program running on the terminal) to initiate a call to change the network location information (ie, redirect) .
  • the message protocol format and the first status code to construct the second response message may include the following steps:
  • Step 402 When the first status code is the redirection status code, obtain the network location information in the response header of the first response message and the Cookie data in the response header of the first response message;
  • Cookie sometimes also used in its plural form, refers to the data (usually encrypted) stored on the user's local terminal by certain websites in order to identify the user's identity and perform session tracking.
  • Step 404 Construct a second response message according to the preset message protocol format, first status code, network location information, and cookie data.
  • the body of the second response message also carries network location information and cookie data. .
  • Using the solution of this embodiment can further facilitate the terminal (or a small program running on the terminal) to initiate a call to change the network location information.
  • a method for capturing Http redirection status code is provided. Taking the method applied to the gateway in FIG. 1 as an example for description, the method includes the following steps:
  • Step 502 Screen the received response messages according to preset user agent screening rules or/and description information screening rules;
  • both user agent screening rules and description information screening rules can be set according to actual needs. For example, a user agent identification set is set, and if the user agent identification corresponding to the received response message is one of the user agent identification sets, it is determined that the user agent screening rule is satisfied.
  • a description information set can also be set, and if the description information corresponding to the received response message matches any piece of description information in the description information set, it is determined that the description information screening rule is satisfied.
  • Step 504 When the received response message meets the user agent screening rule or/and the description information screening rule, use the received response message as the first response message;
  • Step 506 Obtain a first status code, where the first status code is the status code in the response header of the first response message, and the first response message is the response message returned by the business system after the Http request is initiated to the business system;
  • Step 508 When the first status code is the redirection status code, construct a second response message according to the preset message protocol format and the first status code, and the first status code is carried in the body of the second response message in;
  • Step 510 Return a second response message, where the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • step 506, step 508, and step 510 can be correspondingly referred to the description of step 202, step 204, and step 206, which will not be repeated here.
  • the received response message is filtered, which can save the traffic consumed by the applet terminal.
  • the method for capturing the Http redirection status code of the present application may further include the step of returning a first response message when the first status code is a non-redirection status code.
  • non-redirection status code refers to a status code that is not related to redirection.
  • the first response message when the first status code is a non-redirection status code, the first response message is not modified, and the first response message is directly returned to the recipient.
  • the receiver can process the first response message directly returned according to the original business processing logic.
  • the Http redirection status code capture method of this application is applied to the gateway as an example.
  • the above-mentioned receiver is the terminal, and there is a small program application running on the terminal, and a small program.
  • the program application obtains the redirection status code according to the message protocol format as an example for description.
  • the Http redirection status code capture method in the above embodiments can also be applied to the business system or one or more servers in the business system in Figure 1-1 or Figure 1-2, that is, the above
  • the execution subject of each step in each of the embodiments is the business system or one or more servers in the business system.
  • the gateway can uniformly convert the redirection response of each applet to the response message, so that each applet running on each terminal can respond to the redirection status code of the business system. On the one hand, it does not need Calling the server's interface to determine the user's login status has no intrusion into the service of the server. On the other hand, there is no need for each server to be configured separately to realize the redirection response conversion, which can save configuration costs.
  • a method for capturing Http redirection status codes is provided, and the method is applied to FIG. 1-1 or FIG. 1-
  • the terminal in 2 is taken as an example for description.
  • Step 602 Receive a response message
  • Step 604 When it is determined that the received response message is the second response message, obtain the redirection status code carried in the body of the second response message according to the preset message protocol format, the redirection status code It is the first status code, and the second response message is constructed according to the message protocol format and the first status code.
  • the original processing logic of the first response message is processed according to the applet application.
  • a redirection request can be initiated according to the network location information, and when the body of the second response message also carries cookie data, a redirection request is initiated.
  • the cookie data is carried in the response header of.
  • the interaction between the gateway and the applet application (hereinafter referred to as the applet terminal) is taken as an example for description.
  • the message protocol format in this embodiment is: ⁇ "code”: “redirection status code”, “redirectUrl”: “Location”, “cookie”: “Cookie” ⁇ .
  • the constraint return result is a message protocol in json format, that is, the message protocol format, where json is a lightweight data exchange format.
  • the code in the message protocol format is the status code (Status) in the response header that requests the business system to redirect, such as 301, 302, etc.
  • redirectUrl is the network location information (Location) in the response header that requests the business system to redirect.
  • Cookie is the cookie in the response header that requests the business system to redirect.
  • the unified gateway for small programs can be built using OpenResty (nginx+lua).
  • the gateway layer is used by small programs. At the unified access layer, it can be restricted by user agent (userAgent) and description information (refer) It is the traffic of the applet that reaches the unified gateway of the applet.
  • the gateway layer uses the httpc library to call the downstream business system interface and parses the response header of the business system interface. When the response code in the response header is the redirect status code, it will respond The status code, network location information, and Cookie in the header are returned in the body of the response message according to the message protocol format described above, and the status code for the response message is 200.
  • code is the response status code that marks the real business
  • redirectUrl is the Location in the redirect response header, which is convenient for the applet to initiate a call to the URL next time
  • cookie is the cookie in the response header of the first request, because in the request When redirecting (redirectUrl), the cookie requested last time needs to be carried.
  • the applet knows the actual status code returned by the business system by returning the code in the json formatted message. If it finds that it is a redirected status code, it takes the cookie in the json formatted message and puts it in the request header, and requests the redirectUrl in json Address to get back the business data.
  • the gateway layer can use the httpc of nginx+lua to initiate the http request of the business system.
  • the method for capturing the Http redirection status code in this embodiment includes the following steps:
  • Step 702 The gateway judges whether the status code in the response message of the service system is a redirection status code, if yes, go to step 704, if not, go to step 706;
  • the response message of the business system is equivalent to the aforementioned first message.
  • the applet sends a business request to the business system
  • the business system obtains a response message according to the business request
  • the gateway requests the response message from the business system.
  • the gateway can use httpclient to call the interface URL of the business system.
  • the gateway layer obtains the status code in the response header of the response message of the service system, and judges whether it is the status code related to redirection (301, 302, 303, 307, etc.).
  • Step 704 The gateway obtains the status code, network location information, and Cookie in the response header of the response message of the service system, constructs and returns a message with 200 as the status code according to the corresponding value according to the agreed message protocol format.
  • the status code (Status), network location information (Location), and Cookie in the response header of the response message of the business system can be obtained, and the corresponding values of the status code, network location information, and Cookie can be obtained in accordance with the agreed protocol format, Construct a message with 200 as the status code: ⁇ "code”: “redirection status code”, “redirectUrl”: “Location”, “cookie” Cookie” ⁇ and return.
  • the gateway if the status code is a non-redirection status code, the gateway returns a response message from the service system.
  • Step 708 The applet receives the response message sent by the gateway, and parses the response header information of the received response message;
  • Step 710 When receiving a non-redirected response message, the applet terminal performs processing according to the business processing logic corresponding to the response message;
  • Step 712 When receiving a redirected response message, the applet terminal initiates a redirection request according to the network location information in the body of the response message.
  • the cookie is set in the request header of the redirection request, and a redirection request in which the network location information in the body of the response message is the new address information is initiated.
  • the gateway layer built by OpenResty captures the http redirect status code and returns the agreed protocol ⁇ "code”: “redirect status code”, “redirectUrl”: “Location”, “cookie” Cookie” ⁇ , which can be used Lua's httpc library parses the Status, Location, and Cookie data in the response header of the http protocol interface, and returns the result according to the constraint protocol.
  • the redirection response of the business system is converted into a 200 status code the response to.
  • a device for capturing Http redirection status codes including: a status code acquisition module 802, a message construction module 804, and a return module 806, wherein:
  • the status code acquisition module 802 is used to acquire the first status code, the first status code is the status code in the response header of the first response message, and the first response message is the response message returned by the business system after the Http request is initiated to the business system Http response message;
  • the message construction module 804 is configured to construct a second response message according to the preset message protocol format and the first status code when the first status code is the redirection status code, and the first status code is carried in the second response In the body of the message;
  • the header of the second response message carries a second status code
  • the second status code is a status code supported by the receiver and different from the first status code
  • the return module 806 is configured to return a second response message, and the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the message construction module 804 obtains the network location information in the response header of the first response message, according to the preset message protocol format and the first state Code and network location information to construct a second response message, and the message body of the second response message also carries the network location information.
  • the message construction module 804 obtains the network location information in the response header of the first response message and the Cookie data in the response header of the first response message when the first status code is the redirection status code.
  • the first status code, the network location information, and the cookie data According to the preset message protocol format, a second response message is constructed, and the message body of the second response message also carries the network location information.
  • the aforementioned Http redirection status code capture device further includes a message screening module, which is used to respond to the received response according to preset user agent screening rules or/and description information screening rules. Messages are screened, and the status code acquisition module 802 takes the received response message as the first response when the screening result of the message screening module is that the received response message meets the user agent screening rule or/and the description information screening rule Message, get the first status code.
  • a message screening module which is used to respond to the received response according to preset user agent screening rules or/and description information screening rules. Messages are screened, and the status code acquisition module 802 takes the received response message as the first response when the screening result of the message screening module is that the received response message meets the user agent screening rule or/and the description information screening rule Message, get the first status code.
  • the aforementioned return module 806 is further configured to return the first response message when the first status code is a non-redirection status code.
  • the above-mentioned device is applied to the gateway layer, and the above-mentioned receiver is a terminal, and an applet application runs on the terminal, and the applet application obtains the redirection status code according to the message protocol format.
  • a device for capturing Http redirection status code including: a communication module 902 and a status code capturing module 904, wherein:
  • the communication module 902 is used to receive response messages
  • the status code capture module 904 is configured to obtain the redirection status code carried in the body of the second response message according to the preset message protocol format when it is determined that the received response message is the second response message,
  • the redirection status code is the first status code
  • the second response message is constructed according to the message protocol format and the first status code.
  • the header of the second response message described above carries a second status code
  • the second status code is a status code supported by the receiver and different from the first status code
  • the header of the second response message also carries network location information, or the header of the second response message also carries network location information and Cookie data.
  • Each module in the above-mentioned Http redirection status code capturing device can be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 10.
  • the computer equipment includes a processor, a memory, and a network interface connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for capturing the Http redirection status code is realized.
  • a computer device may be a gateway, and its internal structure diagram may be as shown in FIG. 11.
  • the computer device may include one or more of the following components: a processor, a memory, and a transceiver, and the processor, the memory, and the transceiver may be connected by a data bus.
  • the processor may include one or more processing cores.
  • the processor uses various interfaces and lines to connect the various parts of the entire gateway, and executes each access to the gateway by running or executing instructions, programs, code sets, or instruction sets stored in the memory, and calling data stored in the memory.
  • the processor may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor can integrate one or a combination of a central processing unit (Central Processing Unit, CPU) and a modem.
  • the CPU mainly deals with operating systems and application programs, etc.; the modem is used to deal with wireless communication. It is understandable that the above-mentioned modem may not be integrated into the processor, but may be implemented by a chip alone.
  • a computer device which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor executes the computer program, the following steps are implemented: obtaining a first status code, The first status code is the status code in the response header of the first response message.
  • the first response message is the Http response message returned by the business system after the Http request is initiated to the business system;
  • the first status code is the redirect state Code, construct a second response message according to the preset message protocol format and the first status code, the first status code is carried in the body of the second response message; return the second response message, the second response Used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the header of the second response message described above carries a second status code
  • the second status code is a status code supported by the receiver and different from the first status code
  • the step of constructing the second response message when the first status code is the redirection status code is implemented according to the preset message protocol format and the first status code. , Specifically implement the following steps: when the first status code is the redirection status code, obtain the network location information in the response header of the first response message; according to the preset message protocol format, the first status code and the network location information , Construct a second response message, and the body of the second response message also carries network location information.
  • the processor executes the computer program to implement the step of constructing the second response message according to the preset message protocol format and the first status code when the first status code is the redirection status code
  • the following steps are specifically implemented: when the first status code is the redirection status code, obtain the network location information in the response header of the first response message and the Cookie data in the response header of the first response message;
  • the text protocol format, the first status code, the network location information, and the cookie data are used to construct a second response message.
  • the body of the second response message also carries network location information and cookie data.
  • the processor further implements the following steps when executing the computer program: according to preset user agent screening rules or/and description information screening rules, the received response messages are screened; When the user agent screening rule or/and the description information screening rule is satisfied, the received response message is taken as the first response message, and the step of obtaining the first status code is entered.
  • the processor executes the computer program, the following steps are further implemented: when the first status code is a non-redirection status code, the first response message is returned.
  • the above-mentioned recipient is a terminal, and an applet application runs on the terminal, and the applet application obtains the redirection status code according to the message protocol format.
  • a computer device is provided.
  • the computer device may be a terminal, and its internal structure diagram may be as shown in FIG. 12.
  • the computer equipment includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and a computer program.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen
  • the input device of the computer equipment can be a touch layer covered on the display screen, or it can be a button, a trackball or a touchpad set on the computer equipment shell , It can also be an external keyboard, touchpad, or mouse.
  • a computer device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the following steps when the processor executes the computer program:
  • FIGS. 10-12 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied.
  • the specific computer The device may include more or fewer parts than shown in the figures, or combine certain parts, or have a different arrangement of parts.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the first status code is the status code in the response header of the first response message, the first response message is the Http response message returned by the business system after the Http request is initiated to the business system; in the first When the status code is a redirect status code, construct a second response message according to the preset message protocol format and the first status code, the first status code is carried in the body of the second response message; the second response is returned Message, the second response is used to instruct the receiver to obtain the redirection status code according to the message protocol format.
  • the header of the second response message described above carries a second status code
  • the second status code is a status code supported by the receiver and different from the first status code
  • the step of constructing the second response message is implemented according to the preset message protocol format and the first status code when the first status code is the redirection status code.
  • the first status code is the redirection status code
  • the second response message step is constructed according to the preset message protocol format and the first status code.
  • the following steps are specifically implemented: when the first status code is the redirection status code, the network location information in the response header of the first response message and the Cookie data in the response header of the first response message are obtained;
  • the message protocol format, the first status code, the network location information, and the cookie data are used to construct a second response message.
  • the message body of the second response message also carries network location information and cookie data.
  • the following steps are further implemented: according to preset user agent screening rules or/and description information screening rules, the received response messages are screened; When the text satisfies the user agent screening rule or/and the description information screening rule, the received response message is taken as the first response message, and the step of obtaining the first status code is entered.
  • the following steps are further implemented: when the first status code is a non-redirection status code, the first response message is returned.
  • the above-mentioned method is applied to a gateway, and the above-mentioned receiver is a terminal, and an applet application runs on the terminal, and the applet application obtains the redirection status code according to the message protocol format.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
  • the redirection status code carried in the body of the second response message is obtained according to the preset message protocol format, and the redirection status code is the first state Code, the second response message is constructed according to the message protocol format and the first status code.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请涉及一种Http重定向状态码捕获方法、装置和计算机设备。所述方法包括:获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。采用本方法能够使得小程序端捕获到重定向状态码,且可以减少延迟。

Description

Http重定向状态码捕获方法、装置和计算机设备 技术领域
本申请涉及互联网技术领域,特别是涉及一种Http重定向状态码捕获方法、装置、计算机设备和存储介质。
背景技术
随着互联网技术的发展,出现了小程序技术,小程序,是指一种搭载于其他平台(如微信平台、百度平台和头条平台),无需下载和安装就可以在平台中使用的应用程序。
在Web系统中,基于安全等方面考虑,很多请求需要用户处于登陆状态(称之为受限资源)。在对受限资源处理的时候,常用的做法是,在判定用户没有处于登陆状态时,强制跳转到登陆页。然而,由于小程序底层请求并不是像浏览器请求,小程序的请求是不支持Http(Hypertext transfer protocol,超文本传输协议)重定向状态码的。传统的解决方式是,先调用服务端的接口判断用户的登陆状态。对于小程序端的,由于所有请求都会多一次判断用户是否登陆的请求,多一次请求,必然造成响应的延迟。
发明内容
基于此,有必要针对上述技术问题,提供一种能够减少延迟的Http重定向状态码捕获方法、装置、计算机设备和存储介质。
一种Http重定向状态码捕获方法,方法包括:
获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;
在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
在一个实施例中,上述的第二响应报文的报文头中承载有第二状态码,第二状态码为接收方支持的且与第一状态码不同的状态码。
在一个实施例中,上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,包括:在第一状态码为重定向状态码时, 获取第一响应报文的响应头中的网络位置信息;根据预设的报文协议格式、第一状态码和网络位置信息,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息。
在一个实施例中,上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,包括:在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息和第一响应报文的响应头中的Cookie数据;根据预设的报文协议格式、第一状态码、网络位置信息和Cookie数据,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息和Cookie数据。
在一个实施例中,上述的方法还包括:
根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选;
在接收到的响应报文满足用户代理筛选规则或者/和描述信息筛选规则时,将接收到的响应报文作为第一响应报文,进入获取第一状态码的步骤。
在一个实施例中,上述的方法还包括:
在第一状态码为非重定向状态码时,返回第一响应报文。
在一个实施例中,上述的方法应用于网关,上述的接收方为终端,终端上运行有小程序应用,小程序应用根据报文协议格式获取重定向状态码。
一种Http重定向状态码捕获方法,该方法包括:
接收响应报文;
在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在第二响应报文的报文体中的重定向状态码,重定向状态码为第一状态码,第二响应报文根据报文协议格式以及第一状态码构建。
一种Http重定向状态码捕获装置,该装置包括:
状态码获取模块,用于获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;
报文构建模块,用于在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
返回模块,用于返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:
获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;
在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:
接收响应报文;
在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在第二响应报文的报文体中的重定向状态码,重定向状态码为第一状态码,第二响应报文根据报文协议格式以及第一状态码构建。
一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;
在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
接收响应报文;
在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在第二响应报文的报文体中的重定向状态码,重定向状态码为第一状态码,第二响应报文根据报文协议格式以及第一状态码构建。
上述Http重定向状态码捕获方法、装置、计算机设备和存储介质,是获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统 发起Http请求后、业务系统返回的Http响应报文,在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中,返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。本申请的一个实施例中,按照预设的报文协议格式进行了响应报文转换,将原本不被接收方支持的重定向状态码承载在第二响应报文的报文体中,得到了第二响应报文,接收方(例如,小程序端)可以根据报文协议格式获取重定向状态码。如此,不需要再调用服务度端的判断用户登录状态接口,一方面可以减少判断用户登录状态接口的调用频次,另一方面可以也可以减小响应延迟,可以提升用户体验。
附图说明
图1-1为一个实施例中Http重定向状态码捕获方法的应用环境图;
图1-2为一个实施例中Http重定向状态码捕获方法的应用环境图;
图2为一个实施例中Http重定向状态码捕获方法的流程示意图;
图3为一个实施例中第二响应报文构建步骤的流程示意图;
图4为另一个实施例中第二响应报文构建步骤的流程示意图;
图5为另一个实施例中Http重定向状态码捕获方法的流程示意图;
图6为再一个实施例中Http重定向状态码捕获方法的流程示意图;
图7为又一个实施例中Http重定向状态码捕获方法的流程示意图;
图8为一个实施例中Http重定向状态码捕获装置的结构框图;
图9为另一个实施例中Http重定向状态码捕获装置的结构框图;
图10为一个实施例中计算机设备的内部结构图;
图11为另一个实施例中计算机设备的内部结构图;
图12为再一个实施例中计算机设备的内部结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端, 且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。此外,可以理解,本申请所使用的术语“或者/和”,描述关联对象的关联关系,表示可以存在三种关系,例如,A或者/和B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或者”的关系。
本申请提供的Http重定向状态码捕获方法,可以应用于如图1-1所示的应用环境中。该应用环境中包括终端102、网络104和业务系统106,终端102和业务系统106之间均可以通过网络104实现可通信的连接。该由终端102、网络104和服务器106构成的网络系统可以是基于互联网,也可以基于局域网,还可以基于互联网和局域网的组合网,在此不做赘述。
终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。同时,图1-1中示出的是终端102包括终端1022和终端1024等两个终端的情况,但本申请并不对终端102的数量进行限制,也可以包括更多或者更少的终端。终端102上运行有小程序应用,小程序应用是指不需要下载安装即可使用的应用,例如,微信环境下运行的微信小程序、百度环境下运行的百度小程序。
网络104用于实现终端102与业务系统106之间的网络连接,可以包括多种类型的有线或无线网络。网络104都可以包括互联网、局域网(“LAN”)、广域网(“WAN”)、内部网、移动电话网络、虚拟专用网(VPN)、蜂窝式或其它移动通信网络、蓝牙、NFC或其任何组合。网络104进行数据传输时也会基于相应的通讯协议,例如网页浏览器接收网页相应的业务代码时会基于HTTP通讯协议,移动应用程序接收的业务代码时可以基于Websocket通讯协议。
业务系统106可以包括一个或者多个服务器,例如,图1-1中示出的是业务系统106包括服务器1062和服务器1064等两个服务器的情况,但本申请并不对服务器的数量进行限制,也可以包括更多或者更少的服务器。每个服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
本申请提供的Http重定向状态码捕获方法,还可以应用于如图1-2所示的应用环境中。该应用环境中除了包括图1-1所示的终端102、网络104和业务系统106,还可以包括网关108。网关108部署网关层,该网关层一般是在WEB服务器前一层。网关108作为计算机设备,统一将业务系统对各个终端运行的小程序的重定向响应进行响应报文的转换,以保证各个终端运行的小程序能够对业务系统的重定向状态码进行响 应。此外,业务系统106的数量也可以为多个。多个业务系统106对应同一个网关。
在一个实施例中,如图2所示,提供了一种Http重定向状态码捕获方法,以该方法应用于图1-2中的网关为例进行说明,包括以下步骤:
步骤202,获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的响应报文;
这里,状态码指状态代码,一般是指为所接收的请求(例如,网页点击)分配的3位数代码,一般为Http状态码(Http Status Code),Http状态码是用以表示网页服务器超文本传输协议响应状态的3位数字代码。这里,Http请求用于请求第一响应报文。
具体地,终端(或者说终端上运行的小程序)向业务系统发送业务请求后,业务系统根据该业务请求得到第一响应报文;网关向业务系统发起Http请求以获取该第一响应报文,在获得该第一响应报文后,获取该第一响应报文的响应头中的状态码,即第一状态码。
步骤204,在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
这里,重定向状态码一般是指HTTP状态码中与重定向相关的状态码,例如,301、302、303和307等状态码。重定向(Redirect)就是通过各种方法将各种网络请求重新定个方向转到其它位置,例如:网页重定向或者域名的重定向。
这里,报文协议格式是网关和以下的接收方之间预先约定好的报文协议的格式,该报文协议格式至少包括第一状态码的配置方式。
具体地,网关首先判断第一状态码是否为重定向状态码,若是,则根据预设的报文协议格式以及第一状态码,构建第二响应报文,其中,第一状态码承载在第二响应报文的报文体中。根据需要,判断第一状态码是否为重定向状态码的过程也可以由其他设备完成,网关获得判断结果。
步骤206,返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
具体地,网关向终端(或者说终端上运行的小程序)返回第二响应报文,
上述Http重定向状态码捕获方法中,是获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文,在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中,返回 第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。本实施例中,按照预设的报文协议格式进行了响应报文转换,将原本不被接收方支持的重定向状态码承载在第二响应报文的报文体中,得到了第二响应报文,接收方(例如,小程序端)可以根据报文协议格式获取重定向状态码。如此,不需要再调用服务度端的判断用户登录状态接口,一方面可以减少判断用户登录状态接口的调用频次,另一方面可以也可以减小响应延迟,可以提升用户体验。
在一个实施例中,上述的第二响应报文的报文头中承载有第二状态码,该第二状态码为接收方支持的且与第一状态码不同的状态码。
这里,第二状态码可以是200状态码,200状态码表示已成功处理了请求的状态代码。根据需要,第二状态码也可以是除200状态码以外的其他状态码,例如,其他2xx状态码。
在一个实施例中,如图3所示,上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,可以包括如下步骤:
步骤302,在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息;
这里,网络位置信息也可以称为网页地址信息,是互联网上标准的资源的地址(Address)。该网络位置信息往往是响应报文的响应头中的Location。
具体地,网关首先判断第一状态码是否为重定向状态码,若是,则获取第一响应报文的响应头中的网络位置信息。
步骤304,根据预设的报文协议格式、第一状态码和网络位置信息,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息。
这里,报文协议格式还包括报文协议格式的配置方式。其中,网络位置信息作为重定向的网页地址信息(redirectUrl)。
具体地,网关可以按照预设的报文协议格式,将第一状态码和网络位置信息配置在第二响应报文的报文体中。一般地,可以将第一状态码和网络位置信息配置在同一报文体中,对于同一响应报文包括多个报文体的情况,也可以将第一状态码和网络位置信息配置在不同的报文体中。
采用本实施例的方案,由于第二响应报文的报文体中还承载有网络位置信息,可以方便终端(或者说终端上运行的小程序)发起对更改网络位置信息(即重定向)的调用。
由于考虑到在请求重定向时,一般需要将上次请求的cookie携带上,在一个实施例中,如图4所示,上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,可以包括如下步骤:
步骤402,在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息以及该第一响应报文的响应头中的Cookie数据;
其中,Cookie,有时也用其复数形式Cookies,指某些网站为了辨别用户身份、进行session跟踪而储存在用户本地终端上的数据(通常经过加密)。
步骤404,根据预设的报文协议格式、第一状态码、网络位置信息以及Cookie数据,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息以及有Cookie数据。
采用本实施例的方案,可以进一步方便终端(或者说终端上运行的小程序)发起对更改网络位置信息的调用。
在一个实施例中,如图5所示,提供了一种Http重定向状态码捕获方法,以该方法应用于图1中的网关为例进行说明,包括以下步骤:
步骤502,根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选;
其中,用户代理筛选规则和描述信息筛选规则都可以根据实际需要设定。例如,设定一用户代理标识集合,若接收到的响应报文对应的用户代理标识是该用户代理标识集合中的一个,则判定满足用户代理筛选规则。例如,也可以设定一描述信息集合,若接收到的响应报文对应的描述信息与该描述信息集合中的任意一条描述信息相匹配,则判定满足描述信息筛选规则。
步骤504,在接收到的响应报文满足用户代理筛选规则或者/和描述信息筛选规则时,将接收到的响应报文作为第一响应报文;
步骤506,获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后,业务系统返回的响应报文;
步骤508,在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
步骤510,返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
本实施例中步骤506、步骤508和步骤510可以对应的参照上述的步骤202、步骤 204和步骤206的描述,在此不予赘述。
本实施例中,对接收到的响应报文进行过滤,可以节约小程序端消耗的流量。
在一个实施例中,本申请的Http重定向状态码捕获方法还可以包括步骤:在第一状态码为非重定向状态码时,返回第一响应报文。
这里,非重定向状态码是指与重定向不相关的状态码。
本实施例中,在第一状态码为非重定向状态码时,不对第一响应报文进行修改,直接将该第一响应报文返回给接收方。接收方对于直接返回的第一响应报文,按照原本的业务处理逻辑进行处理即可。
需要说明的是,上述实施例中均是以将本申请的Http重定向状态码捕获方法应用于网关为例,同时,是以上述的接收方为终端、终端上运行有小程序应用、且小程序应用根据报文协议格式获取重定向状态码为例,进行说明。但根据实际需要,上述的各个实施例中的Http重定向状态码捕获方法也可以应用于图1-1或者图1-2中的业务系统或者业务系统中的某一个或者多个服务器,即上述的各个实施例中的各个步骤的执行主体为业务系统或者业务系统中的某一个或者多个服务器。
对于应用于网关,可以由网关统一对各个小程序的重定向响应进行响应报文的转换,以使得各个终端运行的各个小程序均能够对业务系统的重定向状态码进行响应,一方面不需要调用服务端的判断用户登录状态接口,对服务端的业务无侵入,另一方面,也不需要每个服务器单独配置以实现对重定向响应的转换,可以节约配置成本。
根据上述实施例中Http重定向状态码捕获方法,在一个实施例中,如图6所示,提供了一种Http重定向状态码捕获方法,以该方法应用于图1-1或者图1-2中的终端为例进行说明,该终端上运行有小程序应用,该方法包括以下步骤:
步骤602,接收响应报文;
步骤604,在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在第二响应报文的报文体中的重定向状态码,该重定向状态码为第一状态码,第二响应报文根据该报文协议格式以及第一状态码构建。
此外,在确定接收到的响应报文为第一响应报文时,按照小程序应用对第一响应报文原本的处理逻辑进行处理。
对于第二响应报文的报文体中还承载有网络位置信息时,可以根据网络位置信息发起重定向请求,对于第二响应报文的报文体中还承载有Cookie数据时,发起的重定向请求的响应头中携带有该Cookie数据。
关于终端侧Http重定向状态码捕获方法的具体限定可以参见上文中对于网关侧的Http重定向状态码捕获方法的限定,在此不再赘述。
为了便于理解本发明的方案,以下以网关和小程序应用(以下称为小程序端)的交互为例进行说明。
本实施例中的报文协议格式为:{“code”:“重定向状态码”,“redirectUrl”:“Location”,“cookie”:“Cookie”},同时,制定协议,当下游业务系统返回重定向状态码时,约束返回结果为json格式的报文协议,即该报文协议格式,其中,json是一种轻量级的数据交换格式。
该报文协议格式中的code为请求业务系统发生重定向的响应头里面的状态码(Status),如301、302等。redirectUrl为请求业务系统发生重定向的响应头里面的网络位置信息(Location)。cookie为请求业务系统发生重定向的响应头里面的Cookie。
小程序统一网关(相当于上述的网关),可以采用OpenResty(nginx+lua)搭建,网关层是小程序使用,在统一接入层,可以通过用户代理(userAgent)和描述信息(refer)来限制是小程序的流量,才到小程序统一网关,网关层使用httpc库调用下游的业务系统接口,解析得到业务系统接口的响应头,当响应头里面的响应码为重定向状态码时,将响应头里面的状态码、网络位置信息和Cookie按照上述的报文协议格式,返回在响应报文的报文体里,给该响应报文的状态码为200。其中,code是标记真实业务的响应状态码,redirectUrl是重定向响应头里面的Location,方便小程序下次发起对该URL的调用,cookie是第一次请求的响应头里面的cookie,因为在请求重定向(redirectUrl)的时候,需要将上次请求的cookie携带。
小程序端通过返回json格式的报文中的code知道业务系统实际返回状态码,发现是重定向的状态码,就取json格式的报文里面的Cookie放到请求头里,请求json里面的redirectUrl地址,从而得到业务数据返回。
网关层可以采用nginx+lua的httpc发起业务系统的http请求,如图7所示,本实施例中Http重定向状态码捕获方法包括以下步骤:
步骤702,网关判断业务系统的响应报文中的状态码是否是重定向状态码,若是,则进入步骤704,若否,则进入步骤706;
这里,业务系统的响应报文相当于上述的第一报文。具体地,小程序端发出业务请求到业务系统,业务系统根据该业务请求得到响应报文,网关向业务系统请求该响应报文,具体地,网关可以使用httpclient调用业务系统的接口URL。网关层获取业务 系统的响应报文的响应头里面的状态码,判断是否是重定向相关的状态码(301、302、303、307等)。
步骤704,网关获取业务系统的响应报文的响应头里面的状态码、网络位置信息和Cookie,将对应的值,按照约定的报文协议格式,构建并返回以200为状态码的报文。
具体地,可以获取业务系统的响应报文的响应头里面的状态码(Status)、网络位置信息(Location)和Cookie,将状态码、网络位置信息、Cookie对应的值,按照约定的协议格式,构建以200为状态码的报文:{“code”:”重定向状态码”,”redirectUrl”:”Location”,”cookie”Cookie”}中,并返回。
步骤706,网关将业务系统的响应报文返回;
具体地,如果状态码是非重定向状态码,网关将业务系统的响应报文返回。
步骤708,小程序端接收到网关发送的响应报文,解析接收到的响应报文的响应头信息;
对于解析结果,有两种情况:1、正常非重定向的响应;2、经过网关处理的原始业务重定向的响应,也就是重定向协议,格式:{“code”:”重定向状态码”,”redirectUrl”:”Location”,”cookie”Cookie”}。
步骤710,小程序端在接收到的是非重定向的响应报文时,按照该响应报文对应的业务处理逻辑进行处理;
步骤712,小程序端在接收到的是重定向的响应报文时,根据该响应报文的报文体中的网络位置信息发起重定向请求。
其中,将cookie设置在重定向请求的请求头里,发起以响应报文的报文体中的网络位置信息为新地址信息的重定向请求。
制定一套解决小程序不支持http状态码为重定向的协议。采用OpenResty(nginx+lua)搭建的网关层捕获http重定向状态码,返回约定协议{“code”:”重定向状态码”,”redirectUrl”:”Location”,”cookie”Cookie”},可以采用lua的httpc库解析http协议接口的响应头里的Status、Location、Cookie数据,并按照约束协议,返回结果。使用该协议,通过网关层处理,将业务系统的重定向的响应转换为200状态码的响应。
应该理解的是,虽然图2-7的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-7 中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
在一个实施例中,如图8所示,提供了一种Http重定向状态码捕获装置,包括:状态码获取模块802、报文构建模块804和返回模块806,其中:
状态码获取模块802,用于获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;
报文构建模块804,用于在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;
在一个实施例中,该第二响应报文的报文头中承载有第二状态码,该第二状态码为接收方支持的且与第一状态码不同的状态码;
返回模块806,用于返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
在一个实施例中,报文构建模块804在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息,根据预设的报文协议格式、第一状态码和网络位置信息,构建第二响应报文,第二响应报文的报文体中还承载有该网络位置信息。
在一个实施例中,报文构建模块804在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息和第一响应报文的响应头中的Cookie数据,根据预设的报文协议格式、该第一状态码、该网络位置信息和该Cookie数据,构建第二响应报文,该第二响应报文的报文体中还承载有该网络位置信息。
在一个实施例中,上述的Http重定向状态码捕获装置还包括报文筛选模块,该报文筛选模块用于根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选,状态码获取模块802在报文筛选模块的筛选结果为接收到的响应报文满足用户代理筛选规则或者/和描述信息筛选规则时,将接收到的响应报文作为第一响应报文,获取第一状态码。
在一个实施例中,上述的返回模块806还用于在第一状态码为非重定向状态码时, 返回第一响应报文。
在一个实施例中,上述的装置应用于网关层,上述的接收方为终端,该终端上运行有小程序应用,小程序应用根据报文协议格式获取重定向状态码。
在一个实施例中,如图9所示,提供了一种Http重定向状态码捕获装置,包括:通信模块902和状态码捕获模块904,其中:
通信模块902,用于接收响应报文;
状态码捕获模块904,用于在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在第二响应报文的报文体中的重定向状态码,重定向状态码为第一状态码,第二响应报文根据报文协议格式以及第一状态码构建。
在一个实施例中,上述的第二响应报文的报文头中承载有第二状态码,该第二状态码为接收方支持的且与第一状态码不同的状态码。
在一个实施例中,上述的第二响应报文的报文头中还承载有网络位置信息,或者上述的第二响应报文的报文头中还承载有网络位置信息和Cookie数据。
关于Http重定向状态码捕获装置的具体限定可以参见上文中对于Http重定向状态码捕获方法的限定,在此不再赘述。上述Http重定向状态码捕获装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图10所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种Http重定向状态码捕获方法。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是网关,其内部结构图可以如图11所示。该计算机设备可以包括一个或多个如下部件:处理器、存储器和收发器,处理器、存储器和收发器可以通过数据总线连接。
处理器可以包括一个或者多个处理核心。处理器利用各种接口和线路连接整个网关内的各个部分,通过运行或执行存储在存储器内的指令、程序、代码集或指令集, 以及调用存储在存储器内的数据,执行接入网关的各种功能和处理数据。可选地,处理器可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable LogicArray,PLA)中的至少一种硬件形式来实现。处理器可集成中央处理器(CentralProcessingUnit,CPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统和应用程序等;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器中,单独通过一块芯片进行实现。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
在一个实施例中,上述的第二响应报文的报文头中承载有第二状态码,第二状态码为接收方支持的且与第一状态码不同的状态码。
在一个实施例中,处理器执行计算机程序时实现上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文的步骤时,具体实现以下步骤:在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息;根据预设的报文协议格式、第一状态码和网络位置信息,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息。
在一个实施例中,处理器执行计算机程序时实现上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文步骤时,具体实现以下步骤:在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息和第一响应报文的响应头中的Cookie数据;根据预设的报文协议格式、第一状态码、网络位置信息和Cookie数据,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息和Cookie数据。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选;在接收到的响应报文满足用户代理筛选规则或者/和描述信息筛选规则时,将接收到的响应报文作为 第一响应报文,进入获取第一状态码的步骤。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:在第一状态码为非重定向状态码时,返回第一响应报文。
在一个实施例中,上述的接收方为终端,终端上运行有小程序应用,小程序应用根据报文协议格式获取重定向状态码。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图12所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种Http重定向状态码捕获方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:
本领域技术人员可以理解,图10-12中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
获取第一状态码,第一状态码为第一响应报文的响应头中的状态码,第一响应报文为向业务系统发起Http请求后、业务系统返回的Http响应报文;在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文,第一状态码承载在第二响应报文的报文体中;返回第二响应报文,第二响应用于指示接收方根据报文协议格式获取重定向状态码。
在一个实施例中,上述的第二响应报文的报文头中承载有第二状态码,第二状态码为接收方支持的且与第一状态码不同的状态码。
在一个实施例中,计算机程序被处理器执行时实现上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文的步骤时,具体实现以下步骤:在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息;根据预设的报文协议格式、第一状态码和网络位置信息,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息。
在一个实施例中,计算机程序被处理器执行时实现上述的在第一状态码为重定向状态码时,根据预设的报文协议格式以及第一状态码,构建第二响应报文步骤时,具体实现以下步骤:在第一状态码为重定向状态码时,获取第一响应报文的响应头中的网络位置信息和第一响应报文的响应头中的Cookie数据;根据预设的报文协议格式、第一状态码、网络位置信息和Cookie数据,构建第二响应报文,第二响应报文的报文体中还承载有网络位置信息和Cookie数据。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选;在接收到的响应报文满足用户代理筛选规则或者/和描述信息筛选规则时,将接收到的响应报文作为第一响应报文,进入获取第一状态码的步骤。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:在第一状态码为非重定向状态码时,返回第一响应报文。
在一个实施例中,上述的方法应用于网关,上述的接收方为终端,终端上运行有小程序应用,小程序应用根据报文协议格式获取重定向状态码。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
接收响应报文;
在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在第二响应报文的报文体中的重定向状态码,重定向状态码为第一状态码,第二响应报文根据报文协议格式以及第一状态码构建。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储 器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (10)

  1. 一种Http重定向状态码捕获方法,所述方法包括:
    获取第一状态码,所述第一状态码为第一响应报文的响应头中的状态码,所述第一响应报文为向业务系统发起Http请求后、所述业务系统返回的Http响应报文;
    在所述第一状态码为重定向状态码时,根据预设的报文协议格式以及所述第一状态码,构建第二响应报文,所述第一状态码承载在所述第二响应报文的报文体中;
    返回所述第二响应报文,所述第二响应用于指示接收方根据所述报文协议格式获取重定向状态码。
  2. 根据权利要求1所述的方法,其特征在于,所述第二响应报文的报文头中承载有第二状态码,所述第二状态码为所述接收方支持的且与所述第一状态码不同的状态码。
  3. 根据权利要求1或2所述的方法,其特征在于,所述在所述第一状态码为重定向状态码时,根据预设的报文协议格式以及所述第一状态码,构建第二响应报文,包括:
    在所述第一状态码为重定向状态码时,获取所述第一响应报文的响应头中的网络位置信息;优选地,还获取所述第一响应报文的响应头中的Cookie数据;
    根据预设的报文协议格式、所述第一状态码和所述网络位置信息,构建所述第二响应报文,所述第二响应报文的报文体中还承载有所述网络位置信息;优选地,还根据所述Cookie数据构建所述第二响应报文,所述第二响应报文的报文体中还承载有所述Cookie数据。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选;
    在接收到的响应报文满足所述用户代理筛选规则或者/和所述描述信息筛选规则时,将接收到的响应报文作为所述第一响应报文,进入所述获取第一状态码的步骤。
  5. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    在所述第一状态码为非重定向状态码时,返回所述第一响应报文。
  6. 根据权利要求1或2所述的方法,其特征在于,所述方法应用于网关,所述接收方为终端,所述终端上运行有小程序应用,所述小程序应用根据所述报文协议格式获取重定向状态码。
  7. 一种Http重定向状态码捕获方法,其特征在于,所述方法包括:
    接收响应报文;
    在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在所述第二响应报文的报文体中的重定向状态码,所述重定向状态码为第一状态码,所述第二响应报文根据所述报文协议格式以及所述第一状态码构建。
  8. 一种Http重定向状态码捕获装置,其特征在于,所述装置包括:
    状态码获取模块,用于获取第一状态码,所述第一状态码为第一响应报文的响应头中的状态码,所述第一响应报文为向业务系统发起Http请求后、所述业务系统返回的Http响应报文;
    报文构建模块,用于在所述第一状态码为重定向状态码时,根据预设的报文协议格式以及所述第一状态码,构建第二响应报文,所述第一状态码承载在所述第二响应报文的报文体中;
    返回模块,用于返回所述第二响应报文,所述第二响应用于指示接收方根据所述报文协议格式获取重定向状态码。
  9. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述的方法的步骤。
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。
PCT/CN2020/096996 2019-09-04 2020-06-19 Http重定向状态码捕获方法、装置和计算机设备 WO2021042815A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA3153431A CA3153431A1 (en) 2019-09-04 2020-06-19 Http redirect status code capture method and apparatus, and computer device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910831868.9A CN110661787A (zh) 2019-09-04 2019-09-04 Http重定向状态码捕获方法、装置和计算机设备
CN201910831868.9 2019-09-04

Publications (1)

Publication Number Publication Date
WO2021042815A1 true WO2021042815A1 (zh) 2021-03-11

Family

ID=69037923

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/096996 WO2021042815A1 (zh) 2019-09-04 2020-06-19 Http重定向状态码捕获方法、装置和计算机设备

Country Status (3)

Country Link
CN (1) CN110661787A (zh)
CA (1) CA3153431A1 (zh)
WO (1) WO2021042815A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114172877A (zh) * 2021-11-11 2022-03-11 欧冶云商股份有限公司 一种基于http协议的中间件数据传输方法、装置、设备及存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI755005B (zh) * 2020-07-29 2022-02-11 鴻海精密工業股份有限公司 基於改進的rest協議的測試方法、用戶端、伺服器及介質
CN111858381B (zh) * 2020-07-31 2023-05-16 抖音视界有限公司 应用程序容错能力测试方法、电子设备及介质
CN113992755A (zh) * 2021-10-27 2022-01-28 中国电信股份有限公司 基于微服务网关的请求处理方法、系统、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854375A (zh) * 2009-03-31 2010-10-06 华为软件技术有限公司 重定向方法及装置
CN102291437A (zh) * 2011-07-27 2011-12-21 武汉天喻信息产业股份有限公司 跨平台互联网应用的实现系统及方法
CN104168316A (zh) * 2014-08-11 2014-11-26 北京星网锐捷网络技术有限公司 一种网页访问控制方法、网关
WO2016095521A1 (zh) * 2014-12-19 2016-06-23 中兴通讯股份有限公司 一种域名系统dns重定向的方法、装置和系统
CN105721479A (zh) * 2016-03-02 2016-06-29 北京网康科技有限公司 一种网址过滤方法及装置

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7136930B1 (en) * 1999-11-05 2006-11-14 Nokia Corporation System and method for effective use of air link between mobile stations and gateway servers
FI20001877A (fi) * 2000-08-25 2002-02-26 Nokia Networks Oy Yhteisvastuun vaihtaminen langattomassa tietoliikennejärjestelmässä
JP4285655B2 (ja) * 2005-07-19 2009-06-24 インターナショナル・ビジネス・マシーンズ・コーポレーション Webサービスを提供する方法、装置、プログラム
US7995559B2 (en) * 2006-02-27 2011-08-09 Cisco Technology, Inc. System and method for interworking communication protocols to provide supplementary services
CN101420729A (zh) * 2007-10-26 2009-04-29 华为技术有限公司 一种实现重定向的方法、系统和设备
CN101764767A (zh) * 2008-12-23 2010-06-30 华为技术有限公司 网络互联的方法、网关设备及系统
US9264435B2 (en) * 2011-02-15 2016-02-16 Boingo Wireless, Inc. Apparatus and methods for access solutions to wireless and wired networks
CN103200146B (zh) * 2012-01-04 2016-05-25 中国移动通信集团安徽有限公司 终端和服务器的数据同步方法和装置
CN102638454B (zh) * 2012-03-14 2014-05-21 武汉理工大学 一种面向http身份鉴别协议的插件式单点登录集成方法
CN103580937B (zh) * 2012-07-24 2016-11-23 阿里巴巴集团控股有限公司 一种Web 服务模拟的方法及其系统和服务代理系统
CN105939313B (zh) * 2015-09-01 2019-03-15 杭州迪普科技股份有限公司 状态码重定向方法及装置
CN105227667A (zh) * 2015-10-14 2016-01-06 深圳市金证科技股份有限公司 报文转换方法及平台
CN106101239B (zh) * 2016-06-21 2018-12-25 杭州迪普科技股份有限公司 Http重定向报文的重写方法及装置
CN106878337A (zh) * 2017-03-29 2017-06-20 华南理工大学 一种实现接入网源地址验证的Web认证方法与系统
CN108965223A (zh) * 2017-12-12 2018-12-07 北京视联动力国际信息技术有限公司 一种基于视联网的网页处理方法、代理服务器及视联网终端
CN110022289B (zh) * 2018-01-10 2022-07-05 北龙中网(北京)科技有限责任公司 数据传输方法、装置及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854375A (zh) * 2009-03-31 2010-10-06 华为软件技术有限公司 重定向方法及装置
CN102291437A (zh) * 2011-07-27 2011-12-21 武汉天喻信息产业股份有限公司 跨平台互联网应用的实现系统及方法
CN104168316A (zh) * 2014-08-11 2014-11-26 北京星网锐捷网络技术有限公司 一种网页访问控制方法、网关
WO2016095521A1 (zh) * 2014-12-19 2016-06-23 中兴通讯股份有限公司 一种域名系统dns重定向的方法、装置和系统
CN105721479A (zh) * 2016-03-02 2016-06-29 北京网康科技有限公司 一种网址过滤方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114172877A (zh) * 2021-11-11 2022-03-11 欧冶云商股份有限公司 一种基于http协议的中间件数据传输方法、装置、设备及存储介质
CN114172877B (zh) * 2021-11-11 2024-01-26 欧冶云商股份有限公司 一种基于http协议的中间件数据传输方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CA3153431A1 (en) 2021-03-11
CN110661787A (zh) 2020-01-07

Similar Documents

Publication Publication Date Title
WO2021042815A1 (zh) Http重定向状态码捕获方法、装置和计算机设备
US11849001B2 (en) Systems, methods, and apparatus to monitor mobile internet activity
US20220276910A1 (en) Dynamically integrating a client application with third-party services
US8813214B1 (en) Method and system for providing secure peer-to-peer file transfers
EP2839609B1 (en) Authentication of service requests
US9736136B2 (en) Systems, methods, and apparatus to monitor mobile internet activity
US9307418B2 (en) Systems, methods, and apparatus to monitor mobile internet activity
JP7389791B2 (ja) コンフィギュレーション・シナリオ順守のためのモバイル・デバイスによるコンプライアンス設定の実装
US9264435B2 (en) Apparatus and methods for access solutions to wireless and wired networks
WO2021218018A1 (zh) 网页端实现跨域请求的数据处理方法、装置及相关设备
US9009741B2 (en) Mechanism to initiate calls between browsers without predefined call signaling protocol
US20150319137A1 (en) Techniques to monitor connection paths on networked devices
JP2018528507A (ja) 近距離通信を介してアプリケーションバージョンをインストールする方法およびシステム
CN112261111A (zh) 一种应用程序内浏览器跨域访问实现方法及系统
CN105681122B (zh) 用于电信设备监视的方法和系统
US9900372B2 (en) Techniques to detect and react to proxy interference
CN104767667A (zh) 一种web网页多屏共享的方法及终端设备、网站服务器
US9801132B2 (en) Method and system for managing turbo mode operation
EP4145317A1 (en) Specifying and testing open communication protocols

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

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 3153431

Country of ref document: CA

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20859852

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20859852

Country of ref document: EP

Kind code of ref document: A1