CN117527775A - HTTP request response method, device and equipment - Google Patents

HTTP request response method, device and equipment Download PDF

Info

Publication number
CN117527775A
CN117527775A CN202311327968.0A CN202311327968A CN117527775A CN 117527775 A CN117527775 A CN 117527775A CN 202311327968 A CN202311327968 A CN 202311327968A CN 117527775 A CN117527775 A CN 117527775A
Authority
CN
China
Prior art keywords
determining
client
target
http
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311327968.0A
Other languages
Chinese (zh)
Inventor
郭昭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengfang Financial Information Technology Service Co ltd
Original Assignee
Chengfang Financial Information Technology Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengfang Financial Information Technology Service Co ltd filed Critical Chengfang Financial Information Technology Service Co ltd
Priority to CN202311327968.0A priority Critical patent/CN117527775A/en
Publication of CN117527775A publication Critical patent/CN117527775A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/2895Intermediate processing functionally located close to the data provider application, e.g. reverse proxies

Landscapes

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

Abstract

The application provides a method, a device and equipment for responding to HTTP requests, which relate to the technical field of computers, and the method is applied to a server and comprises the following steps: receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested; determining a target weight corresponding to the target identifier based on a mapping relation between the identifier and the weight in the identifier information; determining the resource state of the server according to the operation information, the residual memory information and the input/output information of the server; determining the type of the HTTP request according to the target identifier; and determining whether to return an HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested. According to the technical scheme, the HTTP request can be managed in a refined mode, and the service quality of the HTTP request with important level is guaranteed.

Description

HTTP request response method, device and equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, and a device for responding to an HTTP request.
Background
The hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) is a request-response protocol that specifies what messages a client might send to a server and what responses it gets.
Currently, after the server receives the HTTP request, the reverse proxy of nginnx analyzes the HTTP request sent by the client, so as to determine whether to respond to the HTTP request. The HTTP request carries the IP information of the client, and the importance level of the client is determined based on the IP information of the client, so as to determine whether to respond to the HTTP request sent by the client preferentially.
However, for a certain client, the HTTP request sent by the client may include an important HTTP request and an unimportant HTTP request, and the above response manner may cause the important HTTP request to not respond timely.
Disclosure of Invention
The application provides a HTTP request response method, device and equipment, so as to realize the fine management of HTTP requests, thereby ensuring the service quality of HTTP requests with important levels.
In a first aspect, the present application provides an HTTP request response method, applied to a server, the method including:
receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested;
determining a target weight corresponding to the target identifier based on a mapping relation between the identifier and the weight in the identifier information;
determining a resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient;
determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type;
and determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
In a possible implementation manner, the identification information further comprises a mapping relation between the identification and the identification password; the determining the type of the HTTP request according to the target identifier includes:
in the HTTP request, determining a first identification password corresponding to the target identification;
determining a second identification password corresponding to the target identification based on a mapping relation between the identification and the identification password;
if the first identification password is matched with the second identification password, determining that the type is a normal type;
and if the first identification password is not matched with the second identification password, determining that the type is an abnormal type.
In a possible implementation manner, the determining whether to return the HTTP response to the client according to the resource status, the type, and the target weight includes:
if the type is an abnormal type, determining that the HTTP response is not returned to the client;
if the type is a normal type and the resource state is that the resources are sufficient, determining to return the HTTP response to the client;
and if the type is a normal type and the resource state is insufficient, determining whether to return the HTTP response to the client according to the target weight.
In a possible implementation manner, the determining whether to return the HTTP response to the client according to the target weight includes:
if the target weight is greater than or equal to a first threshold, determining to return the HTTP response to the client;
and if the target weight is smaller than the first threshold value, determining that the HTTP response is not returned to the client.
In a possible implementation manner, the determining whether to return the HTTP response to the client according to the target weight includes:
determining a plurality of weights in the identification information;
determining a first number of the plurality of weights that is less than or equal to the target weight and a second number that is greater than the target weight;
determining not to return the HTTP response to the client if a ratio of the first number to the second number is less than or equal to a second threshold;
determining to return the HTTP response to the client if a ratio of the first number to the second number is greater than the second threshold.
In one possible embodiment, the method further comprises:
receiving an identification application request sent by the client, wherein the identification application request comprises a service corresponding to the client;
determining a target identifier corresponding to the service and a second identifier password corresponding to the target identifier in the identifier information;
and sending the target identification and the second identification password to the client.
In one possible embodiment, the method further comprises:
and updating the weight corresponding to the identifier in each identifier according to the service corresponding to each identifier.
In a second aspect, the present application provides an HTTP request response apparatus, including:
the receiving module is used for receiving an HTTP request sent by the client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested;
the first determining module is used for determining a target weight corresponding to the target identifier based on a mapping relation between the identifier in the identifier information and the weight;
the first processing module is used for determining the resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient in resource;
the second determining module is used for determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type;
and the second processing module is used for determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
In a possible implementation manner, the identification information further comprises a mapping relation between the identification and the identification password; the second determining module is specifically configured to:
in the HTTP request, determining a first identification password corresponding to the target identification;
determining a second identification password corresponding to the target identification based on a mapping relation between the identification and the identification password;
if the first identification password is matched with the second identification password, determining that the type is a normal type;
and if the first identification password is not matched with the second identification password, determining that the type is an abnormal type.
In a possible implementation manner, the second processing module is specifically configured to:
if the type is an abnormal type, determining that the HTTP response is not returned to the client;
if the type is a normal type and the resource state is that the resources are sufficient, determining to return the HTTP response to the client;
and if the type is a normal type and the resource state is insufficient, determining whether to return the HTTP response to the client according to the target weight.
In a possible implementation manner, the second processing module is specifically configured to:
if the target weight is greater than or equal to a first threshold, determining to return the HTTP response to the client;
and if the target weight is smaller than the first threshold value, determining that the HTTP response is not returned to the client.
In a possible implementation manner, the second processing module is specifically configured to:
determining a plurality of weights in the identification information;
determining a first number of the plurality of weights that is less than or equal to the target weight and a second number that is greater than the target weight;
determining not to return the HTTP response to the client if a ratio of the first number to the second number is less than or equal to a second threshold;
determining to return the HTTP response to the client if a ratio of the first number to the second number is greater than the second threshold.
In one possible embodiment, the first processing module is further configured to:
receiving an identification application request sent by the client, wherein the identification application request comprises a service corresponding to the client;
determining a target identifier corresponding to the service and a second identifier password corresponding to the target identifier in the identifier information;
and sending the target identification and the second identification password to the client.
In one possible embodiment, the first processing module is further configured to:
and updating the weight corresponding to the identifier in each identifier according to the service corresponding to each identifier.
In a third aspect, the present application provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the HTTP request response method as in any one of the first aspects when executing the program.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the HTTP request response method according to any of the first aspects.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the HTTP request response method according to any of the first aspects.
The HTTP request response method, the device and the equipment are applied to a server, and are used for firstly receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested, then determining a target weight corresponding to the target identifier based on a mapping relation between the identifier in the identifier information and the weight, determining a resource state of the server according to operation information, residual memory information and input/output information of the server, and determining a type of the HTTP request according to the target identifier, wherein the resource state is insufficient or sufficient in resource, and the type of the HTTP request is a normal type or an abnormal type; and finally, determining whether to return an HTTP response corresponding to the HTTP request to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested. According to the scheme of the embodiment of the application, the HTTP requests are used as granularity, whether HTTP responses corresponding to the HTTP requests are determined based on the target weights corresponding to the target KIDs in the HTTP requests, so that the HTTP requests can be finely managed, all HTTP requests sent by a certain client are prevented from being set to be requests with high importance levels, or all HTTP requests sent by the certain client are prevented from being set to be requests with low importance levels, and the service quality of the HTTP requests with the important levels is guaranteed. Under the condition that the computing capacity of the server is insufficient, the scheme of the embodiment of the application can respond preferentially to the HTTP requests sent by the client side and with higher weight, and different processing of different HTTP requests is achieved.
Drawings
For a clearer description of the present application or of the prior art, the drawings that are used in the description of the embodiments or of the prior art will be briefly described, it being apparent that the drawings in the description below are some embodiments of the present application, and that other drawings may be obtained from these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
fig. 2 is a flow chart of an HTTP request response method provided in an embodiment of the present application;
fig. 3 is a schematic flow chart of determining whether to return an HTTP response to a client according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an HTTP request response apparatus provided in an embodiment of the present application;
fig. 5 is a schematic entity structure diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is apparent that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
HTTP is a request-response protocol, typically running on top of the transmission control protocol (Transmission Control Protocol, TCP), which specifies what messages a client might send to a server and what responses get.
Currently, after the server receives the HTTP request, the reverse proxy of nginnx analyzes the HTTP request sent by the client, so as to determine whether to respond to the HTTP request.
In the HTTP protocol, two important pieces of information are carried by default, one being the IP information of the client and the other being the uniform resource identifier (Uniform Resource Identifier, URI) being accessed. Nginx is a high-performance HTTP and reverse proxy web server that has the ability to process HTTP requests based on both of these information. That is, ng inx determines the importance level of a client based on the IP information and URI of the client, thereby determining whether to respond preferentially to the HTTP request sent by the client.
However, for a certain client, the HTTP request sent by the client may include an important HTTP request and an unimportant HTTP request, and the above response manner may cause the important HTTP request not to respond in time, but preferentially respond to the unimportant HTTP request.
In summary, the above response method cannot realize the fine management of HTTP requests, and cannot guarantee the quality of service for HTTP requests of importance level.
Based on this, the embodiment of the application provides an HTTP request response method, so as to implement fine management of HTTP requests, thereby ensuring quality of service for HTTP requests with importance level.
An application scenario applicable to the embodiment of the present application will be described first with reference to fig. 1.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application, as shown in fig. 1, including a client 11, a server 12, a server 13, and a server 14. The client 11 may send an HTTP request to any one of the servers 12, 13, and 14, and if the client 11 sends an HTTP request to the server 12, the server 12 may select whether to respond to the HTTP request sent by the client 11 and return information requested by the client 11.
A client in each embodiment of the present application may refer broadly to a program that uses an HTTP request, or a device that runs the program, or a system that uses an HTTP API for data transmission, or the like.
It should be noted that, the correspondence between the client and the server may be a one-to-many relationship, for example, one client may send HTTP requests to a plurality of different servers; the corresponding relationship between the client and the server may be a many-to-one relationship, for example, multiple clients may send HTTP requests to the same server; the correspondence between clients and servers may be a one-to-one correspondence, for example, a client may send an HTTP request to a server. The correspondence between the client and the service is only exemplarily described in fig. 1, and does not constitute an actual limitation.
Based on the application scenario illustrated in fig. 1, a solution according to an embodiment of the present application is described below with reference to fig. 2.
Fig. 2 is a flow chart of an HTTP request response method provided in an embodiment of the present application, where the method is applied to a server, as shown in fig. 2, and the method includes:
s21, receiving an HTTP request sent by the client, wherein the HTTP request comprises a target identifier corresponding to the service to be requested.
The identification information is information stored in a database, and the identification information comprises a plurality of identifications (key Identity document, KID) and weights corresponding to the KIDs. Wherein the weight corresponding to the KID is used to indicate the importance level or degree of importance of the KID.
For any KID, the weight corresponding to the KID may be variable or constant, and the server may periodically obtain identification information from the database, and obtain a plurality of KIDs and weights corresponding to each KID. As shown in FIG. 1, the database stores the different KIDs, as well as the corresponding weights, e.g., KID 01 for weight 10, KID 02 for weight 9, KID 03 for weight 10, etc.
In one possible implementation, for any client, before the client carries the KID in the HTTP request, an identification application request needs to be sent to the server, where the identification application request includes the service of the client. Then, the server determines a target KID corresponding to the business of the client and a second identification password corresponding to the target KID in the identification information in the received identification application request sent by the client. The server sends the target KID and the second identification code to the client for the client to send an HTTP request to the server based on the target KID and the second identification code.
It should be noted that, for a client, the client may involve different services, and thus different KIDs, and corresponding KID passwords, need to be applied for different services.
The client sends an HTTP request to the server, the HTTP request being a request based on the HTTP protocol. In the HTTP request, a target KID is included that belongs to one of the plurality of KIDs obtained by the server. The client identifies the importance level or importance level of the HTTP request by the target KID in the HTTP request during the process of sending the HTTP request.
S22, determining the target weight corresponding to the target identifier based on the mapping relation between the identifier and the weight in the identifier information.
After receiving the HTTP request, the server may obtain the target KID in the HTTP request. Then, based on the mapping relation between the identification and the weights in the identification information, determining the weight corresponding to the target KID, wherein the weight corresponding to the target KID is the target weight.
After determining the target KID and the target weight, the server can determine the importance level or the importance degree of the HTTP request sent by the client according to the target KID and the target weight, so as to determine whether to return an HTTP response corresponding to the HTTP request to the client, wherein the HTTP response can comprise information of the client passing through the HTTP request, namely response data corresponding to the service to be requested.
In one possible implementation, the server may update the weight corresponding to each identifier according to the service corresponding to each identifier. The identification corresponding services may include, for example, various different services such as web traffic services, web conversation services, etc., and the importance level or importance level of the various different services may be different at different periods of time. Therefore, the server can update the weight corresponding to the KID in each identifier according to the service corresponding to each identifier. That is, the weights corresponding to the KIDs are dynamically updated, and after receiving the HTTP request sent by the client, the server needs to determine the target weight that is updated by the target KID in the HTTP request, and determine whether to respond to the HTTP request based on the updated target weight. When the data of one monitored object is collected by the client and then an HTTP request is sent to the server through the HTTP protocol, the affected degree is different according to the different importance degrees of the monitored object.
Each assigned KID represents a business system that needs to carry the KID and the corresponding KID password in the HTTP request header when a business system requests resources from the server.
S23, determining the resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient.
For example, the operational information may reflect a current operational state of the server, indicating whether the server is currently busy. If the running information indicates that the server is currently busy, the resource state of the server can be determined to be insufficient, and if the running information indicates that the server is not currently busy, the resource state of the server can be determined to be sufficient.
For example, the remaining memory information is used to indicate the current size of the remaining memory of the server, if the current size of the remaining memory of the server is greater than or equal to a certain preset threshold, the resource status of the server may be determined to be sufficient, and if the current size of the remaining memory of the server is less than a certain preset threshold, the resource status of the server may be determined to be insufficient.
For example, the input/output information is used to indicate the number of input and output requests processed by the server, if the number of input and output requests processed by the server is less than or equal to a certain preset threshold value in a preset period, the resource status of the server may be determined to be sufficient, if the number of input and output requests processed by the server is greater than a certain preset threshold value in the preset period, the resource status of the server may be determined to be insufficient, and so on.
S24, determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type.
In one possible implementation manner, for any KID in the identification information acquired by the server, a weight corresponding to the KID and a KID password corresponding to the KID may be determined, where the KID password is mainly used to prevent the KID from being stolen. In the state that the KID is leaked, if other clients send malicious HTTP requests through the leaked clients, the server can identify through the KID password. The KID password is for security reasons-to prevent malicious requests from being made after the KID has been obtained by a rogue program.
Specifically, after the server receives the HTTP request sent by the client, the target KID may be obtained according to the HTTP request, and then the first identification password corresponding to the target KID may also be obtained. If the HTTP request does not include the KID password, the first identification password can be determined to be null; if a KID password is included in the HTTP request, the KID password may be determined to be the first identification password. It should be noted that, the first identification code may be the correct KID code corresponding to the target KID, or may be the wrong KID code, and further judgment is required.
In the identification information acquired by the server, the correct KID passwords corresponding to the KIDs are stored. Therefore, after determining the target KID, the server can determine the second identification code corresponding to the target KID according to the mapping relationship between the identification indicated by the identification information and the identification code. The second identification password is the correct KID password corresponding to the target KID.
After the first identification password and the second identification password are determined, the server performs matching processing on the first identification password and the second identification password, and judges whether the first identification password and the second identification password are matched, wherein whether the first identification password and the second identification password are matched is basically whether the first identification password and the second identification password are identical.
If the first identification password is matched with the second identification password, namely the first identification password is the same as the second identification password, the type of the HTTP request sent by the client is determined to be normal, and the HTTP request is not tampered maliciously.
If the first identification password is not matched with the second identification password, namely the first identification password is different from the second identification password, determining that the type of the HTTP request sent by the client is an abnormal type and has been tampered maliciously.
S25, determining whether to return an HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
After determining the resource state of the server and the type of the HTTP request sent by the client, determining whether to return an HTTP response to the client according to the resource state of the server, the type of the HTTP request and the target weight corresponding to the target KID. This process is described below in connection with fig. 3.
Fig. 3 is a schematic flow chart of determining whether to return an HTTP response to a client according to an embodiment of the present application, where, as shown in fig. 3, the method includes:
s31, judging whether the type of the HTTP request is a normal type, if so, executing S32, and if not, executing S34.
Based on the embodiment illustrated in S24 described above, it can be determined whether the type of the HTTP request is a normal type or an abnormal type.
If the HTTP request sent by the client is an abnormal HTTP request, it indicates that the target KID in the HTTP request is maliciously utilized, and the server does not respond to the HTTP request, that is, does not return an HTTP response to the client.
If the HTTP request sent by the client is a normal HTTP request, it indicates that the target KID in the HTTP request is not maliciously utilized, and at this time, whether the server responds to the HTTP request needs to further determine.
S32, judging whether the resource state of the server is sufficient, if so, executing S35, and if not, executing S33.
By default, the server is in a state of sufficient resources, and all HTTP requests from the client respond. When the server is in the state of insufficient resources, the server directly returns a signal such as failure to respond to the request to the HTTP request with low weight according to the level of insufficient resources. The weight object is KID, the KID sets weight information when being created, the weight information is stored in a database, and a server periodically reads the weight information from the database and caches the weight information in own memory. Wherein the status of insufficient resources is triggered by the resource scheduling system.
In the case that the HTTP request sent by the client is a normal type HTTP request, it is determined whether the resource status of the server is adequate. If the resource state of the server is that the resources are sufficient, the HTTP response can be determined to be returned to the client; if the resource status of the server is insufficient, whether the server responds to the HTTP request needs to be further determined.
S33, determining whether to return the HTTP response to the client according to the target weight.
In one possible implementation, the target weight is compared to a first threshold value and a determination is made as to whether the target weight is greater than or equal to the first threshold value. If the target weight is greater than or equal to a first threshold, indicating that the HTTP request is a request with higher importance level, and determining to return an HTTP response to the client; if the target weight is smaller than the first threshold, the importance level of the HTTP request is relatively low, and it is determined that the HTTP response is not returned to the client.
In one possible implementation, the server determines a plurality of weights in the identification information after acquiring the identification information.
The server then determines a first number of the plurality of weights that is less than or equal to the target weight and a second number that is greater than the target weight. The first number is the number of weights in the plurality of weights which are smaller than or equal to the target weight, and the second number is the number of weights in the plurality of weights which are larger than the target weight.
After determining the first number and the second number, a ratio of the first number to the second number is determined and compared to a second threshold.
In the case that the ratio of the first number to the second number is less than or equal to the second threshold, it is determined that no HTTP response is returned to the client.
In the event that the ratio of the first number to the second number is greater than a second threshold, determining to return an HTTP response to the client.
S34, determining that the HTTP response is not returned to the client.
S35, determining to return an HTTP response to the client.
In summary, the HTTP request response method provided in the embodiments of the present application is applied to a server, and the HTTP request sent by the client is received first, where the HTTP request includes a target identifier corresponding to a service to be requested, then, based on a mapping relationship between the identifier in the identifier information and the weight, a target weight corresponding to the target identifier is determined, and a resource state of the server is determined according to operation information, remaining memory information, and input/output information of the server, and a type of the HTTP request is determined according to the target identifier, where the resource state is insufficient or sufficient, and the type of the HTTP request is a normal type or an abnormal type; and finally, determining whether to return an HTTP response corresponding to the HTTP request to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested. According to the scheme of the embodiment of the application, the HTTP requests are used as granularity, whether HTTP responses corresponding to the HTTP requests are determined based on the target weights corresponding to the target KIDs in the HTTP requests, so that the HTTP requests can be finely managed, all HTTP requests sent by a certain client are prevented from being set to be requests with high importance levels, or all HTTP requests sent by the certain client are prevented from being set to be requests with low importance levels, and the service quality of the HTTP requests with the important levels is guaranteed. Under the condition of insufficient computing capacity of the server, the scheme of the embodiment of the application can respond preferentially to the HTTP request with higher weight sent by the client, and can dynamically adjust the weight corresponding to the KID so as to realize the distinguishing processing of different HTTP requests.
The HTTP request response device provided in the present application is described below, and the HTTP request response device described below and the HTTP request response method described above may be referred to correspondingly to each other.
Fig. 4 is a schematic structural diagram of an HTTP request response apparatus provided in an embodiment of the present application, where, as shown in fig. 4, the apparatus includes:
the receiving module 41 is configured to receive an HTTP request sent by a client, where the HTTP request includes a target identifier corresponding to a service to be requested;
a first determining module 42, configured to determine a target weight corresponding to the target identifier based on a mapping relationship between the identifier in the identifier information and the weight;
a first processing module 43, configured to determine a resource status of the server according to the operation information, the remaining memory information, and the input/output information of the server, where the resource status is insufficient or sufficient;
a second determining module 44, configured to determine, according to the target identifier, a type of the HTTP request, where the type is a normal type or an abnormal type;
and the second processing module 45 is configured to determine whether to return the HTTP response to the client according to the resource status, the type, and the target weight, where the HTTP response includes response data corresponding to the service to be requested.
In a possible implementation manner, the identification information further comprises a mapping relation between the identification and the identification password; the second determining module 44 is specifically configured to:
in the HTTP request, determining a first identification password corresponding to the target identification;
determining a second identification password corresponding to the target identification based on a mapping relation between the identification and the identification password;
if the first identification password is matched with the second identification password, determining that the type is a normal type;
and if the first identification password is not matched with the second identification password, determining that the type is an abnormal type.
In one possible implementation, the second processing module 45 is specifically configured to:
if the type is an abnormal type, determining that the HTTP response is not returned to the client;
if the type is a normal type and the resource state is that the resources are sufficient, determining to return the HTTP response to the client;
and if the type is a normal type and the resource state is insufficient, determining whether to return the HTTP response to the client according to the target weight.
In one possible implementation, the second processing module 45 is specifically configured to:
if the target weight is greater than or equal to a first threshold, determining to return the HTTP response to the client;
and if the target weight is smaller than the first threshold value, determining that the HTTP response is not returned to the client.
In one possible implementation, the second processing module 45 is specifically configured to:
determining a plurality of weights in the identification information;
determining a first number of the plurality of weights that is less than or equal to the target weight and a second number that is greater than the target weight;
determining not to return the HTTP response to the client if a ratio of the first number to the second number is less than or equal to a second threshold;
determining to return the HTTP response to the client if a ratio of the first number to the second number is greater than the second threshold.
In a possible embodiment, the first processing module 43 is further configured to:
receiving an identification application request sent by the client, wherein the identification application request comprises a service corresponding to the client;
determining a target identifier corresponding to the service and a second identifier password corresponding to the target identifier in the identifier information;
and sending the target identification and the second identification password to the client.
In a possible embodiment, the first processing module 43 is further configured to:
and updating the weight corresponding to the identifier in each identifier according to the service corresponding to each identifier.
The HTTP request response device provided in the embodiment of the present application is configured to execute the above method embodiment, and its implementation principle and technical effects are similar, and this embodiment is not repeated here.
Fig. 5 illustrates a physical schematic diagram of an electronic device, as shown in fig. 5, which may include: processor 510, communication interface (Communications Interface) 520, memory 530, and communication bus 540, wherein processor 510, communication interface 520, memory 530 complete communication with each other through communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform an HTTP request response method that applies to a server, including: receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested; determining a target weight corresponding to the target identifier based on a mapping relation between the identifier and the weight in the identifier information; determining a resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient; determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type; and determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
Further, the logic instructions in the memory 530 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present application further provides a computer program product, where the computer program product includes a computer program, where the computer program can be stored on a non-transitory computer readable storage medium, where the computer program when executed by a processor can perform the HTTP request response method provided by the foregoing embodiments, where the method is applied to a server, and includes: receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested; determining a target weight corresponding to the target identifier based on a mapping relation between the identifier and the weight in the identifier information; determining a resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient; determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type; and determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
In still another aspect, the present application further provides a non-transitory computer readable storage medium having stored thereon a computer program that when executed by a processor is implemented to perform the HTTP request response method provided by the above embodiments, the method being applied to a server, including: receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested; determining a target weight corresponding to the target identifier based on a mapping relation between the identifier and the weight in the identifier information; determining a resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient; determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type; and determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (10)

