CN108023966B - Method, device and storage medium for processing universal gateway interface request - Google Patents

Method, device and storage medium for processing universal gateway interface request Download PDF

Info

Publication number
CN108023966B
CN108023966B CN201711377342.5A CN201711377342A CN108023966B CN 108023966 B CN108023966 B CN 108023966B CN 201711377342 A CN201711377342 A CN 201711377342A CN 108023966 B CN108023966 B CN 108023966B
Authority
CN
China
Prior art keywords
request
cgi
cgi request
constant
executing
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
CN201711377342.5A
Other languages
Chinese (zh)
Other versions
CN108023966A (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.)
Beijing Xingxuan Technology Co Ltd
Original Assignee
Beijing Xingxuan Technology 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 Beijing Xingxuan Technology Co Ltd filed Critical Beijing Xingxuan Technology Co Ltd
Priority to CN201711377342.5A priority Critical patent/CN108023966B/en
Publication of CN108023966A publication Critical patent/CN108023966A/en
Application granted granted Critical
Publication of CN108023966B publication Critical patent/CN108023966B/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/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4416Network booting; Remote initial program loading [RIPL]
    • 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/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The disclosure provides a CGI request processing method, equipment and storage medium. The method comprises the following steps: establishing a Common Gateway Interface (CGI) process; judging whether the first CGI request is a first request; if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; if the request is not the first request, executing a PHP script corresponding to the first CGI request; and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits. By implementing the method, various resources of the CGI request can be reused, and the processing efficiency of the CGI request is improved.

Description

