CN106656920B - Processing method, device, storage medium and the processor of HTTP service - Google Patents
Processing method, device, storage medium and the processor of HTTP service Download PDFInfo
- Publication number
- CN106656920B CN106656920B CN201510728862.0A CN201510728862A CN106656920B CN 106656920 B CN106656920 B CN 106656920B CN 201510728862 A CN201510728862 A CN 201510728862A CN 106656920 B CN106656920 B CN 106656920B
- Authority
- CN
- China
- Prior art keywords
- http
- processing
- request
- response
- api
- 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.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 10
- 238000012545 processing Methods 0.000 claims abstract description 174
- 230000004044 response Effects 0.000 claims abstract description 152
- 238000000034 method Methods 0.000 claims abstract description 56
- 238000012546 transfer Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 description 21
- 230000006870 function Effects 0.000 description 14
- 238000010586 diagram Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 8
- 241000256836 Apis Species 0.000 description 3
- 239000008186 active pharmaceutical agent Substances 0.000 description 3
- 230000008901 benefit Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000006872 improvement Effects 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/10—Network architectures or network communication protocols for network security for controlling access to devices or network resources
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a kind of processing method and processing devices of HTTP service, are related to technical field of telecommunications, to solve the problems, such as processing HTTP request/response efficiency is low and invents.The method comprise the steps that the HTTP request initiated front end intercepts;Unified batch processing is carried out to the HTTP request of interception;By treated, HTTP request is sent to server;Intercept the http response that the server returns;Unified batch processing is carried out to the http response of interception;By treated, http response is sent to corresponding front end.During carrying out batch processing to the HTTP request based on same or similar service logic/response.
Description
Technical Field
The present invention relates to the field of telecommunication technologies, and in particular, to a method and an apparatus for processing an HTTP service.
Background
Most of the existing network access methods are implemented based on the Hypertext Transfer protocol (HTTP). The client side sends an HTTP request to the server to request to acquire a certain data resource. The server analyzes the content of the HTTP request, performs data query according to the query conditions, and returns the queried data resources to the client in a mode of returning HTTP response.
When sending an HTTP request to a server, it is generally necessary to process the HTTP request on the client side, for example, to rewrite a request method in the HTTP request message header (header), or to add data to the HTTP request message body (body) based on customized service requirements. After receiving the HTTP response returned by the server, the HTTP response also needs to be processed, for example, a data format in a header of the HTTP response message is modified, or a status code in a status line in the HTTP response message is modified. In the prior art, each time a client initiates an HTTP request or receives an HTTP response, the client processes the HTTP request/response through a specific thread.
In the process of processing HTTP requests/responses, the inventors found that when the number of HTTP requests or responses is large, processing a large number of HTTP requests/responses alone consumes processing resources of the client. Especially when the requests or responses are implemented based on the same or similar business requirement logic, the same or similar processing may generate a large amount of redundant operations, making HTTP processing inefficient.
Disclosure of Invention
The invention provides a method and a device for processing an HTTP service, which can solve the problem of low efficiency in processing HTTP requests/responses in the prior art.
In order to solve the foregoing technical problem, in one aspect, the present invention provides a method for processing an HTTP service, where the method includes:
intercepting a hypertext transfer protocol (HTTP) request initiated by a front end;
the intercepted HTTP requests are processed in a unified batch mode;
sending the processed HTTP request to a server;
intercepting an HTTP response returned by the server;
carrying out uniform batch processing on the intercepted HTTP responses;
and sending the processed HTTP response to the corresponding front end.
In another aspect, the present invention further provides an apparatus for processing an HTTP service, where the apparatus includes:
the first interception unit is used for intercepting a hypertext transfer protocol (HTTP) request initiated by a front end;
the first processing unit is used for carrying out uniform batch processing on the intercepted HTTP requests;
the first sending unit is used for sending the processed HTTP request to the server;
the second interception unit is used for intercepting the HTTP response returned by the server;
the second processing unit is used for carrying out uniform batch processing on the intercepted HTTP responses;
and the second sending unit is used for sending the processed HTTP response to the corresponding front end.
The HTTP service processing method and device provided by the invention can intercept the HTTP request sent to the server by the front end and the HTTP response returned to the front end by the server respectively, and perform uniform batch processing on the intercepted HTTP request/response. And then sending the processed HTTP request to a server, and returning the processed HTTP response to the front end. Compared with the prior art, the HTTP request/response processing method and the HTTP request/response processing device can process HTTP requests/responses based on the same or similar business logic in batches, so that redundant operations generated by processing the HTTP requests/responses one by one are saved, and the HTTP processing efficiency is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a processing method of an HTTP service according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating another HTTP service processing method provided by an embodiment of the present invention;
fig. 3 is a block diagram illustrating a processing apparatus of an HTTP service according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides a method for processing an HTTP service, and as shown in fig. 1, the method includes:
101. and intercepting the HTTP request initiated by the front end.
The execution main body of the embodiment can be a client end which has data processing capability and can carry out human-computer interaction through peripheral equipment, such as a mobile phone, a notebook computer, a personal computer, a portable intelligent device and the like. The front end mainly refers to a page/interface for directly interacting with a user. Typically, an application process has at least one page, and thus an application process corresponds to at least one front end.
In practice, a page may initiate an HTTP request based on a user's query operation, which HTTP request is perceivable by the user. In addition, the page may also initiate an HTTP request imperceptible to the user in the background, for example, when the browser renders a web page, the browser kernel needs to request contents such as pictures and characters displayed in the page from the server according to a Cascading Style Sheets (CSS) and a hypertext Markup Language (HTML) source code, and such an HTTP request does not generally interact with the user.
For a client, the number of front ends involved in the client is generally multiple, and each front end may initiate multiple HTTP requests sequentially or simultaneously, so in this embodiment, the client needs to process multiple HTTP requests, and correspondingly, in step 104, the number of HTTP responses that the client receives and needs to process is multiple.
In this embodiment, when the front end initiates an HTTP request, the client intercepts the HTTP request instead of processing each HTTP request separately, and then performs batch processing on a plurality of intercepted HTTP requests in a unified manner.
102. And carrying out unified batch processing on the intercepted HTTP requests.
The processing modes involved in this embodiment include a general processing mode in the prior art, such as a request method for modifying a header of an HTTP request Message, and also include processing based on customized service requirement logic, such as adding a timestamp or an information Digest Algorithm 5 (Message-Digest Algorithm 5, abbreviated as MD5) value to a body of the HTTP request Message. The present embodiment does not limit the specific processing manner of the client.
In the prior art, each time when a front end initiates an HTTP request, a client needs to call a thread resource to process the HTTP request. In this embodiment, the client may intercept the HTTP request to be sent, and then process a plurality of HTTP requests in batch through one thread resource. Compared with the prior art, the method and the device can greatly reduce the calling times of the thread resources, especially for the situation that the HTTP request processing is carried out based on the logic of specific service requirements in an enterprise intranet, because the number of the HTTP requests is large and the processing logic of the HTTP requests is the same or similar, a large number of repeated processing processes (namely redundant operation) can be saved when the HTTP requests are carried out by adopting the method of the embodiment, and thus the consumption of the process resources is greatly reduced.
Further, when the processing logics of different HTTP requests are different, the client may classify the HTTP requests according to the processing logics, and then process the HTTP requests of different categories respectively through the process resources having the same number as the processing logics. In practical applications, the number of processing logic is much smaller than that of HTTP requests, so that even if the number of calls for thread resources is increased, the thread resources consumed by the scheme are extremely limited compared with the prior art.
103. And sending the processed HTTP request to a server.
After the plurality of HTTP requests are processed in batch, the client sends the HTTP requests to the server according to the request method recorded in the HTTP request message and the server information. The client can send all the HTTP requests at the same time, and can also send the HTTP requests successively according to different sending rules. In an implementation manner of this embodiment, the sending rule may be, but is not limited to: 1. sending according to the sequence of the HTTP requests initiated by the front end; 2. sending the data according to the priority of the front end; 3. and sending the messages in sequence according to the requirements of the service on the response time delay.
In this embodiment, one or more servers may be used as the HTTP request receiver, and this embodiment is not limited to the case where the client transmits all HTTP requests to only one server. In practice, which HTTP request is sent to which server is determined by the content (e.g., query string) of the HTTP request.
104. And intercepting the HTTP response returned by the server.
The server analyzes the HTTP request sent by the client after receiving the HTTP request, searches the data content linked with the query character string according to the request method noted in the HTTP request, and then adds the searched data content into the HTTP response and returns the HTTP response to the client.
105. And carrying out unified batch processing on the intercepted HTTP responses.
In the prior art, each time a client receives an HTTP response, the client calls a thread resource to process the HTTP response, and then returns the processed HTTP response to the corresponding front end. In this embodiment, after the server returns the HTTP response, the client intercepts the HTTP response first, then calls a thread resource once, performs batch processing on the plurality of intercepted HTTP responses in a unified manner, and returns the plurality of intercepted HTTP responses to different front ends. Similar to the foregoing step 102, the client may also invoke several thread resources to process HTTP responses of different service logic types, respectively.
In this embodiment, the client may perform general processing on the HTTP response, for example, modify a state code in a state line. The customized service requirement logic may be a customized process, for example, a stamp such as a time stamp added from the HTTP response body analysis server. The present embodiment does not specifically limit the processing manner of the client.
106. And sending the processed HTTP response to the corresponding front end.
After the HTTP response processing is completed, the client returns different HTTP responses to different front ends according to front end information (e.g., front end names or labels) carried in the HTTP responses, thereby completing a complete HTTP request flow.
The method provided by the embodiment can be applied to a scene of establishing an HTTP long connection between the client and the server, and can also be applied to a scene of establishing an HTTP short connection between the client and the server.
Further, as a refinement to the method shown in fig. 1, an embodiment of the present invention further provides a method for processing an HTTP service, as shown in fig. 2, where the method includes:
201. when the front end initiates an HTTP request, a request interception Hook function is called to suspend the native request API.
In the prior art, when a front end initiates an HTTP request, a client calls an Application Programming Interface (API) to perform individual processing on the HTTP request, and then sends the HTTP request to a server. In this step, the client uses Hook function to intercept the HTTP request. When the front end initiates an HTTP request, the client calls a request Hook function to suspend the native request API. Then, step 202 is executed, and the HTTP request is processed in a unified batch through a preset request processing API.
202. And calling a preset request processing API to perform uniform batch processing on the HTTP requests.
Unlike native APIs that are system-resident, the request processing API needs to be written by the network administrator. The request processing API is written with a custom logic for processing HTTP request, and the custom logic can be consistent with the processing logic of the general processing mode in the prior art or can be a custom logic according to different service requirements. More typical custom logic may be: a timestamp is added to the HTTP request body (which of course could also be a header).
And the client performs unified batch processing on the plurality of HTTP requests according to the customized logic in the request processing API.
In an application scenario of this embodiment, the customization logic may rewrite header data of the HTTP request message. Based on the existing HTTP protocol, the header of the HTTP request includes three parts, namely a request method, a Uniform Resource Locator (URL), and a version of the HTTP protocol. In practical application, the request method specifically includes GET, POST, HEAD, PUT, DELETE, OPTIONS, TRACE, CONNECT, etc.; the query character string in the URL is used for the server to search the data content required by the front end; the HTTP protocol versions are currently used in many cases, including HTTP 0.9, HTTP 1.0, and HTTP 1.1. Rewriting header information of an HTTP request message is described below as an example.
In a scene of locally shielding illegal external connection based on a client, a certain person logs in an Taobao website to carry out online shopping. When an employee opens a link of a Taobao network in a browser, the front end of the browser initiates an HTTP request for requesting a Taobao homepage to a server, and the header content of the HTTP request message is' GETwww.taobao.comHTTP1.1 ". According to the processing logic set by the network administrator, after the client intercepts the HTTP request, the client intercepts the URL'www.taobao.com"overwrite to an invalid domain name, thereby obtaining the processed header content as" GETwww.xxxxxxx.comHTTP1.1 ". And then the client sends the HTTP request to a network side server. Because the URL in the HTTP request is invalid, the network side server cannot return any useful page, and therefore the shielding function of the internet access behavior can be realized. Of course, the URL may be rewritten to a URL set by the network manager to prompt a prompt page for prohibiting logging into the external network.
In another application scenario of this embodiment, the customization logic may also add, delete or rewrite the body data of the HTTP request message. The operation of adding, deleting and modifying the data of the body part of the HTTP request message needs to be executed based on a pre-agreed private protocol, so that the modified data can meet the field format requirement of the body part of the HTTP request message. The following describes an example of adding data to a body part.
In some application scenarios, the server needs to obtain the time information when the client initiates the HTTP request. After intercepting the HTTP request initiated by the front end, the client acquires the request initiation time recorded according to the system clock, then calls the request processing API, writes the time into a certain pre-agreed field of the HTTP request message body in the form of a timestamp according to the customized logic in the API, and acquires the processed HTTP request.
In practical applications, the client in this embodiment may perform batch processing of a large number of HTTP requests by using a basic request processing API, such as rewriting URLs, adding timestamps, and other customized logic.
It should be noted that the meaning of unified processing in this embodiment means that consistency of processing logic for different HTTP requests is guaranteed, and not only means that the processing results are absolutely the same. For example, in the above scenario of screening for offending outstrings, the URLs of all HTTP requests may be modified to the same specific and specific URL ″, e.g.www.xxxxxx.com"such processing logic causes the URL in each HTTP request to become the same new URL; in the above scenario of adding timestamps, the consistency of the processing logic is that "the time when the HTTP request is generated is added to the HTTP request", but the specific values of the timestamps added in different HTTP requests are different.
203. And after the HTTP requests are processed in a unified batch mode, the processed HTTP requests are sent to a server.
The client side can send the processed HTTP request to the server through the request processing API, and can also call the native request API to take over the request processing API, and send the processed HTTP request to the server through the native request API.
204. When the server returns an HTTP response, the response interception Hook function is called to suspend the native response API.
In the prior art, when the server returns the HTTP response, the client calls the native response API to perform separate processing on the HTTP response, and then returns the HTTP response to the front end. In this step, the client uses Hook function to intercept the HTTP response. When the server returns an HTTP response, the client calls the request Hook function to suspend the native response API. Then, step 205 is executed to perform uniform batch processing on the HTTP response through a preset response processing API.
205. And calling a preset response processing API to perform uniform batch processing on the HTTP responses.
Unlike native APIs that are system-owned, response processing APIs need to be written by a network administrator. The response processing API is written with a custom logic for processing HTTP responses, which may be consistent with the processing logic of the general processing manner in the prior art, or may be a custom logic according to different service requirements. More typical custom logic may be: the status code in the HTTP response is overwritten.
And the client performs unified batch processing on the multiple HTTP responses according to the customized logic in the response processing API.
In an application scenario of this embodiment, the customized logic for processing the HTTP response may be to rewrite header data of the HTTP response packet, for example, modify information in a URL; or, the body data of the HTTP response message may be subjected to an addition/deletion process, for example, a response identifier or a timestamp assigned by the server is added. Or, the status line data of the HTTP response packet may be rewritten, for example, in a scenario of shielding an illegal external connection, the status code 202 is modified into the status code 404.
206. And after the HTTP responses are processed in a unified batch mode, the processed HTTP responses are sent to the corresponding front end.
The client side can send the processed HTTP response to the corresponding front end through the response processing API, or call the native response API to take over the response processing API, and send the processed HTTP response to the corresponding front end through the native response API.
Further, in order to avoid a long HTTP service delay caused by intercepting the HTTP request/response, in an improvement of this embodiment, a front end serving as an intercepted object or an intercepted time limit may be set. For setting the interception front end, the client may be set to intercept only HTTP requests/responses related to the front end of some application or some applications, and to process HTTP requests/responses related to the front end of other applications according to the existing implementation manner. Specifically, the client may intercept and process an HTTP request initiated by the first selected front end according to the setting, and intercept an HTTP response returned by the processing server to the second selected front end, where the first selected front end and the second selected front end may or may not be identical in content and quantity. Because the range of the number of front ends for intercepting the HTTP is narrowed, the probability of waiting for initiating the HTTP request or returning the HTTP response can be reduced, and the service delay of the HTTP is shortened.
For setting the interception time, the client may intercept HTTP requests/responses within a preset time period, and when the time period is exceeded, the HTTP requests/responses initiated or returned are processed in the existing processing manner. Specifically, the client may intercept, according to the setting, an HTTP request initiated by the front end within a first predetermined period, and intercept, by the processing server, an HTTP response returned within a second predetermined period, where the lengths of the first predetermined period and the second predetermined period may be the same or different. Since the time for waiting for an HTTP request/response is limited, an increase in delay caused by waiting indefinitely for an HTTP request or HTTP response can be prevented.
In addition, in practical application, the number of HTTP requests or HTTP responses intercepted by the client at one time can be set, so that the effect of preventing the HTTP service from being too long in time delay can be achieved.
Further, as an implementation of the method shown in fig. 1 and fig. 2, an embodiment of the present invention further provides a processing apparatus for HTTP service, where the apparatus may be located inside a client or may be independent of the client, and is used as a mediation device between the client and a server. It should be noted that the present apparatus embodiment corresponds to the foregoing method embodiment, and all of the contents of the foregoing method embodiment can be implemented. For convenience of reading, the present apparatus embodiment only performs a summary description on the contents in the foregoing method embodiments, and details in the method embodiments are not repeated. As shown in fig. 3, the apparatus includes: a first interception unit 31, a first processing unit 32, a first sending unit 33, a second interception unit 34, a second processing unit 35, and a second sending unit 36. Wherein,
a first intercepting unit 31, configured to intercept a hypertext transfer protocol HTTP request initiated by a front end;
the first processing unit 32 is used for performing uniform batch processing on the intercepted HTTP requests;
a first sending unit 33, configured to send the processed HTTP request to the server;
a second intercepting unit 34, configured to intercept an HTTP response returned by the server;
the second processing unit 35 is configured to perform uniform batch processing on the intercepted HTTP responses;
and a second sending unit 36, configured to send the processed HTTP response to the corresponding front end.
Further, the first intercepting unit 31 is configured to call a request intercepting Hook function to suspend the native request application program interface API when the front end initiates the HTTP request;
the first processing unit 32 is configured to call a preset request processing API to perform uniform batch processing on the HTTP request, where a customized logic for processing the HTTP request is written in the request processing API.
Further, the first processing unit 32 is configured to perform unified batch processing on the HTTP request according to a customized logic in the request processing API, where the unified batch processing includes at least one of the following processing manners: and rewriting the header data of the HTTP request message, and adding, deleting or rewriting the body data of the HTTP request message.
Further, the second intercepting unit 34 is configured to call a response intercepting Hook function to suspend the native response API when the server returns an HTTP response;
the second processing unit 35 is configured to call a preset response processing API to perform uniform batch processing on the HTTP responses, where a customized logic for processing the HTTP responses is written in the response processing API.
Further, the second processing unit 35 is configured to perform unified batch processing on the HTTP response according to a customized logic in the response processing API, where the unified batch processing includes at least one of the following processing manners: and rewriting the header data of the HTTP response message and rewriting the status line data of the HTTP response message.
Further, the first intercepting unit 31 is configured to:
intercepting an HTTP request initiated by a first selected front end;
intercepting an HTTP request initiated by a front end within a first preset time period;
the second intercepting unit 34 is configured to:
intercepting an HTTP response returned by the server to a second selected front end;
and intercepting the HTTP response returned by the server in a second preset time period.
The processing apparatus for HTTP service according to this embodiment can intercept HTTP requests sent from the front end to the server and HTTP responses returned from the server to the front end, respectively, and perform unified batch processing on the intercepted HTTP requests/responses. And then sending the processed HTTP request to a server, and returning the processed HTTP response to the front end. Compared with the prior art, the HTTP request/response processing method and the HTTP request/response processing device can perform batch processing on the HTTP requests/responses based on the same or similar business logic, so that redundant operations generated by processing the HTTP requests/responses one by one are saved, and the HTTP processing efficiency is improved.
The processing device of the HTTP service includes a processor and a memory, the first intercepting unit 31, the first processing unit 32, the first transmitting unit 33, the second intercepting unit 34, the second processing unit 35, the second transmitting unit 36, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the purpose of intercepting the HTTP request/response for batch processing is realized by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device: intercepting an HTTP request initiated by a front end; the intercepted HTTP requests are processed in a unified batch mode; sending the processed HTTP request to a server; intercepting an HTTP response returned by the server; carrying out uniform batch processing on the intercepted HTTP responses; and sending the processed HTTP response to the corresponding front end.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A method for processing an HTTP service, the method comprising:
intercepting a hypertext transfer protocol (HTTP) request initiated by a front end;
the intercepted HTTP requests are processed in a unified batch mode;
sending the processed HTTP request to a server;
intercepting an HTTP response returned by the server;
carrying out uniform batch processing on the intercepted HTTP responses;
sending the processed HTTP response to a corresponding front end; the intercepting of the HTTP request initiated by the front end comprises the following steps:
when the front end initiates an HTTP request, calling a request interception Hook function to suspend an API (application program interface) of the native request;
the unified batch processing of the intercepted HTTP requests comprises the following steps:
and calling a preset request processing API to perform uniform batch processing on the HTTP requests, wherein a customized logic for processing the HTTP requests is written in the request processing API.
2. The method according to claim 1, wherein the calling a preset request processing API to perform unified batch processing on the HTTP request comprises:
and performing unified batch processing on the HTTP request according to a customized logic in the request processing API, wherein the unified batch processing comprises at least one of the following processing modes: and rewriting the header data of the HTTP request message, and adding, deleting or rewriting the body data of the HTTP request message.
3. The method according to claim 1, wherein the intercepting the HTTP response returned by the server comprises:
when the server returns an HTTP response, calling a response interception Hook function to suspend the native response API;
the unified batch processing of the intercepted HTTP responses includes:
and calling a preset response processing API to perform uniform batch processing on the HTTP responses, wherein a customized logic for processing the HTTP responses is written in the response processing API.
4. The method according to claim 3, wherein the calling a preset response processing API performs unified batch processing on the HTTP response, and comprises:
and performing unified batch processing on the HTTP response according to a customized logic in the response processing API, wherein the unified batch processing comprises at least one of the following processing modes: and rewriting the header data of the HTTP response message and rewriting the status line data of the HTTP response message.
5. The method according to any of claims 1 to 4, wherein intercepting the front-end initiated HTTP request comprises:
intercepting an HTTP request initiated by a first selected front end; and/or the presence of a gas in the gas,
intercepting an HTTP request initiated by a front end within a first preset time period;
the intercepting the HTTP response returned by the server comprises the following steps:
intercepting an HTTP response returned by the server to a second selected front end; and/or the presence of a gas in the gas,
and intercepting the HTTP response returned by the server in a second preset time period.
6. An apparatus for processing an HTTP service, the apparatus comprising:
the first interception unit is used for intercepting a hypertext transfer protocol (HTTP) request initiated by a front end;
the first processing unit is used for carrying out uniform batch processing on the intercepted HTTP requests;
the first sending unit is used for sending the processed HTTP request to the server;
the second interception unit is used for intercepting the HTTP response returned by the server;
the second processing unit is used for carrying out uniform batch processing on the intercepted HTTP responses;
the second sending unit is used for sending the processed HTTP response to the corresponding front end;
the first interception unit is used for calling a request interception Hook function to suspend an original request application program interface API when the front end initiates an HTTP request;
the first processing unit is used for calling a preset request processing API to perform unified batch processing on the HTTP requests, and the request processing API is written with a customized logic for processing the HTTP requests.
7. The apparatus of claim 6, wherein the first processing unit is configured to perform unified batch processing on the HTTP request according to a customized logic in the request processing API, and wherein the unified batch processing includes at least one of the following processing manners: and rewriting the header data of the HTTP request message, and adding, deleting or rewriting the body data of the HTTP request message.
8. The apparatus according to claim 6, wherein the second intercepting unit is configured to call a response intercepting Hook function to suspend a native response API when the server returns an HTTP response;
the second processing unit is used for calling a preset response processing API to perform unified batch processing on the HTTP responses, and the response processing API is written with a customized logic for processing the HTTP responses.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device where the storage medium is located is controlled to execute the HTTP service processing method according to any one of claims 1 to 5.
10. A processor, configured to execute a program, wherein the program executes the processing method of the HTTP service according to any one of claim 1 to claim 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510728862.0A CN106656920B (en) | 2015-10-30 | 2015-10-30 | Processing method, device, storage medium and the processor of HTTP service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510728862.0A CN106656920B (en) | 2015-10-30 | 2015-10-30 | Processing method, device, storage medium and the processor of HTTP service |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106656920A CN106656920A (en) | 2017-05-10 |
CN106656920B true CN106656920B (en) | 2019-09-06 |
Family
ID=58810949
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510728862.0A Active CN106656920B (en) | 2015-10-30 | 2015-10-30 | Processing method, device, storage medium and the processor of HTTP service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106656920B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108322470A (en) * | 2018-02-07 | 2018-07-24 | 链家网(北京)科技有限公司 | A kind of network request processing method and processing device |
CN110535751B (en) * | 2019-08-19 | 2023-01-24 | 深圳追一科技有限公司 | Message response method and device, computer equipment and storage medium |
CN110740132A (en) * | 2019-10-10 | 2020-01-31 | 苏州浪潮智能科技有限公司 | method and device for detecting web page application firewall |
CN111162879A (en) * | 2019-12-23 | 2020-05-15 | 五八有限公司 | Data transmission method and device, electronic equipment and storage medium |
CN111740996B (en) * | 2020-06-22 | 2021-06-22 | 四川长虹电器股份有限公司 | Method for rapidly splitting HTTP request and response in flow analysis scene |
CN112965739B (en) * | 2021-02-08 | 2024-02-09 | 中国工商银行股份有限公司 | Front-end HTTP request processing method, device and system |
CN114138507B (en) * | 2021-11-09 | 2024-05-17 | 中国联合网络通信集团有限公司 | Python program service method, device and computer readable storage medium |
CN115277187A (en) * | 2022-07-26 | 2022-11-01 | 新明珠集团股份有限公司 | Method, device, storage medium and equipment for prompting request data verification result |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102387206A (en) * | 2011-10-20 | 2012-03-21 | 镇江睿泰信息科技有限公司 | Synthesis method and system of concurrent request of Web service |
CN103229486A (en) * | 2012-12-03 | 2013-07-31 | 华为技术有限公司 | Batch file transmission method and device |
CN104980421A (en) * | 2014-10-15 | 2015-10-14 | 腾讯科技(深圳)有限公司 | Method and system for processing batch requests |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110066676A1 (en) * | 2009-09-14 | 2011-03-17 | Vadim Kleyzit | Method and system for reducing web page download time |
-
2015
- 2015-10-30 CN CN201510728862.0A patent/CN106656920B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102387206A (en) * | 2011-10-20 | 2012-03-21 | 镇江睿泰信息科技有限公司 | Synthesis method and system of concurrent request of Web service |
CN103229486A (en) * | 2012-12-03 | 2013-07-31 | 华为技术有限公司 | Batch file transmission method and device |
CN104980421A (en) * | 2014-10-15 | 2015-10-14 | 腾讯科技(深圳)有限公司 | Method and system for processing batch requests |
Also Published As
Publication number | Publication date |
---|---|
CN106656920A (en) | 2017-05-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106656920B (en) | Processing method, device, storage medium and the processor of HTTP service | |
EP2948846B1 (en) | Resource calling for hybrid applications | |
US10015226B2 (en) | Methods for making AJAX web applications bookmarkable and crawlable and devices thereof | |
US8458727B2 (en) | Asynchronous client to server updates | |
CN113190464B (en) | mock testing method and device, electronic equipment and medium | |
CN107315972B (en) | A kind of big data unstructured document dynamic desensitization method and system | |
TW201723897A (en) | Method, device, and system for displaying information associated with a web page | |
WO2013097592A1 (en) | Script loading technology | |
CN112637361B (en) | Page proxy method, device, electronic equipment and storage medium | |
CN109325192B (en) | Advertisement anti-shielding method and device | |
US20180097817A1 (en) | Generating short-term signatures for accessing cloud storage | |
CN111222153A (en) | Application program authority management method and device and storage medium | |
CN109725887B (en) | Data interaction method and device based on message research and development framework and terminal equipment | |
WO2021087858A1 (en) | Web application component migration to a cloud computing system | |
CN111294377B (en) | Dependency network request sending method, terminal device and storage medium | |
WO2017096826A1 (en) | Method and device for controlling mobile terminal | |
CN114218156A (en) | Data export method, data export device, computer equipment and storage medium | |
CN112926002A (en) | Service request processing method and device | |
CN111338928A (en) | Chrome-based browser testing method and device | |
CN114637508A (en) | VUE-based label parameter transfer method, device, equipment and storage medium | |
CN109600403B (en) | Method and device for sending information | |
US11017032B1 (en) | Document recovery utilizing serialized data | |
WO2021004792A1 (en) | Methods for controlling tracking elements of a web page and related electronic devices | |
CN114817166B (en) | Method, device and medium for canceling file operation | |
CN109428915B (en) | Data acquisition method and device |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |