WO2021042815A1 - Http重定向状态码捕获方法、装置和计算机设备 - Google Patents
Http重定向状态码捕获方法、装置和计算机设备 Download PDFInfo
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols 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
Description
Claims (10)
- 一种Http重定向状态码捕获方法,所述方法包括:获取第一状态码,所述第一状态码为第一响应报文的响应头中的状态码,所述第一响应报文为向业务系统发起Http请求后、所述业务系统返回的Http响应报文;在所述第一状态码为重定向状态码时,根据预设的报文协议格式以及所述第一状态码,构建第二响应报文,所述第一状态码承载在所述第二响应报文的报文体中;返回所述第二响应报文,所述第二响应用于指示接收方根据所述报文协议格式获取重定向状态码。
- 根据权利要求1所述的方法,其特征在于,所述第二响应报文的报文头中承载有第二状态码,所述第二状态码为所述接收方支持的且与所述第一状态码不同的状态码。
- 根据权利要求1或2所述的方法,其特征在于,所述在所述第一状态码为重定向状态码时,根据预设的报文协议格式以及所述第一状态码,构建第二响应报文,包括:在所述第一状态码为重定向状态码时,获取所述第一响应报文的响应头中的网络位置信息;优选地,还获取所述第一响应报文的响应头中的Cookie数据;根据预设的报文协议格式、所述第一状态码和所述网络位置信息,构建所述第二响应报文,所述第二响应报文的报文体中还承载有所述网络位置信息;优选地,还根据所述Cookie数据构建所述第二响应报文,所述第二响应报文的报文体中还承载有所述Cookie数据。
- 根据权利要求3所述的方法,其特征在于,所述方法还包括:根据预设的用户代理筛选规则或者/和描述信息筛选规则,对接收到的响应报文进行筛选;在接收到的响应报文满足所述用户代理筛选规则或者/和所述描述信息筛选规则时,将接收到的响应报文作为所述第一响应报文,进入所述获取第一状态码的步骤。
- 根据权利要求3所述的方法,其特征在于,所述方法还包括:在所述第一状态码为非重定向状态码时,返回所述第一响应报文。
- 根据权利要求1或2所述的方法,其特征在于,所述方法应用于网关,所述接收方为终端,所述终端上运行有小程序应用,所述小程序应用根据所述报文协议格式获取重定向状态码。
- 一种Http重定向状态码捕获方法,其特征在于,所述方法包括:接收响应报文;在确定接收到的响应报文为第二响应报文时,根据预设的报文协议格式获取承载在所述第二响应报文的报文体中的重定向状态码,所述重定向状态码为第一状态码,所述第二响应报文根据所述报文协议格式以及所述第一状态码构建。
- 一种Http重定向状态码捕获装置,其特征在于,所述装置包括:状态码获取模块,用于获取第一状态码,所述第一状态码为第一响应报文的响应头中的状态码,所述第一响应报文为向业务系统发起Http请求后、所述业务系统返回的Http响应报文;报文构建模块,用于在所述第一状态码为重定向状态码时,根据预设的报文协议格式以及所述第一状态码,构建第二响应报文,所述第一状态码承载在所述第二响应报文的报文体中;返回模块,用于返回所述第二响应报文,所述第二响应用于指示接收方根据所述报文协议格式获取重定向状态码。
- 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述的方法的步骤。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。
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)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114172877A (zh) * | 2021-11-11 | 2022-03-11 | 欧冶云商股份有限公司 | 一种基于http协议的中间件数据传输方法、装置、设备及存储介质 |
Families Citing this family (3)
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)
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)
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 | 北龙中网(北京)科技有限责任公司 | 数据传输方法、装置及系统 |
-
2019
- 2019-09-04 CN CN201910831868.9A patent/CN110661787A/zh active Pending
-
2020
- 2020-06-19 CA CA3153431A patent/CA3153431A1/en active Pending
- 2020-06-19 WO PCT/CN2020/096996 patent/WO2021042815A1/zh active Application Filing
Patent Citations (5)
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)
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 |