1. A method for responding to a hypertext transfer protocol HTTP request, applied to a server, the method comprising:
receiving an HTTP request sent by a client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested;
determining a target weight corresponding to the target identifier based on a mapping relation between the identifier and the weight in the identifier information;
determining a resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient;
determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type;
and determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
2. The method according to claim 1, wherein the identification information further includes a mapping relationship between the identification and the identification password; the determining the type of the HTTP request according to the target identifier includes:
in the HTTP request, determining a first identification password corresponding to the target identification;
determining a second identification password corresponding to the target identification based on a mapping relation between the identification and the identification password;
if the first identification password is matched with the second identification password, determining that the type is a normal type;
and if the first identification password is not matched with the second identification password, determining that the type is an abnormal type.
3. The method of claim 1, wherein the determining whether to return the HTTP response to the client based on the resource status, the type, and the target weight comprises:
if the type is an abnormal type, determining that the HTTP response is not returned to the client;
if the type is a normal type and the resource state is that the resources are sufficient, determining to return the HTTP response to the client;
and if the type is a normal type and the resource state is insufficient, determining whether to return the HTTP response to the client according to the target weight.
4. The method of claim 3, wherein the determining whether to return the HTTP response to the client based on the target weight comprises:
if the target weight is greater than or equal to a first threshold, determining to return the HTTP response to the client;
and if the target weight is smaller than the first threshold value, determining that the HTTP response is not returned to the client.
5. The method of claim 3, wherein the determining whether to return the HTTP response to the client based on the target weight comprises:
determining a plurality of weights in the identification information;
determining a first number of the plurality of weights that is less than or equal to the target weight and a second number that is greater than the target weight;
determining not to return the HTTP response to the client if a ratio of the first number to the second number is less than or equal to a second threshold;
determining to return the HTTP response to the client if a ratio of the first number to the second number is greater than the second threshold.
6. The method according to any one of claims 1-5, further comprising:
receiving an identification application request sent by the client, wherein the identification application request comprises a service corresponding to the client;
determining a target identifier corresponding to the service and a second identifier password corresponding to the target identifier in the identifier information;
and sending the target identification and the second identification password to the client.
7. The method according to any one of claims 1-5, further comprising:
and updating the weight corresponding to the identifier in each identifier according to the service corresponding to each identifier.
8. An HTTP request response apparatus, comprising:
the receiving module is used for receiving an HTTP request sent by the client, wherein the HTTP request comprises a target identifier corresponding to a service to be requested;
the first determining module is used for determining a target weight corresponding to the target identifier based on a mapping relation between the identifier in the identifier information and the weight;
the first processing module is used for determining the resource state of the server according to the running information, the residual memory information and the input/output information of the server, wherein the resource state is insufficient or sufficient in resource;
the second determining module is used for determining the type of the HTTP request according to the target identifier, wherein the type is a normal type or an abnormal type;
and the second processing module is used for determining whether to return the HTTP response to the client according to the resource state, the type and the target weight, wherein the HTTP response comprises response data corresponding to the service to be requested.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the HTTP request response method of any of claims 1 to 7 when the program is executed.
10. A non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the HTTP request response method according to any one of claims 1 to 7.
CN202311327968.0A 2023-10-13 2023-10-13 HTTP request response method, device and equipment Pending CN117527775A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311327968.0A CN117527775A (en) 2023-10-13 2023-10-13 HTTP request response method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311327968.0A CN117527775A (en) 2023-10-13 2023-10-13 HTTP request response method, device and equipment

Publications (1)

Publication Number Publication Date
CN117527775A true CN117527775A (en) 2024-02-06

Family

ID=89761474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311327968.0A Pending CN117527775A (en) 2023-10-13 2023-10-13 HTTP request response method, device and equipment

Country Status (1)

Country Link
CN (1) CN117527775A (en)

Similar Documents

Publication Publication Date Title
US20230171285A1 (en) Edge network-based account protection service
EP3451634A1 (en) System and method for cloud-based analytics
CN111104675A (en) Method and device for detecting system security vulnerability
CN112672357B (en) Method and device for processing user account in service system and computer equipment
CN105991412A (en) Method and device for pushing message
JP7391313B2 (en) Web attack detection and blocking system and method using artificial intelligence machine learning behavior-based web protocol analysis
US20210360015A1 (en) Systems and methods of adaptively identifying anomalous network communication traffic
US20200151340A1 (en) Monitoring a blockchain
CN111510325A (en) Alarm information pushing method, server, client and system
CN110661673B (en) Heartbeat detection method and device
CN112839083A (en) Data transmission method and device and readable storage medium
US20180295151A1 (en) Methods for mitigating network attacks through client partitioning and devices thereof
CN115665162A (en) Intelligent shunting engine for gray scale release
CN111556080A (en) Network node monitoring method, device, medium and electronic equipment
KR102275065B1 (en) Apparatus and method for security control
CN117527775A (en) HTTP request response method, device and equipment
CN113596147B (en) Message pushing method, device, equipment and storage medium
CN113766020B (en) Remote control system for satellite navigation receiver equipment and control method thereof
CN110691115B (en) Network service access method and device and service gateway
CN114124935A (en) Method, system, equipment and storage medium for realizing FTP service
KR20220055661A (en) Edge service processing system and control method thereof
CN106790150B (en) Session maintaining method and device
CN111490997A (en) Task processing method, agent system, service system and electronic equipment
KR102180105B1 (en) Method and apparatus for determining malicious software for software installed on device
CN110022301A (en) Firewall is used in internet of things equipment protection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination