CN107770230B - Method and device for processing hypertext transfer protocol request and Web server - Google Patents

Method and device for processing hypertext transfer protocol request and Web server Download PDF

Info

Publication number
CN107770230B
CN107770230B CN201610704637.8A CN201610704637A CN107770230B CN 107770230 B CN107770230 B CN 107770230B CN 201610704637 A CN201610704637 A CN 201610704637A CN 107770230 B CN107770230 B CN 107770230B
Authority
CN
China
Prior art keywords
http request
pseudo
web server
identifier
web browser
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
Application number
CN201610704637.8A
Other languages
Chinese (zh)
Other versions
CN107770230A (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201610704637.8A priority Critical patent/CN107770230B/en
Publication of CN107770230A publication Critical patent/CN107770230A/en
Application granted granted Critical
Publication of CN107770230B publication Critical patent/CN107770230B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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]

Abstract

The invention relates to a method and a device for processing a hypertext transfer protocol request and a Web server, wherein the method comprises the following steps: after the Web browser sends an HTTP request to the Web server, the Web browser gives up receiving corresponding response information; the Web server saves the processing progress and the key node state of the HTTP request when processing the HTTP request; when the preset time after the Web browser sends the HTTP request arrives, sending a pseudo HTTP request to the Web server by the Web browser; after receiving the pseudo HTTP request, the Web server acquires corresponding processing progress and key node states according to the corresponding relation between the pseudo HTTP request and the HTTP request; and the Web server takes the processing progress and the key node state as real response information of the pseudo HTTP request and returns the real response information to the Web browser. The invention can avoid communication interruption caused by interruption or error reporting.

Description

Method and device for processing hypertext transfer protocol request and Web server
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for processing a hypertext transfer protocol request, and a Web server.
Background
At present, after a user terminal sends a hypertext transfer Protocol (HTTP) request to a Web server through a Web browser, the Web browser receives response information of the Web server to the HTTP request from the Web server, and if the response information of the Web server is not received within a preset time after the HTTP request is sent, the Web browser interrupts data interaction with the Web server and reports an error. In order to avoid excessive interruption and error reporting, the existing method is usually to increase the timeout duration of the gateway (i.e. increase the preset time), but the existing method has the following disadvantages: 1. the setting of the gateway timeout duration is difficult to change even can not be changed in some scenes; 2. increasing the gateway timeout duration can result in wasted network resources.
Disclosure of Invention
The invention aims to provide a method and a device for processing a hypertext transfer protocol request and a Web server.
The technical scheme for solving the technical problems is as follows: a processing method of a hypertext transfer protocol request comprises the following steps:
s1, after the Web browser sends an HTTP request to the Web server, the Web browser abandons the response information of the Web server for the HTTP request from the Web server;
s2, the Web server saves the processing progress and the key node state of the HTTP request when processing the HTTP request;
s3, when the preset time after the Web browser sends the HTTP request arrives, sending a pseudo HTTP request corresponding to the HTTP request to the Web server by the Web browser;
s4, after receiving the pseudo HTTP request, the Web server acquires the stored processing progress and key node state corresponding to the HTTP request according to the corresponding relation between the pseudo HTTP request and the HTTP request;
and S5, the Web server takes the acquired processing progress and the key node state as real response information of the pseudo HTTP request and returns the real response information to the Web browser.
Preferably, the pseudo HTTP request is identical to request information of the HTTP request.
Preferably, before the step S1, the method further includes:
the Web browser generates the HTTP request and configures a first identifier of the HTTP request at the same time, and encapsulates the first identifier in the HTTP request;
before the step S3, the method further includes:
before the preset time after the Web browser sends the HTTP request is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, configuring a second identifier of the pseudo HTTP request, and encapsulating the second identifier in the pseudo HTTP request, wherein the second identifier is associated with the first identifier;
the step S4 includes:
s41, after receiving the pseudo HTTP request, the Web server analyzes the pseudo HTTP request and acquires a second identifier in the HTTP request;
and S42, determining the HTTP request corresponding to the first identifier associated with the second identifier, and acquiring the stored processing progress and the key node state corresponding to the determined HTTP request.
Preferably, after the step S3, the method further includes:
after receiving the pseudo HTTP request, if no HTTP request corresponds to the pseudo HTTP request, the Web server returns response information in a preset format to the Web browser, or the Web server takes the pseudo HTTP request as an HTTP request to process and sends an instruction for resending the pseudo HTTP request to the Web browser;
and when the preset time after the Web browser sends the pseudo HTTP request arrives, sending the pseudo HTTP request consistent with the pseudo HTTP request to the Web server again by the Web browser.
The technical scheme for solving the technical problems is as follows: an apparatus based on the processing method of the hypertext transfer protocol request, where a Web browser runs in the apparatus, and the Web browser includes:
the abandoning module is used for abandoning the response information of the Web server aiming at the HTTP request received from the Web server after the HTTP request is sent to the Web server;
the first sending module is used for sending a pseudo HTTP request corresponding to the HTTP request to the Web server when the preset time after the HTTP request is sent is up;
and the receiving module is used for receiving the real response information of the pseudo HTTP request returned by the Web server, wherein the real response information of the pseudo HTTP request is the processing progress and the key node state corresponding to the HTTP request.
Preferably, the Web browser further includes a configuration module, configured to generate the HTTP request and configure a first identifier of the HTTP request, and encapsulate the first identifier in the HTTP request; before the preset time after the HTTP request is sent is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, a second identifier of the pseudo HTTP request is configured, and the second identifier is packaged in the pseudo HTTP request, so that the Web server can determine the HTTP request corresponding to the pseudo HTTP request through the first identifier and the second identifier, wherein the second identifier is associated with the first identifier.
Preferably, the Web browser further includes a second sending module, configured to send, when receiving response information in a preset format returned by the Web server or receiving a resending instruction sent by the Web server and when a preset time after sending the pseudo HTTP request arrives, a pseudo HTTP request that is consistent with the pseudo HTTP request to the Web server again until the receiving module receives real response information of the pseudo HTTP request returned by the Web server.
The technical scheme for solving the technical problems is as follows: a Web server based on the processing method of the hypertext transfer protocol request, the Web server comprising:
the storage module is used for storing the processing progress and the key node state of the HTTP request when the HTTP request is processed after the HTTP request sent by the Web browser is received;
the acquisition module is used for acquiring the stored processing progress and the key node state corresponding to the HTTP request according to the corresponding relation between the pseudo HTTP request and the HTTP request after receiving the pseudo HTTP request;
and the first returning module is used for returning the acquired processing progress and the key node state to the Web browser as the real response information of the pseudo HTTP request.
Preferably, the obtaining module includes:
the analysis unit is used for analyzing the pseudo HTTP request and acquiring a second identifier in the HTTP request after receiving the pseudo HTTP request;
and the determining unit is used for determining the HTTP request corresponding to the first identifier associated with the second identifier and acquiring the saved processing progress corresponding to the determined HTTP request and the key node state.
Preferably, the Web server further includes:
and the second returning module is used for returning response information in a preset format to the Web browser after receiving the pseudo HTTP request if no HTTP request corresponds to the pseudo HTTP request, or processing the pseudo HTTP request as an HTTP request and sending an instruction for resending the pseudo HTTP request to the Web browser.
The invention has the beneficial effects that: the invention is characterized in that after the Web browser sends an HTTP request to the Web server, the Web browser does not receive response information of the Web server aiming at the HTTP request, but enters a waiting state, meanwhile, the Web server stores the corresponding processing progress and key node state when processing the HTTP request until a preset time is reached, at the moment, in order to avoid interruption or error reporting, the Web browser sends a pseudo HTTP request corresponding to the HTTP request to the Web server so that the server determines the corresponding HTTP request according to the pseudo HTTP request, then the processing progress and key node state of the corresponding HTTP request can be obtained, finally, the Web server can return the obtained processing progress and key node state to the Web browser, the interruption or error reporting between the Web browser and the Web server is avoided, and the Web browser can obtain the processing progress and key node state corresponding to the HTTP request, compared with the method for increasing the time-out duration of the gateway, the method for controlling the time-out duration of the gateway does not need to increase the time duration of the gateway, so that related settings do not need to be changed, and network resources are saved.
Drawings
FIG. 1 is a flowchart illustrating a method for handling a HTTP request according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of step S4 shown in FIG. 1;
FIG. 3 is a schematic structural diagram illustrating an embodiment of an apparatus for handling a HTTP request according to the present invention;
fig. 4 is a schematic structural diagram of an embodiment of a Web server based on the above-mentioned method for processing a hypertext transfer protocol request according to the present invention.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, fig. 1 is a schematic flowchart of an embodiment of a method for processing a hypertext transfer protocol request according to the present invention, where the method for processing a hypertext transfer protocol request includes the following steps:
step S1, after the Web browser sends an HTTP request to the Web server, the Web browser abandons the receiving of the response information of the Web server for the HTTP request from the Web server;
in this embodiment, the Web browser is executed in a user terminal, and the user terminal may be, for example, a mobile phone, a computer, a tablet computer, a Personal Digital Assistant (PDA), a wearable device (e.g., a smart watch, smart glasses, etc.), or any other suitable electronic device. When a user uses the user terminal, the Web browser is triggered to send an HTTP request to the Web server, wherein the HTTP request is different from a common HTTP request, the HTTP request can enable the Web browser to obtain webpage related information returned by the Web server, the common HTTP request may not obtain the webpage related information returned by the Web server due to interruption and the like, and the HTTP request can be identified as the HTTP request so as to be distinguished from the common HTTP request.
In this embodiment, in the running process of the Web browser, a user may trigger the Web browser to send one HTTP request to the Web server, or continuously send a plurality of HTTP requests.
If the interruption does not occur according to the normal flow, the Web server returns response information to the Web browser according to the HTTP request, and if the interruption occurs, the Web browser cannot receive the corresponding response information. Whether the interruption occurs or not or whether the response information is returned to the Web browser by the Web server or not, the Web browser abandons the corresponding response information returned by the Web server, namely, the Web browser does not execute the operation of receiving the response information returned by the Web browser.
Step S2, the Web server saves the processing progress and the key node state of the HTTP request when processing the HTTP request;
in this embodiment, after receiving the HTTP request sent by the Web browser, the Web server performs an operation according to a normal flow, that is, performs a related processing operation on the HTTP request, acquires a processing progress and a key node state in a processing process, and stores the processing progress and the key node state in association with the HTTP request.
The processing progress is the progress of the Web server processing the HTTP request, and the key node state is, for example, a state of whether the request is successfully processed, a state of whether the requested Web page has been permanently moved to a new location, and the like, that is, the processing progress and the key node state are information related to the Web page. And then storing the acquired processing progress and the state of the key node for subsequent use.
Step S3, when the preset time after the Web browser sends the HTTP request arrives, the Web browser sends a pseudo HTTP request corresponding to the HTTP request to the Web server;
in this embodiment, after sending the HTTP request to the Web server, the Web browser does not perform an operation of receiving response information returned by the Web server, but enters a waiting state, and when a preset time after sending the HTTP request arrives, sends a dummy HTTP request corresponding to the HTTP request to the Web server, where the dummy HTTP request corresponds to the HTTP request, and the HTTP request may be considered as a real HTTP request.
The pseudo HTTP request is generated after the HTTP request, and the request information of the pseudo HTTP request coincides with the HTTP request so that the Web browser can obtain response information of the HTTP request from the Web server regardless of occurrence of an interrupt. Among other things, pseudo HTTP requests may be identified to correlate with HTTP requests and to distinguish from ordinary HTTP requests.
Step S4, after receiving the pseudo HTTP request, the Web server obtains the saved processing progress and key node state corresponding to the HTTP request according to the corresponding relation between the pseudo HTTP request and the HTTP request;
in this embodiment, after receiving the pseudo HTTP request sent by the Web browser, the Web server parses the pseudo HTTP request, obtains request information of the pseudo HTTP request through the parsed content, and compares the request information with request information of the stored HTTP request to obtain whether the pseudo HTTP request corresponds to the request information of the stored HTTP request. If the two are corresponding, the processing progress and the key node state saved during the processing of the HTTP request can be obtained, and if the two are not corresponding, the corresponding processing progress and the key node state cannot be directly obtained.
In step S5, the Web server returns the acquired processing progress and key node status to the Web browser as the actual response information of the pseudo HTTP request.
In this embodiment, after the Web server acquires the processing progress and the key node state corresponding to the determined HTTP request, the acquired processing progress and key node state are used as real response information of the pseudo HTTP request, and then returned to the Web browser.
Compared with the prior art, after the Web browser sends the HTTP request to the Web server, the Web browser of this embodiment enters a waiting state without receiving response information of the Web server for the HTTP request, and at the same time, the Web server stores the corresponding processing progress and the key node state until a preset time is reached, at this time, to avoid an interruption or an error report, the Web browser sends a pseudo HTTP request corresponding to the HTTP request to the Web server, so that the server determines the corresponding HTTP request according to the pseudo HTTP request, and then can acquire the processing progress and the key node state of the corresponding HTTP request, and finally the Web server can return the acquired processing progress and the key node state to the Web browser, thereby avoiding an interruption or an error report between the Web browser and the Web server, and the Web browser can acquire the processing progress and the key node state corresponding to the HTTP request, compared with the method for increasing the time length of the gateway overtime, the method for increasing the time length of the gateway does not need to increase the time length of the gateway (namely the time length of the existing gateway can be kept unchanged), so that related settings do not need to be changed, and network resources are saved.
In a preferred embodiment, on the basis of the embodiment of fig. 1, the step S1 is preceded by:
the Web browser generates the HTTP request and configures a first identifier of the HTTP request at the same time, and encapsulates the first identifier in the HTTP request;
the step S3 includes: before the preset time after the Web browser sends the HTTP request is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, configuring a second identifier of the pseudo HTTP request, and encapsulating the second identifier in the pseudo HTTP request, wherein the second identifier is associated with the first identifier;
in this embodiment, while generating an HTTP request, the Web browser configures a first identifier for the generated HTTP request, identifies the HTTP request with the first identifier, and encapsulates the first identifier in the HTTP request, for example, encapsulates the first identifier in a protocol header of the HTTP request.
In addition, before the preset time after the HTTP request is sent is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, a second identifier is configured for the pseudo HTTP request at the same time, the pseudo HTTP request is identified by the second identifier, and then the second identifier is encapsulated in the pseudo HTTP request, for example, the second identifier is encapsulated in a protocol header of the pseudo HTTP request. Wherein the second identifier is associated with the first identifier, and the first identifier associated with the second identifier can be found through the second identifier.
Preferably, as shown in fig. 2, on the basis of the foregoing embodiment, the foregoing step S4 includes:
s41, after receiving the pseudo HTTP request, the Web server analyzes the pseudo HTTP request and acquires a second identifier in the HTTP request;
and S42, determining the HTTP request corresponding to the first identifier associated with the second identifier, and acquiring the stored processing progress and the key node state corresponding to the determined HTTP request.
In this embodiment, since the HTTP request and the pseudo HTTP request are both encapsulated with the identifier, after the pseudo HTTP request is received by the Web server, the pseudo HTTP request is analyzed, for example, a protocol header of the pseudo HTTP request is analyzed, so that the second identifier can be obtained. In addition, the Web server analyzes the HTTP request after receiving the HTTP request and caches the first identifier obtained by analysis. Therefore, the HTTP request to which the first identifier belongs can be found through the association relationship between the second identifier and the first identifier, and finally, the processing progress and the key node state corresponding to the HTTP request, which are stored, are obtained through the found HTTP request.
In the embodiment, corresponding identifiers are configured for the HTTP request and the pseudo HTTP request respectively when the HTTP request and the pseudo HTTP request are generated, and the identifiers of the HTTP request and the corresponding pseudo HTTP request are associated, so that the HTTP request can be found through the identifier in the pseudo HTTP request in the subsequent Web server, and thus, the processing progress and the key node state corresponding to the HTTP request are obtained.
In a preferred embodiment, on the basis of the embodiment of fig. 1, the step S3 is followed by:
after receiving the pseudo HTTP request, if no HTTP request corresponds to the pseudo HTTP request, the Web server returns response information in a preset format to the Web browser, or the Web server takes the pseudo HTTP request as an HTTP request to process and sends an instruction for resending the pseudo HTTP request to the Web browser;
and when the preset time after the Web browser sends the pseudo HTTP request arrives, sending the pseudo HTTP request consistent with the pseudo HTTP request to the Web server again by the Web browser.
In this embodiment, after receiving the pseudo HTTP request, the Web server analyzes whether there is a corresponding HTTP request by analyzing, for example, performing association lookup through an identifier, and if it is analyzed that there is no HTTP request corresponding to the pseudo HTTP request at present (for example, the Web server fails to analyze and obtain a corresponding HTTP request due to an error in the process of processing the HTTP request or due to a failure to store a processing result, etc.);
in an embodiment, the Web server may return response information in a preset format to inform that the Web browser does not currently have a corresponding HTTP request, for example, the response information in the preset format is response information with empty response content.
In another embodiment, the Web server processes the pseudo HTTP request as one HTTP request, namely, acquiring the processing progress and the key node state of the pseudo HTTP request in the processing process, saving the processing progress and the key node state of the pseudo HTTP request, and sends an instruction to resend the pseudo HTTP request to the Web browser, returns to step S4 described above and loops, that is, after receiving the instruction, the Web browser sends a pseudo HTTP request to the Web server again, after receiving the pseudo HTTP request, the Web server determines an HTTP request corresponding to the pseudo HTTP request to obtain a processing progress of the HTTP request and a key node state, namely, the loop step is executed until the process progress of the HTTP request is obtained and the state of the key node is finished, or whether the Web browser acquires the processing progress of the HTTP request and the state of the key node or not, the Web server sends a preset number of instructions for resending the pseudo HTTP request to the Web browser and then finishes the process.
As shown in fig. 3, fig. 3 is a schematic structural diagram of an embodiment of an apparatus for processing a hypertext transfer protocol request according to the present invention, where the apparatus runs a Web browser, and the Web browser includes:
a discarding module 101, configured to discard receiving, from a Web server, response information of the Web server for an HTTP request after sending the HTTP request to the Web server;
in this embodiment, the Web browser is executed in a user terminal, and the user terminal may be, for example, a mobile phone, a computer, a tablet computer, a Personal Digital Assistant (PDA), a wearable device (e.g., a smart watch, smart glasses, etc.), or any other suitable electronic device. When a user uses the user terminal, the Web browser is triggered to send an HTTP request to the Web server, wherein the HTTP request is different from a common HTTP request, the HTTP request can enable the Web browser to obtain webpage related information returned by the Web server, the common HTTP request may not obtain the webpage related information returned by the Web server due to interruption and the like, and the HTTP request can be identified as the HTTP request so as to be distinguished from the common HTTP request.
In this embodiment, in the running process of the Web browser, a user may trigger the Web browser to send one HTTP request to the Web server, or continuously send a plurality of HTTP requests.
If the interruption does not occur, the Web server returns response information to the Web browser according to the HTTP request, and if the interruption occurs, the Web browser cannot receive the corresponding response information. Whether the interruption occurs or not or whether the response information is returned to the Web browser by the Web server or not, the Web browser abandons the corresponding response information returned by the Web server, namely, the Web browser does not execute the operation of receiving the response information returned by the Web browser.
A first sending module 102, configured to send, to the Web server, a pseudo HTTP request corresponding to the HTTP request when a preset time after the HTTP request is sent arrives;
a receiving module 103, configured to receive real response information of the pseudo HTTP request returned by the Web server, where the real response information of the pseudo HTTP request is a processing progress and a key node state corresponding to the HTTP request.
In this embodiment, after sending the HTTP request to the Web server, the Web browser does not perform an operation of receiving response information returned by the Web server, but enters a waiting state, and when a preset time after sending the HTTP request arrives, sends a dummy HTTP request corresponding to the HTTP request to the Web server, where the dummy HTTP request corresponds to the HTTP request, and the HTTP request may be considered as a real HTTP request.
The pseudo HTTP request is generated after the HTTP request, and the request information of the pseudo HTTP request coincides with the HTTP request so that the Web browser can obtain response information of the HTTP request from the Web server regardless of occurrence of an interrupt. Among other things, pseudo HTTP requests may be identified to correlate with HTTP requests and to distinguish from ordinary HTTP requests.
The method comprises the steps that after a Web server receives a pseudo HTTP request sent by a Web browser, the pseudo HTTP request is analyzed to analyze whether the HTTP request corresponds to the pseudo HTTP request, if the HTTP request corresponds to the pseudo HTTP request, the processing progress and the key node state saved when the HTTP request is processed can be obtained, the obtained processing progress and the key node state are used as real response information of the pseudo HTTP request and sent to the Web browser, the Web browser receives real response information of the pseudo HTTP request returned by the Web server, and the real response information is the processing progress and the key node state corresponding to the HTTP request.
In a preferred embodiment, on the basis of the embodiment of fig. 3, the Web browser further includes a configuration module, configured to generate the HTTP request and configure a first identifier of the HTTP request, and encapsulate the first identifier in the HTTP request; before the preset time after the HTTP request is sent is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, a second identifier of the pseudo HTTP request is configured, and the second identifier is packaged in the pseudo HTTP request, so that the Web server can determine the HTTP request corresponding to the pseudo HTTP request through the first identifier and the second identifier, wherein the second identifier is associated with the first identifier.
In this embodiment, while generating an HTTP request, the Web browser configures a first identifier for the generated HTTP request, identifies the HTTP request with the first identifier, and encapsulates the first identifier in the HTTP request, for example, encapsulates the first identifier in a protocol header of the HTTP request.
In addition, before the preset time after the HTTP request is sent is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, a second identifier is configured for the pseudo HTTP request at the same time, the pseudo HTTP request is identified by the second identifier, and then the second identifier is encapsulated in the pseudo HTTP request, for example, the second identifier is encapsulated in a protocol header of the pseudo HTTP request. Wherein the second identifier is associated with the first identifier, and the first identifier associated with the second identifier can be found through the second identifier.
In a preferred embodiment, on the basis of the foregoing embodiment, the Web browser further includes a second sending module, configured to send, when receiving response information in a preset format returned by the Web server or when receiving a retransmission instruction sent by the Web server and when a preset time after sending the pseudo HTTP request reaches, a pseudo HTTP request that is consistent with the pseudo HTTP request to the Web server again until the receiving module receives real response information of the pseudo HTTP request returned by the Web server.
In this embodiment, if the Web server fails to obtain the corresponding processing progress and the key node state of the HTTP request according to the pseudo HTTP request, a response message in a preset format is returned to the Web browser, where the response message in the preset format is, for example, a response message whose response content is empty, and the Web browser may know that there is no corresponding HTTP request currently; or when a resending instruction sent by the Web server is received and the preset time after the pseudo HTTP request is sent is reached, sending the pseudo HTTP request consistent with the pseudo HTTP request to the Web server again, and executing the operation until the receiving module receives the real response information of the pseudo HTTP request returned by the Web server, or finishing the execution operation after the Web server sends the instruction of resending the pseudo HTTP request for the preset times to the Web browser.
As shown in fig. 4, fig. 4 is a schematic structural diagram of an embodiment of a Web server based on the above-mentioned processing method of a hypertext transfer protocol request, where the Web server includes:
the saving module 201 is configured to, after receiving a transmitted HTTP request sent by a Web browser, save a processing progress of the HTTP request and a state of a key node when processing the HTTP request;
in this embodiment, after receiving the HTTP request sent by the Web browser, the Web server performs an operation according to a normal flow, that is, performs a related processing operation on the HTTP request, acquires a processing progress and a key node state in a processing process, and stores the processing progress and the key node state in association with the HTTP request.
The processing progress is the progress of the Web server processing the HTTP request, and the key node state is, for example, a state of whether the request is successfully processed, a state of whether the requested Web page has been permanently moved to a new location, and the like, that is, the processing progress and the key node state are information related to the Web page. And then storing the acquired processing progress and the state of the key node for subsequent use.
An obtaining module 202, configured to obtain, after receiving the pseudo HTTP request, a stored processing progress and a stored key node state corresponding to the HTTP request according to a correspondence between the pseudo HTTP request and the HTTP request;
in this embodiment, when the preset time after the Web browser sends the HTTP request arrives, the Web browser sends a pseudo HTTP request corresponding to the HTTP request to the Web server. After receiving the pseudo HTTP request sent by the Web browser, the Web server parses the pseudo HTTP request, obtains request information of the pseudo HTTP request through the parsed content, compares the request information with request information of the stored HTTP request, and obtains whether there is a correspondence between the pseudo HTTP request and the stored HTTP request. If the two are corresponding, the processing progress and the key node state saved during the processing of the HTTP request can be obtained, and if the two are not corresponding, the corresponding processing progress and the key node state cannot be directly obtained.
And the first returning module 203 is configured to return the acquired processing progress and the key node state to the Web browser as real response information of the pseudo HTTP request.
In this embodiment, after the Web server acquires the processing progress and the key node state corresponding to the determined HTTP request, the acquired processing progress and key node state are used as real response information of the pseudo HTTP request, and then returned to the Web browser.
In a preferred embodiment, on the basis of the embodiment of fig. 4, the obtaining module 202 includes:
the analysis unit is used for analyzing the pseudo HTTP request and acquiring a second identifier in the HTTP request after receiving the pseudo HTTP request;
and the determining unit is used for determining the HTTP request corresponding to the first identifier associated with the second identifier and acquiring the saved processing progress corresponding to the determined HTTP request and the key node state.
In the embodiment, the Web browser generates the HTTP request and configures a first identifier of the HTTP request at the same time, and encapsulates the first identifier in the HTTP request; when a pseudo HTTP request corresponding to the HTTP request is generated, a second identifier of the pseudo HTTP request is configured and encapsulated in the pseudo HTTP request, wherein the second identifier is associated with the first identifier.
Since the HTTP request and the pseudo HTTP request are both encapsulated with the identifier, after the pseudo HTTP request is received by the Web server, the pseudo HTTP request is analyzed, for example, a protocol header of the pseudo HTTP request is analyzed, so that the second identifier can be obtained. In addition, the Web server analyzes the HTTP request after receiving the HTTP request and caches the first identifier obtained by analysis. Therefore, the HTTP request to which the first identifier belongs can be found through the association relationship between the second identifier and the first identifier, and finally, the processing progress and the key node state corresponding to the HTTP request, which are stored, are obtained through the found HTTP request.
In the embodiment, corresponding identifiers are configured for the HTTP request and the pseudo HTTP request respectively when the HTTP request and the pseudo HTTP request are generated, and the identifiers of the HTTP request and the corresponding pseudo HTTP request are associated, so that the HTTP request can be found through the identifier in the pseudo HTTP request in the subsequent Web server, and thus, the processing progress and the key node state corresponding to the HTTP request are obtained.
In a preferred embodiment, on the basis of the above embodiment of fig. 4, the Web server further includes: the second returning module is used for returning response information in a preset format to the Web browser after receiving the pseudo HTTP request if no HTTP request corresponds to the pseudo HTTP request, or processing the pseudo HTTP request as an HTTP request and sending an instruction for resending the pseudo HTTP request to the Web browser;
in this embodiment, after receiving the pseudo HTTP request, the Web server analyzes whether there is a corresponding HTTP request by analyzing, for example, performing association lookup through an identifier, and if it is analyzed that there is no HTTP request corresponding to the pseudo HTTP request at present (for example, the Web server fails to analyze and obtain a corresponding HTTP request due to an error in the process of processing the HTTP request or due to a failure to store a processing result, etc.);
in an embodiment, the Web server may return response information in a preset format to inform that the Web browser does not currently have a corresponding HTTP request, for example, the response information in the preset format is response information with empty response content.
In another embodiment, the Web server processes the pseudo HTTP request as one HTTP request, namely, acquiring the processing progress and the key node state of the pseudo HTTP request in the processing process, saving the processing progress and the key node state of the pseudo HTTP request, and sends an instruction to the Web browser to resend the pseudo HTTP request, and after the Web browser receives the instruction, sending a pseudo HTTP request to the Web server again, determining an HTTP request corresponding to the pseudo HTTP request by the Web server after receiving the pseudo HTTP request, to obtain the processing progress and the key node status of the HTTP request until the processing progress and the key node status of the HTTP request are obtained to finish the operation, or whether the Web browser acquires the processing progress of the HTTP request and the state of the key node or not, the Web server sends a preset number of instructions for resending the pseudo HTTP request to the Web browser and then ends the operation.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for processing a hypertext transfer protocol request, the method comprising:
s1, after the Web browser sends an HTTP request to the Web server, the Web browser abandons the response information of the Web server for the HTTP request from the Web server;
s2, the Web server saves the processing progress of the HTTP request and the state of a key node when processing the HTTP request, wherein the state of the key node is the state of whether the request is successfully processed or whether the requested webpage is permanently moved to a new position;
s3, when the preset time after the Web browser sends the HTTP request arrives, sending a pseudo HTTP request corresponding to the HTTP request to the Web server by the Web browser;
s4, after receiving the pseudo HTTP request, the Web server acquires the stored processing progress and key node state corresponding to the HTTP request according to the corresponding relation between the pseudo HTTP request and the HTTP request;
and S5, the Web server takes the acquired processing progress and the key node state as real response information of the pseudo HTTP request and returns the real response information to the Web browser.
2. The method of claim 1, wherein the pseudo HTTP request is consistent with request information of the HTTP request.
3. The method for handling a hypertext transfer protocol request according to claim 1 or 2, wherein before step S1, the method further comprises:
the Web browser generates the HTTP request and configures a first identifier of the HTTP request at the same time, and encapsulates the first identifier in the HTTP request;
before the step S3, the method further includes:
before the preset time after the Web browser sends the HTTP request is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, configuring a second identifier of the pseudo HTTP request, and encapsulating the second identifier in the pseudo HTTP request, wherein the second identifier is associated with the first identifier;
the step S4 includes:
s41, after receiving the pseudo HTTP request, the Web server analyzes the pseudo HTTP request and acquires a second identifier in the HTTP request;
and S42, determining the HTTP request corresponding to the first identifier associated with the second identifier, and acquiring the stored processing progress and the key node state corresponding to the determined HTTP request.
4. The method for handling a hypertext transfer protocol request according to claim 1 or 2, wherein after step S3, the method further comprises:
after receiving the pseudo HTTP request, if no HTTP request corresponds to the pseudo HTTP request, the Web server returns response information in a preset format to the Web browser, or the Web server takes the pseudo HTTP request as an HTTP request to process and sends an instruction for resending the pseudo HTTP request to the Web browser;
and when the preset time after the Web browser sends the pseudo HTTP request arrives, sending the pseudo HTTP request consistent with the pseudo HTTP request to the Web server again by the Web browser.
5. An apparatus based on the method for processing the hypertext transfer protocol request in any claim 1 to 4, wherein a Web browser runs in the apparatus, and the Web browser comprises:
the abandoning module is used for abandoning the response information of the Web server aiming at the HTTP request received from the Web server after the HTTP request is sent to the Web server;
the first sending module is used for sending a pseudo HTTP request corresponding to the HTTP request to the Web server when the preset time after the HTTP request is sent is up;
and the receiving module is used for receiving real response information of the pseudo HTTP request returned by the Web server, wherein the real response information of the pseudo HTTP request is the processing progress corresponding to the HTTP request and the state of a key node, and the state of the key node is the state of whether the request is successfully processed or whether the requested webpage is permanently moved to a new position.
6. The apparatus of claim 5, wherein the Web browser further comprises a configuration module, configured to generate the HTTP request and configure a first identifier of the HTTP request, and encapsulate the first identifier in the HTTP request; before the preset time after the HTTP request is sent is reached, when a pseudo HTTP request corresponding to the HTTP request is generated, a second identifier of the pseudo HTTP request is configured, and the second identifier is packaged in the pseudo HTTP request, so that the Web server can determine the HTTP request corresponding to the pseudo HTTP request through the first identifier and the second identifier, wherein the second identifier is associated with the first identifier.
7. The apparatus according to claim 5, wherein the Web browser further includes a second sending module, configured to, when response information in a preset format returned by the Web server is received or a resending instruction sent by the Web server is received, and when a preset time after the pseudo HTTP request is sent arrives, send a pseudo HTTP request that is consistent with the pseudo HTTP request to the Web server again until the receiving module receives real response information of the pseudo HTTP request returned by the Web server.
8. A Web server based on the processing method of the hypertext transfer protocol request of any one of claims 1 to 4, wherein the Web server comprises:
the system comprises a storage module, a processing module and a processing module, wherein the storage module is used for storing the processing progress of the HTTP request and the state of a key node when the HTTP request is processed after the HTTP request sent by a Web browser is received, and the state of the key node is the state of whether the request is successfully processed or whether a requested webpage is permanently moved to a new position;
the acquisition module is used for acquiring the stored processing progress and the key node state corresponding to the HTTP request according to the corresponding relation between the pseudo HTTP request and the HTTP request after receiving the pseudo HTTP request;
and the first returning module is used for returning the acquired processing progress and the key node state to the Web browser as the real response information of the pseudo HTTP request.
9. The Web server of claim 8, wherein the obtaining module comprises:
the analysis unit is used for analyzing the pseudo HTTP request and acquiring a second identifier in the HTTP request after receiving the pseudo HTTP request;
and the determining unit is used for determining the HTTP request corresponding to the first identifier associated with the second identifier and acquiring the saved processing progress corresponding to the determined HTTP request and the key node state.
10. The Web server of claim 8, wherein the Web server further comprises:
and the second returning module is used for returning response information in a preset format to the Web browser after receiving the pseudo HTTP request if no HTTP request corresponds to the pseudo HTTP request, or processing the pseudo HTTP request as an HTTP request and sending an instruction for resending the pseudo HTTP request to the Web browser.
CN201610704637.8A 2016-08-23 2016-08-23 Method and device for processing hypertext transfer protocol request and Web server Active CN107770230B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610704637.8A CN107770230B (en) 2016-08-23 2016-08-23 Method and device for processing hypertext transfer protocol request and Web server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610704637.8A CN107770230B (en) 2016-08-23 2016-08-23 Method and device for processing hypertext transfer protocol request and Web server

Publications (2)

Publication Number Publication Date
CN107770230A CN107770230A (en) 2018-03-06
CN107770230B true CN107770230B (en) 2020-11-03

Family

ID=61263534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610704637.8A Active CN107770230B (en) 2016-08-23 2016-08-23 Method and device for processing hypertext transfer protocol request and Web server

Country Status (1)

Country Link
CN (1) CN107770230B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101291324A (en) * 2007-04-16 2008-10-22 三星电子株式会社 Communication method and apparatus using super text transmission protocol
CN101741896A (en) * 2009-11-24 2010-06-16 中兴通讯股份有限公司 Data processing method, device and system in WEB system
CN103064778A (en) * 2011-10-20 2013-04-24 阿里巴巴集团控股有限公司 Method, device and system of server performances testing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9130975B2 (en) * 2010-06-02 2015-09-08 Avaya Inc. Generation of macros

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101291324A (en) * 2007-04-16 2008-10-22 三星电子株式会社 Communication method and apparatus using super text transmission protocol
CN101741896A (en) * 2009-11-24 2010-06-16 中兴通讯股份有限公司 Data processing method, device and system in WEB system
CN103064778A (en) * 2011-10-20 2013-04-24 阿里巴巴集团控股有限公司 Method, device and system of server performances testing

Also Published As

Publication number Publication date
CN107770230A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
CN109117361B (en) Remote debugging method, related equipment and system for small program
US10069894B2 (en) Electronic device, storage medium and file transferring method
EP3607715B1 (en) NF SERVICE CONSUMER RESTART DETECTION USING DIRECT SIGNALING BETWEEN NFs
US9967315B2 (en) Electronic device, storage medium and file transferring method
US10165618B2 (en) Service processing method and device
CN107911842B (en) Data transmission method, system, medium and device of Lora network server
US20200296438A1 (en) Video Transmission Method, Apparatus, and System, and Computer Readable Storage Medium
CN105379164A (en) Methods and apparatuses for transmitting and receiving data and recording medium for executing the methods
CN104378451A (en) Network communication route selecting method, device and system
US10136375B2 (en) Method for service data management, apparatus, and system
US11528345B2 (en) Data transmission method and system, and apparatus
CN110719581A (en) Control method, device and system for terminal application
EP3264851B1 (en) Data transmission method and device for data service
CN109756464B (en) Communication method, server and client
CN109561487B (en) Method and device for reducing energy consumption of mobile terminal and mobile terminal
CN107770230B (en) Method and device for processing hypertext transfer protocol request and Web server
US8332498B2 (en) Synchronized relay messaging and coordinated network processing using SNMP
CN103051722B (en) A kind ofly determine the method whether page is held as a hostage and relevant device
WO2015021827A1 (en) Method,device and system for offline reconnection of a web application
WO2022127386A1 (en) State transition method, network device and storage medium
WO2017107083A1 (en) Data sending method and receiving method, apparatus and system
CN105450467B (en) Monitoring method, access machine and service server
US9112766B2 (en) Method and apparatus having improved line rate IP packet communication
CN110311750B (en) Data transmission method, system and server
CN109479046A (en) Data transmission method and equipment

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
GR01 Patent grant
GR01 Patent grant