Method, device and storage medium for processing universal gateway interface request
Technical Field
The invention relates to the field of computer networks, in particular to a method, equipment and a storage medium for processing a Common Gateway Interface (CGI) request.
Background
In the related PHP technology, many designs focus more on convenience in use. For example, each Common Gateway Interface (CGI) request invokes a request to initialize RINIT and a request to close rshutdwn.
The PHP-CGI request is used for providing interface service for WEB, the WEB interface service is mostly stateless, and the request is logically independent from the request, so the request isolation can be realized by requesting to initialize RINIT and closing RSHUTDWN of the request, and the side effect generated between the requests is not concerned in use. However, with the development of the internet, under a Web scene with high concurrency and large flow, the design of the request dimension isolation resource causes great performance waste.
Disclosure of Invention
The present disclosure provides a CGI request processing method, apparatus, and storage medium.
In a first aspect, a CGI request processing method is provided, which may include: establishing a Common Gateway Interface (CGI) process; judging whether the first CGI request is a first request; if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; if the request is not the first request, executing a PHP script corresponding to the first CGI request; and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
In some embodiments, the determining whether the first CGI request is a first request is based on an identification bit of the first CGI request.
In some embodiments, the CGI request processing method may further include changing an identification bit of other CGI requests in the packet reception cycle other than the first CGI request to an identification indicating a non-first request after performing initialization RINIT of the CGI request.
In some embodiments, the CGI request processing method may further include: in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
In some embodiments, the CGI request processing method may further include: in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
In some embodiments, the CGI request processing method may further include: and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
In some embodiments, the CGI request processing method may further include: in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded; restoring the static variable to the saved default value at the end of the first CGI request.
In some embodiments, the CGI request processing method may further include: and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
In a second aspect, there is provided a computer device comprising a memory and a processor, wherein the memory is configured to store one or more computer instructions that when executed by the processor implement: establishing a Common Gateway Interface (CGI) process; judging whether the first CGI request is a first request; if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; if the request is not the first request, executing a PHP script corresponding to the first CGI request; and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
In some embodiments, the determining whether the first CGI request is a first request is based on an identification bit of the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: after performing initialization RINIT of CGI requests, the identification bits of other CGI requests in the packet reception cycle other than the first CGI request are changed to an identification representing a non-first request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded; restoring the static variable to the saved default value at the end of the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
In a third aspect, a CGI request processing apparatus is provided, the apparatus including: the system comprises a creating module, a processing module and a processing module, wherein the creating module is used for creating a Common Gateway Interface (CGI) process; the request processing module is used for judging whether the first CGI request is a first request; and if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; under the condition that the request is not the first request, executing a PHP script corresponding to the first CGI request; and the closing module is used for executing the closing RSHUTDWN requested by the CGI when the CGI process exits.
In some embodiments, the request processing module determines whether the first CGI request is a first request based on an identification bit of the first CGI request.
In some embodiments, the request processing module is further configured to change, after performing initialization RINIT of the CGI request, an identification bit of a CGI request other than the first CGI request in a packet reception cycle to an identification indicating a non-first-time request.
In some embodiments, the request processing module is further configured to, in a process of executing the PHP script corresponding to the first CGI request, ignore a constant declaration of a first constant in a constant table in a case that the first constant already exists in the constant table, and return a value of the first constant in the constant table.
In some embodiments, the request processing module is further configured to use a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request in processing of a second CGI request subsequent to the first CGI request.
In some embodiments, the request processing module is further configured to use, in processing of a second CGI request subsequent to the first CGI request, a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
In some embodiments, the request processing module is further configured to, in processing of the first CGI request, save a default value of a static variable within the first class at a time of first class loading; restoring the static variable to the saved default value at the end of the first CGI request.
In some embodiments, the request processing module is further configured to, when the first CGI request is ended, store the content of the output buffer in a response packet of the first CGI request.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of the first aspect.
These and other aspects of the disclosure will be more readily apparent from the following description of the embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a flowchart of a CGI request processing method according to an embodiment of the present invention.
Fig. 2 is a flow diagram of CGI request processing.
Fig. 3 is a schematic structural diagram of a computer apparatus according to an embodiment of the present invention.
Fig. 4 is a schematic configuration diagram of a CGI request processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention.
In some of the flows described in the present specification and claims and in the above-described figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel as they occur herein, with the order of the operations, e.g., S101, S102, etc., merely being used to distinguish between various operations, and the order of the operations itself does not represent any order of performance. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The embodiments of the present invention and the embodiments obtained based on the idea of the present invention are within the scope of protection of the present invention.
Referring to fig. 1, fig. 1 shows a flowchart of a CGI request processing method according to an embodiment of the present invention, which may include: s101, S102, S103, S104, and S105.
S101, establishing a Common Gateway Interface (CGI) process.
In some embodiments, a new CGI process, for example, a FastCGIj process, is created in S101 to implement a callback of a Server Application Programming Interface (SAPI). The SAPI may provide an interface so that the PHP may interact with other applications.
S102, determining whether the first CGI request is a first request, if so, executing S103, and if not, executing S104.
The CGI process may handle multiple CGI requests and may set a flag for these requests indicating two states, e.g., a first request state and a non-first request state (i.e., a subsequent request state), with the different states each performing different processing logic.
In some embodiments, whether the CGI request is a first request may be determined based on an identification bit of the request, where the identification bit is a first value and represents the first request; and a second value, indicating a non-first request. For example, 1 variable request _ state is set to be false before the start of a large loop of an Accept packet, after entering a packet receiving loop, when the variable request _ state is judged to be false, it means that a first request is made, special logic of the first request is made, then an identification bit of other CGI requests except for a first CGI request in the packet receiving loop is set to be true, and when processing second and subsequent requests, it is judged whether the variable request _ state is true, that is, whether the first request is made can be distinguished, if true, the subsequent request is made, and if not true (i.e., false), the first request is made.
S103, executing initialization RINIT of the CGI request, and then executing the PHP script corresponding to the first CGI request.
As shown in fig. 2. In the existing CGI request, for each CGI request, processing circled by a dotted line needs to be performed:
s201, request test.php;
s202, calling the expanded RINIT;
s203, executing a test. php script;
s204, calling the expanded RSHURTDOWN;
and S205, after the test is called, cleaning is carried out.
In the embodiment of the present invention, for the first CGI request, the initialization RINIT of one request is executed, and then, for the subsequent CGI request, only the processing S203 outlined by the dotted line is repeatedly executed, and the test.
And S104, executing the PHP script corresponding to the first CGI request.
Some of the data structures involved in the CGI request are briefly described below. The class table is a hash table created and maintained in the PHP analysis process, class information analyzed by the PHP is maintained by the class table, a key of the class table is a class name character string, a value is a specific structure of the class, and the class table mainly comprises information such as a parent class, a reference count, a member variable and a function. The global symbol table refers to a hash table for storing global variables. Opcode results from the analysis of the PHP code by the Zend engine.
The CGI process will release all class tables, global symbol tables, opcodes, etc. at the Rshutdown stage. In the previous CGI request processing, RINIT and rshutdwn were performed once per CGI request, i.e., these class tables, global symbol tables, and opcode would be released during the rshutdwn phase of the CGI request.
In embodiments of the present invention, these resources (e.g., class tables, global symbol tables, and opcodes) may be used in other CGI requests, since rshutdwn is not performed every CGI request. In a second CGI request subsequent to the first CGI request, one of a class table, a global symbol table, and a code interpretation generated opcode created in the first CGI request, and the like, or two of the class table, the global symbol table, and the code interpretation generated opcode, for example, the class table and the global symbol table, may be used; the opcode generated by the class table and the code interpretation; or, opcode generated by the global symbol table and code interpretation, etc.; three types of opcodes generated by class tables, global symbol tables and code interpretation can also be used simultaneously. Therefore, the CGI request processing method provided by the invention can share resources such as class tables, global symbol tables and opcodes generated by code interpretation among different CGI requests, reduce the pressure of system resource processing and improve the processing efficiency of the CGI requests.
In some embodiments, in the processing of a second CGI request subsequent to the first CGI request, a resource corresponding to a first global variable in a global symbol table created in the CGI request may also be used. It should be noted that the first global variable may be any one of global variables in the global symbol table. The global variable refers to a global variable in the PHP script. Since the logic of the PHP CGI is a global variable applied during request processing and is released after the request is completed, a resource pool cannot be constructed. For example, 1 database connection is established in 1 CGI request, the rshutdwn phase must be released at the end of the CGI request, and the next CGI request cannot be used. The embodiment of the invention utilizes the characteristic that the global variable is shared among the requests, saves the database connection in the global variable, constructs the connection pool and can be shared in all the requests. It should be noted that the database connection is only for example, and is only one kind of resource, and other resources may be similarly applicable.
In the previous CGI request processing, PHP interpretation was performed independently for each request, and the constants used in each request were asserted and then released during the rshutdwn phase of the request. In the embodiment of the present invention, constant resource sharing, that is, 1 CGI request declares a variable, and the next CGI request is executed according to the opcode of the PHP, or a constant declaration is triggered, but the constant declaration is not allowed to be repeatedly declared in the source code inside the PHP, and an alarm is reported. Therefore, special processing is required to be compatible with the original constant use mode. In the process of executing the PHP script corresponding to the first CGI request, in the case that the first constant already exists in the constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table. That is, if this constant already exists in the constant table, the variable ignores the constant declaration. If the constant value exists, the value is fixed due to the fact that the constant value exists, and therefore the constant value in the constant value table is directly returned. Such processing can be compatible with program codes of the conventional CGI request processing.
Static variables are generated when the Zend engine parses the PHP code. The class loading is triggered when the class name does not exist in the class table, the PHP file corresponding to the class is found according to the class loading function, then the PHP file is compiled, and the PHP class is loaded into the class table. Static variables are generated into the class structure when the PHP class is compiled. In the existing CGI request processing, a static variable exists only in each request, and in the embodiment of the present invention, the static variable exists across requests, resulting in incompatibility with the original code.
In an embodiment of the present invention, to make the embodiment of the present invention compatible with the original code, before the first CGI request, the hook holds the system function spl _ autoload _ call of the class load. That is, the spl _ autoload _ call hooking the system actually calls the predetermined function to which the embodiment of the present invention is applied when the system should call the spl _ autoload _ call.
In some embodiments, in the processing of the CGI request, a default value of a static variable within the first class is saved upon loading of the first class, and the static variable is restored to the saved default value upon completion of the CGI request. Through the above processing of the static variables, resource sharing of the static variables among the CGI requests is ensured, and compatibility with the original CGI codes is also ensured.
In some embodiments, when the first CGI request ends, the contents of the output buffer are saved to a response packet of the first CGI request. Specifically, php _ output _ activate is executed in the request initialization phase (output global variable is reset and output processing callback function stack is set); at the end of the request, php _ output _ end _ all (which summarizes all the callback output contents) php _ output _ deactivate (releases the output callback stack) is executed. Similarly, in a second CGI request subsequent to the first CGI request, php _ output _ activate is also executed in the request processing stage, and in the request ending stage, php _ output _ end _ all and php _ output _ deactivate are executed to flush the memory of the output buffer to the response packet of the second CGI request.
S105, when the CGI process exits, the closing RSHUTDWN requested by the CGI is executed.
In some embodiments, the child process exits the process upon receiving the SIGTERM signal from the host process. And when a SIGTERM signal of the main process is received, executing the closing RSHUTDOWN of the CGI request, and releasing the constants, static variables, global variables, class tables and the like created by the whole CGI process.
The embodiment of the invention also provides computer equipment. As shown in fig. 3, the computer device 300 may include a memory 301 and a processor 302, wherein the memory 301 is configured to store one or more computer instructions that when executed by the processor 302 implement: establishing a Common Gateway Interface (CGI) process; judging whether the first CGI request is a first request; if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; if the request is not the first request, executing a PHP script corresponding to the first CGI request; and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
In some embodiments, the determining whether the first CGI request is a first request is based on an identification bit of the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: after performing initialization RINIT of CGI requests, the identification bits of other CGI requests in the packet reception cycle other than the first CGI request are changed to an identification representing a non-first request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded; restoring the static variable to the saved default value at the end of the first CGI request.
In some embodiments, the one or more computer instructions, when executed by the processor, further implement: and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
The present disclosure also provides a CGI request processing apparatus, as shown in fig. 4, the CGI request processing apparatus 400 may include a creating module 401, a request processing module 402, and a closing module 403, where the creating module 401 is configured to create a common gateway interface CGI process; a request processing module 402, configured to determine whether the first CGI request is a first request; and if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; under the condition that the request is not the first request, executing a PHP script corresponding to the first CGI request; a closing module 403, configured to execute a CGI request to close rshutdwn when the CGI process exits.
In some embodiments, the request processing module 402 determines whether the first CGI request is a first request based on an identification bit of the first CGI request.
In some embodiments, the request processing module 402 is further configured to change the identification bits of other CGI requests in the packet reception cycle except the first CGI request to an identification indicating a non-first request after performing an initialization RINIT of the CGI request.
In some embodiments, the request processing module 402 is further configured to, in the process of executing the PHP script corresponding to the first CGI request, ignore the constant declaration of the first constant in the constant table in a case that the first constant already exists in the constant table, and return the value of the first constant in the constant table.
In some embodiments, the request processing module 402 is further configured to use a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request in processing a second CGI request subsequent to the first CGI request.
In some embodiments, the request processing module 402 is further configured to use, in processing a second CGI request subsequent to the first CGI request, a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
In some embodiments, the request processing module 402 is further configured to, in processing the first CGI request, save a default value of a static variable in a first class at the time of loading the first class; restoring the static variable to the saved default value at the end of the first CGI request.
In some embodiments, the request processing module 402 is further configured to, when the first CGI request is ended, store the content of the output buffer in the response packet of the first CGI request.
The present disclosure also provides a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, performs the steps of the above-described method.
The above-described embodiments of the apparatus or device are only schematic, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
The application discloses a1, a CGI request processing method, characterized in that the method comprises:
establishing a Common Gateway Interface (CGI) process;
judging whether the first CGI request is a first request;
if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request;
if the request is not the first request, executing a PHP script corresponding to the first CGI request;
and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
A2, the method of claim a1, wherein the determining whether the first CGI request is a first request is based on an identification bit of the first CGI request.
A3, the method of claim a2, wherein the method further comprises:
after performing initialization RINIT of CGI requests, the identification bits of other CGI requests in the packet reception cycle other than the first CGI request are changed to an identification representing a non-first request.
A4, the method of claim a1, wherein the method further comprises:
in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
A5, the method of claim a1, wherein the method further comprises:
in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
A6, the method of claim a5, wherein the method further comprises:
and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
A7, the method of claim a1, wherein the method further comprises:
in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded;
restoring the static variable to the saved default value at the end of the first CGI request.
A8, the method of claim a1, wherein the method further comprises:
and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
B9, a computer device comprising a memory and a processor, wherein the memory is configured to store one or more computer instructions that when executed by the processor implement:
establishing a Common Gateway Interface (CGI) process;
judging whether the first CGI request is a first request;
if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request;
if the request is not the first request, executing a PHP script corresponding to the first CGI request;
and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
B10, the computer device of claim B9, wherein the determination of whether the first CGI request is a first request is based on an identification bit of the first CGI request.
B11, the computer device of claim B10, wherein the one or more computer instructions, when executed by the processor, further implement:
after performing initialization RINIT of CGI requests, the identification bits of other CGI requests in the packet reception cycle other than the first CGI request are changed to an identification representing a non-first request.
B12, the computer device of claim B9, wherein the one or more computer instructions, when executed by the processor, further implement:
in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
B13, the computer device of claim B9, wherein the one or more computer instructions, when executed by the processor, further implement:
in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
B14, the computer device of claim B13, wherein the one or more computer instructions, when executed by the processor, further implement:
and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
B15, the computer device of claim B9, wherein the one or more computer instructions, when executed by the processor, further implement:
in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded;
restoring the static variable to the saved default value at the end of the first CGI request.
B16, the computer device of claim B9, wherein the one or more computer instructions, when executed by the processor, further implement:
and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
C17, a CGI request processing apparatus, comprising:
the system comprises a creating module, a processing module and a processing module, wherein the creating module is used for creating a Common Gateway Interface (CGI) process;
the request processing module is used for judging whether the first CGI request is a first request; and if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; under the condition that the request is not the first request, executing a PHP script corresponding to the first CGI request;
and the closing module is used for executing the closing RSHUTDWN requested by the CGI when the CGI process exits.
C18, the apparatus of claim C17, wherein the request processing module determines whether the first CGI request is a first request based on an identification bit of the first CGI request.
C19, the apparatus according to claim C18, wherein the request processing module is further configured to change the identification bits of other CGI requests in the packet receiving loop except the first CGI request to an identification indicating a non-first request after performing an initialization RINIT of the CGI request.
C20, the apparatus according to claim C17, wherein the request processing module is further configured to, in the process of executing the PHP script corresponding to the first CGI request, ignore the constant declaration of the first constant and return the value of the first constant in the constant table in the case that the first constant already exists in the constant table.
C21, the apparatus according to claim C17, wherein the request processing module is further configured to use one or more combinations of class tables, global symbol tables, and opcode generated by code interpretation created by the first CGI request in the processing of a second CGI request subsequent to the first CGI request.
C22, the apparatus according to claim C21, wherein the request processing module is further configured to use a resource corresponding to a first global variable of a global symbol table created in the first CGI request in processing a second CGI request subsequent to the first CGI request.
C23, the apparatus according to claim C17, wherein the request processing module is further configured to save a default value of a static variable in a first class at the time of loading the first class in the processing of the first CGI request; restoring the static variable to the saved default value at the end of the first CGI request.
The apparatus of claim C17, C24, wherein the request processing module is further configured to, when the first CGI request is ended, save the content of the output buffer to the response packet of the first CGI request.
D25, a computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, carries out the method of claims a1 to a 8.

Claims (25)

1. A CGI request processing method, comprising:
establishing a Common Gateway Interface (CGI) process;
judging whether the first CGI request is a first request;
if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request;
if the request is not the first request, executing a PHP script corresponding to the first CGI request so as to share resources among different CGI requests;
and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
2. The method of claim 1, wherein the determining whether the first CGI request is a first request is based on an identification bit of the first CGI request.
3. The method of claim 2, further comprising:
after performing initialization RINIT of CGI requests, the identification bits of other CGI requests in the packet reception cycle other than the first CGI request are changed to an identification representing a non-first request.
4. The method of claim 1, further comprising:
in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
5. The method of claim 1, further comprising:
in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
6. The method of claim 5, further comprising:
and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
7. The method of claim 1, further comprising:
in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded;
restoring the static variable to the saved default value at the end of the first CGI request.
8. The method of claim 1, further comprising:
and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
9. A computer device comprising a memory and a processor, wherein the memory is configured to store one or more computer instructions that when executed by the processor implement:
establishing a Common Gateway Interface (CGI) process;
judging whether the first CGI request is a first request;
if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request;
if the request is not the first request, executing a PHP script corresponding to the first CGI request so as to share resources among different CGI requests;
and executing the closing RSHUTDOWN requested by the CGI when the CGI process exits.
10. The computer device of claim 9, wherein the determining whether the first CGI request is a first request is based on an identification bit of the first CGI request.
11. The computer device of claim 10, wherein the one or more computer instructions, when executed by the processor, further implement:
after performing initialization RINIT of CGI requests, the identification bits of other CGI requests in the packet reception cycle other than the first CGI request are changed to an identification representing a non-first request.
12. The computer device of claim 9, wherein the one or more computer instructions, when executed by the processor, further implement:
in the process of executing the PHP script corresponding to the first CGI request, under the condition that a first constant already exists in a constant table, ignoring the constant statement of the first constant, and returning the value of the first constant in the constant table.
13. The computer device of claim 9, wherein the one or more computer instructions, when executed by the processor, further implement:
in processing a second CGI request subsequent to the first CGI request, using a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request.
14. The computer device of claim 13, wherein the one or more computer instructions, when executed by the processor, further implement:
and in the processing of a second CGI request after the first CGI request, using a resource corresponding to a first global variable of a global symbol table created in the first CGI request.
15. The computer device of claim 9, wherein the one or more computer instructions, when executed by the processor, further implement:
in the processing of the first CGI request, saving a default value of a static variable in a first class when the first class is loaded;
restoring the static variable to the saved default value at the end of the first CGI request.
16. The computer device of claim 9, wherein the one or more computer instructions, when executed by the processor, further implement:
and when the first CGI request is ended, storing the content of the output buffer area into a response message of the first CGI request.
17. A CGI request processing apparatus, comprising:
the system comprises a creating module, a processing module and a processing module, wherein the creating module is used for creating a Common Gateway Interface (CGI) process;
the request processing module is used for judging whether the first CGI request is a first request; and if the request is the first request, executing initialization RINIT of the CGI request, and then executing a PHP script corresponding to the first CGI request; under the condition that the request is not the first request, executing a PHP script corresponding to the first CGI request so as to share resources among different CGI requests;
and the closing module is used for executing the closing RSHUTDWN requested by the CGI when the CGI process exits.
18. The apparatus of claim 17, wherein the request processing module determines whether the first CGI request is a first request based on an identification bit of the first CGI request.
19. The apparatus according to claim 18, wherein the request processing module is further configured to change an identification bit of other CGI requests in a packet reception loop except the first CGI request to an identification indicating a non-first request after performing an initialization RINIT of the CGI request.
20. The apparatus according to claim 17, wherein the request processing module is further configured to, in the process of executing the PHP script corresponding to the first CGI request, ignore a constant declaration of a first constant in a constant table in a case that the first constant already exists in the constant table, and return a value of the first constant in the constant table.
21. The apparatus of claim 17, wherein the request processing module is further configured to use a combination of one or more of a class table, a global symbol table, and an opcode generated by code interpretation created by the first CGI request in processing a second CGI request subsequent to the first CGI request.
22. The apparatus according to claim 21, wherein the request processing module is further configured to use a resource corresponding to a first global variable of a global symbol table created in the first CGI request in processing of a second CGI request subsequent to the first CGI request.
23. The apparatus according to claim 17, wherein the request processing module is further configured to save a default value of a static variable in a first class when the first class is loaded in the processing of the first CGI request; restoring the static variable to the saved default value at the end of the first CGI request.
24. The apparatus according to claim 17, wherein the request processing module is further configured to save contents of an output buffer to the response packet of the first CGI request when the first CGI request is ended.
25. A computer-readable storage medium, on which a computing program is stored, characterized in that the computing program, when executed by a processor, implements the method of any one of claims 1 to 8.
CN201711377342.5A 2017-12-19 2017-12-19 Method, device and storage medium for processing universal gateway interface request Active CN108023966B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711377342.5A CN108023966B (en) 2017-12-19 2017-12-19 Method, device and storage medium for processing universal gateway interface request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711377342.5A CN108023966B (en) 2017-12-19 2017-12-19 Method, device and storage medium for processing universal gateway interface request

Publications (2)

Publication Number Publication Date
CN108023966A CN108023966A (en) 2018-05-11
CN108023966B true CN108023966B (en) 2020-12-04

Family

ID=62074037

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711377342.5A Active CN108023966B (en) 2017-12-19 2017-12-19 Method, device and storage medium for processing universal gateway interface request

Country Status (1)

Country Link
CN (1) CN108023966B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109347894A (en) * 2018-08-10 2019-02-15 锐捷网络股份有限公司 Manage method, manager, equipment and the medium of FastCGI process

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996287A (en) * 2006-11-02 2007-07-11 武汉软想科技有限公司 Distribution Web system with embedded command codes in web page
CN105069164A (en) * 2015-08-27 2015-11-18 上海斐讯数据通信技术有限公司 Data loading optimization method and system, database and page data loading system
CN105183629A (en) * 2014-05-29 2015-12-23 北京基调网络系统有限公司 Diagnosis system and diagnosis method for analyzing performance of PHP application software, and performance management platform thereof
CN105204870A (en) * 2015-10-28 2015-12-30 北京奇虎科技有限公司 Access method, device and system of script program
CN107277169A (en) * 2017-07-27 2017-10-20 许文远 A kind of Universal Remote interactive device based on Web server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020038256A1 (en) * 2000-07-07 2002-03-28 Minh Nguyen Transactional control system
US20160112262A1 (en) * 2014-10-18 2016-04-21 Weaved, Inc. Installation and configuration of connected devices

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996287A (en) * 2006-11-02 2007-07-11 武汉软想科技有限公司 Distribution Web system with embedded command codes in web page
CN105183629A (en) * 2014-05-29 2015-12-23 北京基调网络系统有限公司 Diagnosis system and diagnosis method for analyzing performance of PHP application software, and performance management platform thereof
CN105069164A (en) * 2015-08-27 2015-11-18 上海斐讯数据通信技术有限公司 Data loading optimization method and system, database and page data loading system
CN105204870A (en) * 2015-10-28 2015-12-30 北京奇虎科技有限公司 Access method, device and system of script program
CN107277169A (en) * 2017-07-27 2017-10-20 许文远 A kind of Universal Remote interactive device based on Web server

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CGI在LghttpdWeb服务器上的应用与实现;胡志慧;《福建电脑》;20130731;全文 *
php-fpm和cgi,并发响应的理解以及高并发和多线程的关系;左闯;《https://www.cnblogs.com/zuochuang/p/7885941.html》;20171123;全文 *

