A method and apparatus for sending an HTTP request, a server, and a storage medium

By receiving the HTTP request sent by the terminal, using the type parameter and path parameter to determine the URL, and sending the request when the target URL exists in the preset whitelist, the code redundancy problem caused by different business types is solved, and the efficient and accurate sending and exception identification of HTTP requests are achieved.

CN116527647BActive Publication Date: 2025-10-17CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310696545.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-12
Publication Date
2025-10-17
Estimated Expiration
2043-06-12

AI Technical Summary

Technical Problem

In the prior art, different types of services require writing different HTTP request codes, which leads to code redundancy and makes it impossible to effectively implement the HTTP request sending process.

Method used

By receiving the target HTTP request sent by the terminal, the URL is determined based on the type parameter and path parameter, and the legitimacy of the HTTP request is determined by whether the target URL exists in the preset whitelist. The request is sent if it is legal, otherwise an exception is prompted.

Benefits of technology

It improves the effectiveness and accuracy of HTTP request sending, reduces code redundancy, and can accurately identify and intercept abnormal requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116527647B_ABST
    Figure CN116527647B_ABST
Patent Text Reader

Abstract

The application provides a HTTP request sending method and device, a server and a storage medium, relates to the technical field of network, and solves the technical problem that different codes need to be written for different types of services in the related art, the written codes are too redundant, and the HTTP request sending process cannot be effectively implemented. The method comprises the following steps: receiving a target HTTP request sent by a terminal, the target HTTP request comprising a type parameter and a path parameter; in the case that the target HTTP request comprises a preset identifier, determining the type of the path parameter based on the type parameter; in the case that the type of the path parameter is a text file, determining a target URL based on the path parameter; in the case that the target URL exists in a preset whitelist, sending the target HTTP request based on the target URL, and the preset whitelist comprises a plurality of URLs.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the network technical field, and particularly relates to a HTTP request sending method and device, a server and a storage medium. BACKGROUND

[0002] At present, a server can implement a hyper text transfer protocol (HTTP) request sending (or redirection) process based on pre-written code.

[0003] However, in the above method, different codes need to be written for different types of services, the written codes are too redundant, and the HTTP request sending process cannot be effectively implemented. SUMMARY

[0004] The present application provides a HTTP request sending method and device, a server and a storage medium, and solves the technical problem that different codes need to be written for different types of services in the related art, the written codes are too redundant, and the HTTP request sending process cannot be effectively implemented.

[0005] In a first aspect, the present application provides a HTTP request sending method, comprising: receiving a target HTTP request sent by a terminal, wherein the target HTTP request comprises a type parameter and a path parameter; in a case where a preset identifier is included in the target HTTP request, determining the type of the path parameter based on the type parameter; in a case where the type of the path parameter is a text file, determining a target uniform resource locator (URL) based on the path parameter; in a case where the target URL exists in a preset white list, sending the target HTTP request based on the target URL, wherein the preset white list comprises a plurality of URLs.

[0006] Optionally, the path parameter comprises at least two parameters, and the determining of the target URL based on the path parameter specifically comprises: determining a parameter with the lowest priority in the at least two parameters as the target URL.

[0007] In the present application, the parameter with the lowest priority in the at least two parameters is a parameter included in the lowest level directory in the storage path of the URL. At this time, the server can determine the parameter with the lowest priority as the target URL, and the target URL can be accurately and effectively determined.

[0008] Optionally, the determining of the type of the path parameter based on the type parameter specifically comprises: in a case where the type parameter is an empty field, determining the type of the path parameter as a key-value pair.

[0009] In the present application, in the case that the parameter type is a null field, it is explained that the URL included in the path parameter exists (or is stored) in the form of a key-value pair. At this time, the server can determine that the type of the path parameter is a key-value pair, accurately and effectively determine the type of the path parameter, and further accurately determine the target URL.

[0010] Optionally, the sending method of the HTTP request further includes: in the case that the type of the path parameter is a key-value pair, determining a target value as the target URL, the target value being a value in a target key-value pair, and the target key-value pair being a key-value pair included in the path parameter.

[0011] In the present application, in the case that the type of the path parameter is a key-value pair, it is explained that the URL included in the target HTTP request exists in the form of a key-value pair. At this time, the server can determine a target value (i.e. a value in a key-value pair included in the path parameter) as the target URL, which can facilitate and expedite the determination of the target URL.

[0012] Optionally, the sending method of the HTTP request further includes: in the case that the target URL does not exist in the preset white list, sending preset prompt information to the terminal, so that the terminal displays the preset prompt information, and the preset prompt information is used to prompt that the target HTTP request is abnormal.

[0013] In the present application, in the case that the target URL does not exist in the preset white list, it is explained that the target URL does not belong to the plurality of URLs, i.e. the target URL is not a normal URL, and it can also be understood that the target URL is an abnormal URL. The HTTP request corresponding to the target URL (i.e. the target HTTP request) is an abnormal HTTP request that needs to be intercepted. At this time, the server can send preset prompt information to the terminal to prompt that the target HTTP request is abnormal, which can accurately identify abnormal HTTP requests.

[0014] In a second aspect, the present application provides a sending device of an HTTP request, which includes a receiving module, a determining module and a sending module. The receiving module is used to receive a target HTTP request sent by a terminal, and the target HTTP request includes a type parameter and a path parameter. The determining module is used to determine the type of the path parameter based on the type parameter in the case that the target HTTP request includes a preset identifier. The determining module is also used to determine a target URL based on the path parameter in the case that the type of the path parameter is a text file. The sending module is used to send the target HTTP request based on the target URL in the case that the target URL exists in a preset white list, and the preset white list includes a plurality of URLs.

[0015] Optionally, the path parameter comprises at least two parameters; and the determining module is specifically configured to determine a parameter with the lowest priority in the at least two parameters as the target URL.

[0016] Optionally, the determining module is further configured to determine that the type of the path parameter is a key-value pair in a case where the type parameter is a null field.

[0017] Optionally, the determining module is further configured to determine the target URL as a target value in a case where the type of the path parameter is a key-value pair, the target value being a value in a target key-value pair, and the target key-value pair being a key-value pair included in the path parameter.

[0018] In a third aspect, the present application provides a server, comprising: a processor and a memory configured to store processor-executable instructions; and wherein the processor is configured to execute the instructions to implement any of the optional HTTP request sending methods in the first aspect.

[0019] In a fourth aspect, the present application provides a computer-readable storage medium, and the computer-readable storage medium stores instructions, and when the instructions in the computer-readable storage medium are executed by a server, the server can execute any of the optional HTTP request sending methods in the first aspect.

[0020] The HTTP request sending method, device, server and storage medium provided by the present application, the server receives a target HTTP request sent by a terminal, the target HTTP request comprising a type parameter and a path parameter; in a case where the target HTTP request comprises a preset identifier, it is indicated that the target HTTP request needs to be determined. At this time, the server can determine the type of the path parameter based on the type parameter, and in a case where the type of the path parameter is a text file, determine a target URL based on the path parameter. In a case where the target URL exists in a preset whitelist, the server can send the target HTTP request based on the target URL. In the present application, in a case where the target URL exists in the preset whitelist, it is indicated that the target URL is a normal URL, the HTTP request corresponding to the target URL (i.e. the target HTTP request) is a normal and passable HTTP request, and the server does not need to intercept the target HTTP request. At this time, the server can send the target HTTP request based on the target URL, which can accurately and reasonably control the sending of the HTTP request and improve the effectiveness of the sending of the HTTP request. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced.

[0022] Figure 1 A network architecture schematic diagram of a HTTP request sending system provided by an embodiment of the present application is provided.

[0023] Figure 2 A flow schematic diagram of a HTTP request sending method provided by an embodiment of the present application is provided.

[0024] Figure 3 A flow schematic diagram of another HTTP request sending method provided by an embodiment of the present application is provided.

[0025] Figure 4 A flow schematic diagram of another HTTP request sending method provided by an embodiment of the present application is provided.

[0026] Figure 5 A flow schematic diagram of another HTTP request sending method provided by an embodiment of the present application is provided.

[0027] Figure 6 A flow schematic diagram of another HTTP request sending method provided by an embodiment of the present application is provided.

[0028] Figure 7 A process schematic diagram of defining a type parameter and a path parameter provided by an embodiment of the present application is provided.

[0029] Figure 8 A structure schematic diagram of a HTTP request sending device provided by an embodiment of the present application is provided.

[0030] Figure 9 A structure schematic diagram of another HTTP request sending device provided by an embodiment of the present application is provided. DETAILED DESCRIPTION

[0031] The HTTP request sending method, device, server and storage medium provided by an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0032] The terms “include” and “have” and their any variations mentioned in the description of the present application are intended to cover the inclusions without exclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but optionally further includes other steps or units not listed, or optionally further includes other steps or units inherent to the process, method, product or device.

[0033] It should be noted that in the embodiments of the present application, the words "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described in the present application as "exemplary" or "for example" should not be construed as being more preferred or advantageous than other embodiments or design schemes. In fact, the use of the words "exemplary" or "for example" is intended to present concepts in a particular manner.

[0034] In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.

[0035] Based on the description in the background art, in the related art, the server can implement the process of sending (or redirecting) the HTTP request based on the pre-written code. However, different codes may need to be written for different types of services, and the written codes are too redundant, which may not effectively implement the sending process of the HTTP request. Based on this, the embodiments of the present application provide a method and device for sending an HTTP request, a server and a storage medium. In the case that a target URL exists in a preset whitelist, it is indicated that the target URL is a normal URL, and the HTTP request corresponding to the target URL (that is, the target HTTP request) is a normal HTTP request that can be released, and the server does not need to intercept the target HTTP request. At this time, the server can send the target HTTP request based on the target URL, which can accurately and reasonably control the sending of the HTTP request and improve the effectiveness of the sending of the HTTP request.

[0036] The method and device for sending an HTTP request, the server and the storage medium provided by the embodiments of the present application can be applied to an HTTP request sending system. As shown in the Figure 1 The HTTP request sending system includes a terminal 101 and a server 102. Generally, in actual application, the connection between the above-mentioned devices can be a wireless connection, in order to conveniently and intuitively represent the connection relationship between the devices, Figure 1 In the

[0037] The terminal 101 can send a target HTTP request to the server 102, and the target HTTP request includes a type parameter and a path parameter.

[0038] The server 102 can send the target HTTP request based on the target URL in the case that the target URL exists in the preset whitelist, and the preset whitelist includes a plurality of URLs.

[0039] Optionally, the terminal 101 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, and the like. The specific form of the terminal is not specially limited in the embodiments of the present application. The terminal can perform human-computer interaction with a user through one or more of a keyboard, a touchpad, a touch screen, a remote controller, voice interaction, a handwriting device, and the like.

[0040] Exemplarily, the server performing the HTTP request sending method provided in the embodiments of the present application can be a stand-alone physical server, a server cluster composed of multiple physical servers or a distributed system, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN) services, and basic cloud computing services such as big data and artificial intelligence platforms.

[0041] As shown in Figure 2 The HTTP request sending method provided in the embodiments of the present application can include S101-S104.

[0042] S101, the server receives a target HTTP request sent by a terminal.

[0043] The target HTTP request includes a type parameter and a path parameter.

[0044] It should be understood that the type parameter can represent the type of the path parameter.

[0045] Exemplarily, the target HTTP request can be a GET request, a POST request, a PUT request, or a DELETE request.

[0046] S102, in the case where the target HTTP request includes a preset identifier, the server determines the type of the path parameter based on the type parameter.

[0047] It should be understood that in the case where the target HTTP request includes a preset identifier, it is necessary to determine whether the target HTTP request is a normal request. At this time, the server can determine the type of the path parameter based on the type parameter.

[0048] Optionally, the preset identifier can be a preset annotation, and the server can define two variables in the preset annotation, including a type parameter (type) and a path parameter (path).

[0049] In a case where the type of the path parameter is a text file, the server determines a target URL based on the path parameter.

[0050] In the embodiments of the present application, the type of the path parameter can be a text file or a key-value pair.

[0051] For example, the text file can be a JSON text.

[0052] In an optional implementation, in a case where the type parameter is a preset field, the server can determine that the type of the path parameter is a text file.

[0053] For example, the preset field can be JSON.

[0054] In an implementation of the embodiments of the present application, the path parameter includes at least two parameters. Figure 2 For example, as shown in FIG. 10, the server determines a target URL based on the path parameter can include S1031. Figure 3

[0055] S1031, the server determines a parameter with the lowest priority among the at least two parameters as a target URL.

[0056] It should be understood that for each of the at least two parameters, one parameter can correspond to one priority, and since the path parameter can represent a storage path of the URL. If the priority of one of the at least two parameters is higher than the priority of the other parameter, it means that the storage directory of the parameter is a superior directory of the storage directory of the other parameter in the storage path of the URL. The parameter with the lowest priority among the at least two parameters (hereinafter referred to as a target parameter) is a parameter included in the lowest level directory in the storage path of the URL. At this time, the server can determine the target parameter as the target URL, that is, the target URL can be accurately and effectively determined.

[0057] ​In an optional implementation, the path parameter can include at least two parameters which are sequentially ordered. In this case, the server can determine the last parameter in the at least two parameters as the target URL. Specifically, for a text file, the server can order each parameter in the at least two parameters according to the storage directory from the upper level to the lower level (or from large to small), and then determine the last parameter in the at least two parameters as the target URL, i.e., determine the parameter included in the lowermost directory in the multi-level directory as the target URL, which can improve the accuracy of the determined target URL.

[0058] For example, assuming that the type of the path parameter is a JSON text, and the path parameter is {"data":{"url":"www.xxx.com"}}, i.e., the path parameter includes two parameters of data and url, and the value of url is www.xxx.com. In this case, the server determines the target URL as www.xxx.com.

[0059] In the embodiments of the present application, the server can create a filter (redirect handler interceptor). In the filter, in the case that a preset annotation exists in a certain HTTP request (e.g., a target HTTP request), the server can declare three variables for the target HTTP request, including a type parameter (i.e., type), a path parameter (path), and an address parameter (url) used to store the URL included in the target HTTP request. If the path parameter is {"data":{"url":"www.xxx.com"}}, the server can convert the path parameter into data.url, and the type parameter is JSON. In this case, the server can declare an array (paths) used to store the two parameters included in the path parameter, i.e., data and url.

[0060] Afterwards, the server stores the path parameters in the variable jsonObject based on the JSONObject object (i.e. the value of jsonObject at this time is {"data":{"url":"www.xxx.com"}} ). The server traverses the array by jsonObject=jsonObject.getJSONObject(paths[i]) to update the value of jsonObject, where i is an integer greater than or equal to 0, paths[i] represents the i th element in the array, and jsonObject=jsonObject.getJSONObject(paths[i]) means assigning the i th element in the array to jsonObject. In the case of traversing the first element of the array, the value of jsonObject is data. In the case of traversing the second element (which can also be understood as the last element) of the array paths, the server assigns a value to url by url=jsonObject.getString(paths[1]), and determines the value of url (www.xxx.com) as the target URL.

[0061] S104, in the case that the target URL exists in the preset white list, the server sends a target HTTP request based on the target URL.

[0062] The preset white list includes a plurality of URLs.

[0063] It should be understood that the plurality of URLs are a plurality of normal URLs, i.e. the server can send (or pass) the HTTP request corresponding to each of the plurality of URLs based on the plurality of URLs. In the case that the target URL exists in the preset white list, it means that the target URL is a normal URL, the HTTP request corresponding to the target URL (i.e. the target HTTP request) is a normal and passable HTTP request, and the server does not need to intercept the target HTTP request. At this time, the server can send the target HTTP request based on the target URL, accurately and reasonably control the sending of the HTTP request, and improve the effectiveness of the sending of the HTTP request.

[0064] The technical solution provided by the above embodiment can at least bring the following beneficial effects: It can be seen from S101-S104 that the server receives a target HTTP request that can be sent by the terminal, and the target HTTP request includes a type parameter and a path parameter; when the target HTTP request includes a preset identifier, it indicates that the target HTTP request needs to be judged. At this time, the server can determine the type of the path parameter based on the type parameter, and when the type of the path parameter is a text file, it determines the target URL based on the path parameter. When the target URL exists in the preset whitelist, the server can send the target HTTP request based on the target URL. In the embodiment of the present application, when the target URL exists in the preset whitelist, it indicates that the target URL is a normal URL, and the HTTP request corresponding to the target URL (i.e., the target HTTP request) is a normal HTTP request that can be released, and the server does not need to intercept the target HTTP request. At this time, the server can send the target HTTP request based on the target URL, and can accurately and reasonably control the sending of HTTP requests, thereby improving the effectiveness of sending HTTP requests.

[0065] Combine Figure 2 ,like Figure 4 As shown, in one implementation of the embodiment of the present application, the above-mentioned determination of the type of the path parameter based on the type parameter may specifically include S1021.

[0066] S1021. When the type parameter is an empty field, the server determines that the type of the path parameter is a key-value pair.

[0067] In the embodiment of the present application, the empty field can also be understood as an empty string.

[0068] It should be understood that if the parameter type is empty, it indicates that the URL included in the path parameter exists (or is stored) in the form of a key-value pair. In this case, the server can determine that the path parameter type is a key-value pair, and can accurately and effectively determine the type of the path parameter, and thus accurately determine the target URL.

[0069] Combine Figure 4 ,like Figure 5 As shown, the method for sending an HTTP request provided in the embodiment of the present application may further include S105.

[0070] S105: When the type of the path parameter is a key-value pair, the server determines the target value as the target URL.

[0071] The target value is the value in the target key-value pair, and the target key-value pair is the key-value pair included in the above path parameter.

[0072] Optionally, the server can assign the value in the target key-value pair (i.e., the target value) to the url through a url=request.getParameter(path) method, i.e., the target value can be determined as the target URL.

[0073] For example, the target key-value pair is url-www.yyy.com, i.e., www.yyy.com is the value (i.e., the target value) in the target key-value pair, and url is the key in the target key-value pair. At this time, the server determines that the target URL is www.yyy.com, i.e., the target value.

[0074] In the embodiments of the present application, in the case where the type of the path parameter is a key-value pair, it is explained that the URL included in the target HTTP request exists in the form of a key-value pair, and at this time, the server can determine the target value (i.e., the value in the key-value pair included in the path parameter) as the target URL, which can facilitate and expedite the determination of the target URL.

[0075] In combination Figure 2 As shown in FIG. 1, the method for sending an HTTP request provided by the present application can further include S106. Figure 6

[0076] S106, in the case where the target URL does not exist in the preset white list, the server sends preset prompt information to the terminal to make the terminal display the preset prompt information.

[0077] The preset prompt information is used to prompt that the target HTTP request is abnormal.

[0078] It should be understood that, in the case where the target URL does not exist in the preset white list, it is explained that the target URL does not belong to the above-mentioned multiple URLs, i.e., the target URL is not a normal URL, and it can also be understood that the target URL is an abnormal URL. The HTTP request corresponding to the target URL (i.e., the target HTTP request) is an abnormal HTTP request that needs to be intercepted. At this time, the server can send preset prompt information to the terminal to prompt that the target HTTP request is abnormal, which can accurately identify the abnormal HTTP request.

[0079] Optionally, in the case where the target URL does not exist in the preset white list, the server can delete the target HTTP request.

[0080] In an optional implementation, in the case where the target HTTP request does not include a preset identifier, it is explained that the target HTTP request does not need to be determined, and specifically, the target HTTP request can be defaulted as a normal request. At this time, the server can send the target HTTP request based on the URL included in the target HTTP request. ​

[0081] As Figure 7 shown, a process of defining the type parameter and the path parameter by the server in the embodiments of the present application is shown. Specifically, the process can include S201-S203.

[0082] S201, the server defines a method for verifying a redirection URL required by a control layer.

[0083] S202, the server writes a preset annotation in the method.

[0084] Specifically, the preset annotation can be @RedirectHandlerAnnotation.

[0085] S203, the server defines initial values of the type parameter and the path parameter in the preset annotation.

[0086] The embodiments of the present application can divide the functions of the server and the like according to the above method examples, for example, each function module can be divided according to each function, or two or more functions can be integrated in one processing module. The above integrated module can be realized in the form of hardware or in the form of a software function module. It should be noted that the division of the modules in the embodiments of the present application is illustrative, and is only a logical function division. When actually implemented, another division mode can be used.

[0087] In the case of dividing each function module according to each function, Figure 8 a possible structural schematic diagram of the HTTP request sending device involved in the above embodiments is shown, as Figure 8 shown, the HTTP request sending device 20 can include a receiving module 201, a determining module 202, and a sending module 203.

[0088] The receiving module 201 is configured to receive a target HTTP request sent by a terminal, the target HTTP request including a type parameter and a path parameter.

[0089] The determining module 202 is configured to, in a case where the target HTTP request includes a preset identifier, determine a type of the path parameter based on the type parameter.

[0090] The determining module 202 is further configured to, in a case where the type of the path parameter is a text file, determine a target URL based on the path parameter.

[0091] The sending module 203 is configured to, in a case where the target URL exists in a preset white list, send the target HTTP request based on the target URL, the preset white list including a plurality of URLs.

[0092] Optionally, the path parameter comprises at least two parameters.

[0093] The determining module 202 is specifically configured to determine a parameter with the lowest priority among the at least two parameters as the target URL.

[0094] Optionally, the determining module 202 is further configured to determine that the type of the path parameter is a key-value pair in a case where the type parameter is a null field.

[0095] Optionally, the determining module 202 is further configured to determine the target URL as a target value in a case where the type of the path parameter is a key-value pair, the target value being a value in a target key-value pair, and the target key-value pair being a key-value pair included in the path parameter.

[0096] Optionally, the sending module 203 is further configured to send preset prompt information to the terminal in a case where the target URL does not exist in the preset white list, so that the terminal displays the preset prompt information, and the preset prompt information is used to prompt that the target HTTP request is abnormal.

[0097] In the case of employing an integrated unit, Figure 9 A possible structural schematic diagram of the HTTP request sending apparatus involved in the above embodiments is shown. As shown in Figure 9 The HTTP request sending apparatus 30 can comprise a processing module 301 and a communication module 302. The processing module 301 can be configured to control and manage the actions of the HTTP request sending apparatus 30. The communication module 302 can be configured to support the communication between the HTTP request sending apparatus 30 and other entities. Optionally, as shown in Figure 9 The HTTP request sending apparatus 30 can further comprise a storage module 303 configured to store the program code and data of the HTTP request sending apparatus 30.

[0098] The processing module 301 can be a processor or a controller. The communication module 302 can be a transceiver, a transceiver circuit or a communication interface, etc. The storage module 303 can be a memory.

[0099] When the processing module 301 is a processor, the communication module 302 is a transceiver, and the storage module 303 is a memory, the processor, the transceiver and the memory can be connected through a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0100] It should be understood that the magnitude of the sequence number of the above processes does not mean the order of execution, the execution order of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0101] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0102] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.

[0103] The units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0104] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by using a software program, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or data storage device including one or more servers, data centers, etc. integrated with the medium. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0105] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for sending an HTTP request, characterized in that: The method comprises: receiving a target HTTP request sent by a terminal, wherein the target HTTP request includes a type parameter and a path parameter; In a case where the target HTTP request includes a preset identifier, determining the type of the path parameter based on the type parameter; In a case where the type of the path parameter is a text file, determining a target URL based on the path parameter; In a case where the target URL exists in a preset whitelist, the target HTTP request is sent based on the target URL, where the preset whitelist includes multiple URLs.

2. The method for sending an HTTP request according to claim 1, wherein: The path parameters include at least two parameters, and determining the target URL based on the path parameters includes: The parameter with the lowest priority among the at least two parameters is determined as the target URL.

3. The method for sending an HTTP request according to claim 1, wherein: The determining the type of the path parameter based on the type parameter includes: When the type parameter is an empty field, the type of the path parameter is determined to be a key-value pair.

4. The method for sending an HTTP request according to claim 3, wherein: The method further comprises: In the case that the type of the path parameter is a key-value pair, the target value is determined to be a target URL, the target value is a value in a target key-value pair, and the target key-value pair is a key-value pair included in the path parameter.

5. The method for sending an HTTP request according to any one of claims 1 to 4, characterized in that: The method further comprises: In a case where the target URL does not exist in the preset whitelist, preset prompt information is sent to the terminal so that the terminal displays the preset prompt information, where the preset prompt information is used to prompt that an abnormality exists in the target HTTP request.

6. A device for sending an HTTP request, characterized in that: include: Receiving module, determining module and sending module; The receiving module is configured to receive a target HTTP request sent by a terminal, wherein the target HTTP request includes a type parameter and a path parameter; The determining module is configured to determine the type of the path parameter based on the type parameter when the target HTTP request includes a preset identifier; The determining module is further configured to determine a target URL based on the path parameter when the type of the path parameter is a text file; The sending module is configured to send the target HTTP request based on the target URL when the target URL exists in a preset whitelist, wherein the preset whitelist includes a plurality of URLs.

7. The sending device of HTTP request according to claim 6, characterized in that: The path parameters include at least two parameters; The determining module is specifically configured to determine the parameter with the lowest priority among the at least two parameters as the target URL.

8. The HTTP request sending device according to claim 6, characterized in that: The determination module is further configured to determine, when the type parameter is an empty field, that the type of the path parameter is a key-value pair.

9. The sending device of HTTP request according to claim 8, characterized in that: The determination module is further configured to determine the target value as a target URL when the type of the path parameter is a key-value pair, wherein the target value is a value in a target key-value pair, and the target key-value pair is a key-value pair included in the path parameter.

10. The device for sending an HTTP request according to any one of claims 6 to 9, characterized in that: The sending module is further configured to send preset prompt information to the terminal when the target URL does not exist in the preset whitelist, so that the terminal displays the preset prompt information, wherein the preset prompt information is used to prompt that an abnormality exists in the target HTTP request.

11. A server, characterized in that: The server includes: processor; a memory configured to store instructions executable by the processor; The processor is configured to execute the instruction to implement the method for sending an HTTP request according to any one of claims 1 to 5.

12. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a server, the server is enabled to execute the method for sending an HTTP request according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and apparatus for carrying out processing on HTTP request

    CN104954415A

  • Method and system for detecting security of HTTP request

    CN111541672A