Also Published As

Publication number Publication date
CN108023966A (en) 2018-05-11

Similar Documents

Publication Publication Date Title
CN108255545B (en) Function calling method and device between components and modular architecture system
WO2020233369A1 (en) Method for improving software integration system on basis of simulated port, and related device
RU2746155C2 (en) Destroying an object based on the sequence of actions performed
US11269611B2 (en) Data interface processing method, device, server and medium
WO2020177429A1 (en) Method and apparatus for embedding codes in application, and electronic device
CN104036019A (en) Method and device for opening webpage links
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN108595331B (en) Asynchronous interface testing method, medium, device and computing equipment
CN109062714B (en) Method and device for remotely controlling android device and electronic device
CN111338829B (en) Calling method and device for remote procedure call service
CN108366098B (en) Data interaction method and device for network nodes
CN113448756A (en) Inter-process communication system and method and computing device
CN106997313B (en) Signal processing method and system of application program and terminal equipment
CN110457132B (en) Method and device for creating functional object and terminal equipment
CN108023966B (en) Method, device and storage medium for processing universal gateway interface request
CN106874020B (en) Method and device for starting plug-in
US20180373512A1 (en) Method and device for simulating synchronous blocking in asynchronous environment, storage medium, server and terminal
CN113760487B (en) Service processing method and device
CN114327404A (en) File processing method and device, electronic equipment and computer readable medium
US20080163224A1 (en) Modeling interrupts in a business process
CN112905273A (en) Service calling method and device
CN113282541A (en) File calling method and device and electronic equipment
CN112612474A (en) Product transplanting method and device, storage medium and electronic equipment
CN111427630A (en) Cold start optimization method and device, electronic equipment and storage medium
CN106570143B (en) Method and device for sending response object

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: 100085 Beijing, Haidian District on the road to the information on the ground floor of the 1 to the 3 floor of the 2 floor, room 11, 202

Applicant after: Beijing Xingxuan Technology Co., Ltd.

Address before: 100085 Beijing, Haidian District on the road to the information on the ground floor of the 1 to the 3 floor of the 2 floor, room 11, 202

Applicant before: BEIJING XIAODU INFORMATION TECHNOLOGY CO., LTD.

GR01 Patent grant
GR01 Patent grant