An access method, system, device and storage medium
By using a web server with a main process and child processes architecture and communicating with external extended servers through a public gateway interface, the high cost of building network services in existing technologies is solved, and low-cost and efficient network service provision is achieved.
Patent Information
- Application Number
- CN202410475958.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2044-04-19
AI Technical Summary
Existing network service servers are costly and complex to build, and cannot meet the demand for providing network services quickly and cost-effectively.
It adopts an architecture of main process and multiple child processes, and communicates with external extended servers through a public gateway interface to achieve concurrent request processing and extend network service functions.
It is simple and inexpensive to build, can quickly provide network access services, improve the efficiency of network access services, and meet the need for low-cost expansion of network services.
Smart Images

Figure CN118250271B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, in particular to an access method, system, device and storage medium. BACKGROUND
[0002] With the development of finance and computers in the current society, network services are also increasing, and various functions of network services can be provided by using servers.
[0003] At present, there is a demand to build network services with specific functions or small size, but the network services built based on the current server architecture have high cost and complex construction process, and cannot meet the demand of providing network services quickly and at low cost. SUMMARY
[0004] Therefore, the purpose of the present application is to provide an access method, system, device and storage medium, which can quickly build a low-cost website server to provide network access services.
[0005] The present application provides an access method applied to a website server, wherein the website server comprises a main process, a plurality of sub-processes and a common gateway interface, and the method comprises the following steps:
[0006] The main process receives a hypertext transfer protocol request sent by a terminal device, and forwards the hypertext transfer protocol request to a target sub-process, wherein the target sub-process is any one of the sub-processes that has not processed the request;
[0007] The target sub-process performs packet analysis on the hypertext transfer protocol request to obtain request resource information corresponding to the hypertext transfer protocol request;
[0008] The common gateway interface is used to send a target request for obtaining the request resource information to an external expansion server, and the target resource obtained by the external expansion server by calling a custom function to process the target request is received;
[0009] The target sub-process generates a response packet by using the target resource, and the main process sends the response packet to the terminal device.
[0010] Optionally, the external expansion server comprises a control process and a plurality of working processes.
[0011] The common gateway interface is used to send a target request for obtaining the request resource information to an external expansion server, and the target resource obtained by the external expansion server by calling a custom function to process the target request is received.
[0012] The public gateway interface sends a target request for obtaining the requested resource information to the control process, the control process forwards the target request to the work process, the work process calls a custom function to process the target request to obtain a target resource and returns the target resource to the control process, and the target sub-process receives the target resource sent by the control process.
[0013] Optionally, the custom function determines according to a request resource type included in the requested resource information.
[0014] Optionally, the website server includes a socket programming interface.
[0015] The main process receives a hypertext transfer protocol request sent by a terminal device, and the hypertext transfer protocol request includes:
[0016] The main process receives a hypertext transfer protocol request sent by a terminal device using a socket programming interface.
[0017] Optionally, the method further includes:
[0018] Obtaining a restricted access configuration file;
[0019] Determining whether the target resource meets a restricted access condition of the terminal device according to the restricted access configuration file, and returning an unaccessible response message to the terminal device if the target resource meets the restricted access condition.
[0020] Optionally, the method further includes:
[0021] The target sub-process calls a target function to process the hypertext transfer protocol request to obtain a target resource.
[0022] Optionally, the website server includes a socket programming interface.
[0023] The method further includes:
[0024] The main process loads a server configuration of the website server and initializes a socket programming interface for receiving the hypertext transfer protocol request.
[0025] The application provides an access system, which includes a website server application and an external extension application, the website server application includes a main process, a plurality of sub-processes and an external extension client application;
[0026] The main process receives a hypertext transfer protocol request sent by a website client application, forwards the hypertext transfer protocol request to a target sub-process, and the target sub-process is any one of the sub-processes that has not processed the request.
[0027] The target sub-process is configured to parse the HTTP request to obtain request resource information corresponding to the HTTP request;
[0028] The target sub-process is configured to send a target request for obtaining the request resource information to an external extension application through a public gateway interface by using the external extension client application, and receive a target resource obtained by calling a custom function to process the target request by the external extension application;
[0029] The target sub-process is configured to generate a response message by using the target resource, and the main process is configured to send the response message to the website client application.
[0030] The application provides an access device, the device comprising: a processor and a memory;
[0031] The memory is configured to store instructions;
[0032] The processor is configured to execute the instructions in the memory, and execute the method as described in any one of the above.
[0033] The application provides a computer readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the method as described in any one of the above.
[0034] The application provides an access method applied to a website server, the website server comprising a main process, a plurality of sub-processes and a common gateway interface, that is, the architecture of the website server is composed of the main process and the plurality of sub-processes, the architecture is simple and relatively easy to build, and the method comprises the following steps: the main process receives a hypertext transfer protocol (HTTP) request sent by a terminal device, forwards the HTTP request to a target sub-process, the target sub-process being any one of the plurality of sub-processes that has not processed the request, the target sub-process performs message analysis on the HTTP request to obtain request resource information corresponding to the HTTP request, that is, the website server is based on the HTTP transmission request and the resource requested by the terminal device, so that the website server can provide a network access service based on a browser. The website server receives the request by using the main process and processes the request by using the sub-process, so that the request is processed concurrently and the efficiency of the network access service is improved. The target request for obtaining the request resource information is sent to an external expansion server through the common gateway interface, and a target resource obtained by calling a custom function by the external expansion server to process the target request is received, that is, the website server can communicate with the external expansion server through the common gateway interface, so that the network service function of the website server is expanded and better network service is achieved. The target sub-process generates a response message by using the target resource, and the main process sends the response message to the terminal device, so that the resource feedback to the terminal device is finally achieved. It can be seen that the website server based on the main process and the plurality of sub-processes can be used to provide the network access service, the website server has a simple architecture, is easy to build and has low cost, and the network service function can be expanded by using the common gateway interface, so that the demand for providing the network service quickly and at low cost is met. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort.
[0036] Figure 1 A flowchart of an access method provided by an embodiment of the present application is shown;
[0037] Figure 2 A website server architecture diagram provided by an embodiment of the present application is shown;
[0038] Figure 3 A network service framework diagram provided by an embodiment of the present application is shown;
[0039] Figure 4An external expansion server architecture provided by an embodiment of the present application is shown.
[0040] Figure 5 An access system structure provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0041] In order to make the personnel in the technical field better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the personnel in the technical field without creative labor fall within the scope of protection of the present application.
[0042] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced without the specific details, which are not described in the present application, and the personnel in the technical field can make similar generalizations without departing from the connotation of the present application. Therefore, the present application is not limited by the specific embodiments disclosed below.
[0043] With the continuous upgrading and large-scale popularization of computer networks, the types of services provided by the Internet are more and more various and rich. At present, users access the Internet by using browsers or other client agents. The browser is convenient, fast and easy to operate, and a large number of users use the browser to obtain Internet services. The browser provides network services based on a website (WEB) server. At present, there are various WEB servers on the market. Each server adopts different ways to realize object component support, distributed computing, deployment speed and ease of use. At present, the WEB servers mainly include the following: IIS, Nginx and Apache.
[0044] However, the above WEB servers have disadvantages, for example, IIS adopts a single-point deployment mode. If a certain site needs to be modified or deleted, the entire system needs to be re-deployed, which is relatively high in cost. The configuration and management of IIS are relatively cumbersome, which needs to be realized through a command line or a script, resulting in difficult construction. Nginx needs to install multiple modules to meet various needs, that is, the construction cost is high. Apache has high maintenance cost.
[0045] That is, although the WEB server can share various different media resources on the Internet, the same WEB server has less functions and cannot provide low-cost and comprehensive network services. At present, there is a demand for constructing a network service with specific functions or small size. However, the network service constructed based on the current server architecture has high cost and a relatively complex construction process, which cannot meet the demand for providing network services quickly and at low cost.
[0046] Based on this, the application provides an access method, applied to a website server, the website server comprising a main process, a plurality of sub-processes and a common gateway interface, that is, the architecture of the website server is composed of the main process and the plurality of sub-processes, the architecture is simple and relatively easy to build, the method comprising: the main process receiving a hypertext transfer protocol request sent by a terminal device, forwarding the hypertext transfer protocol request to a target sub-process, the target sub-process being any one of the plurality of sub-processes that has not processed the request, the target sub-process performing message analysis on the hypertext transfer protocol request to obtain request resource information corresponding to the hypertext transfer protocol request, that is, the website server is based on a hypertext transfer protocol (HTTP) transmission request and a resource requested by the terminal device, so that the website server can provide a network access service based on a browser. The website server uses the main process to receive the request and uses the sub-process to process the request, thereby realizing concurrent processing of the request and improving the efficiency of the network access service. The common gateway interface is used to send a target request for obtaining the request resource information to an external expansion server, and a target resource obtained by the external expansion server by calling a custom function to process the target request is received, that is, the website server can communicate with the external expansion server through the common gateway interface, thereby expanding the network service function of the website server and realizing better network service. The target sub-process generates a response message using the target resource, and the main process sends the response message to the terminal device, finally realizing resource feedback to the terminal device. As can be seen, the website server based on the main process and the plurality of sub-processes can be used to provide a network access service, the website server has a simple architecture, is easy to build and has a low cost, and can also use the common gateway interface to expand the function of the network service, thereby meeting the demand for providing a network service quickly and at a low cost.
[0047] In order to better understand the technical solutions and technical effects of the application, specific embodiments will be described in detail below with reference to the drawings.
[0048] Referring to Figure 1 , the figure is a flowchart of an access method provided by an embodiment of the application.
[0049] The access method provided by the embodiment of the application is applied to a website server, and the website server comprises a main process, a plurality of sub-processes and a common gateway (CGI) interface. Referring to Figure 2 , it is a schematic diagram of a website server architecture provided by an embodiment of the application. The website server adopts a synchronous blocking mode, that is, the website server can be divided into a main process and a sub-process, the main process and the sub-process respectively undertake different functions of the website server and cooperate with each other.
[0050] The main process is mainly responsible for: initializing loading various parameter configurations, daemon process and log processing, message receiving and forwarding. The sub-process is mainly responsible for: request processing. That is, the main process is responsible for various underlying basic businesses, and the sub-process is responsible for core businesses. Such allocation of tasks of the main process and the sub-process can modularize different functions, and can also facilitate debugging of the website server, so as to realize a website server which is relatively easy to build and low in cost.
[0051] In the embodiment of the application, the website server is constructed by using C language, and provides network access services based on HyperText Transfer Protocol (HTTP). HTTPS is a secure version of HTTP. The purpose of HTTP is to enable the website server to be accessed by a browser, and provides some basic functions, such as file download, image display, and the like. That is, the website server is responsible for processing HTTP requests and returning responses to terminal devices. The website server can accept HTTP requests from terminal devices including browsers, and generate corresponding HTML pages or other format documents according to the request content, and then sends them back to the terminal devices.
[0052] The common gateway interface can realize communication between the website server and the external extension server. When the website server cannot provide a certain network service, the external extension server can be used to provide the network service, that is, the website server can communicate with the external extension server through the common gateway interface, so as to expand the network service function of the website server and realize better network service.
[0053] Reference Figure 3 As shown in the figure, it is a network service framework schematic diagram provided by the embodiment of the application. The terminal device is a WEB client, which can be a browser for example. The WEB client can be a website client application program. The website server can be a WEB server, which can be a website server application program. The WEB server can include an external extension (FastCgi) client application program. The FastCgi client communicates with the FastCgi server through the common gateway interface, and the FastCgi server can be an external extension application program.
[0054] The WEB server can also include a plurality of modules, such as a server configuration reading and loading module, a limit access configuration reading and loading module, an HTTP message receiving and parsing module, and a request resource input and output (I / O) processing module. The request resource input and output processing module can include a directory part, a dynamic file part, a static file part, and a FastCgi client.
[0055] Before the website server runs, server configuration reading and access restriction configuration reading are performed, that is, server configuration and access restriction rule configuration are loaded. After the two configuration files are loaded into the website server application, a socket application process is performed, and then a socket programming interface is listened to, HTTP requests are received and processed.
[0056] After the website server starts running, the received HTTP request is forwarded to the HTTP message receiving and parsing module for processing. The HTTP message receiving and parsing module obtains the required information by parsing the message field of the HTTP request, and uses the obtained information to automatically determine the resource type of the HTTP request through the request resource I / O processing module, and calls the processing function of the corresponding resource type to transmit the requested resource. If the website server cannot provide the requested resource, the external expansion server can be used to provide the resource. Specifically, the external expansion client and the external expansion server can be interacted.
[0057] Reference Figure 4 As shown in the figure, an external expansion server architecture provided by the embodiment of the application is shown. The external expansion server includes a control (Master) process and a plurality of worker (Worker) processes. The Master process is a main process, mainly responsible for receiving and forwarding CGI messages. The Worker process is a sub-process, mainly responsible for processing CGI requests, such as message parsing of the CGI request, calling a custom function, and returning the processing result to the main process. The custom function can also be called a user-defined action function, which is configured by the user and can be configured according to the function of the network service.
[0058] Since the external expansion server adopts a process pool structure, the control right is on the Master process. The Master process manages all Worker processes. After the external expansion server starts running, the Worker processes are always resident in the memory and wait for request processing at any time, which can realize efficient request processing of the external expansion server. The user-defined function adopts the form of a function pointer, which is convenient for mapping the function name to the specified calling function.
[0059] The access method provided by the embodiment includes the following steps:
[0060] S101, the main process receives the hypertext transfer protocol request sent by the terminal device, and forwards the hypertext transfer protocol request to the target sub-process.
[0061] In the embodiments of the present application, the main process of the website server can receive the HTTP request sent by the terminal device, and forward the HTTP request to the target sub-process. In view of the factor of quickly processing the request, the main process can select any one of the sub-processes which have no request to process when forwarding the HTTP request, so that the idle sub-process can be used to process the HTTP request in time. That is, any one of the sub-processes which have no request to process is the target sub-process.
[0062] The website server can further include a socket programming interface, and the main process can receive the HTTP request sent by the terminal device by using the socket programming interface. The socket programming interface is obtained by initializing the socket corresponding to HTTP / HTTPS of the website server.
[0063] Specifically, before the website server provides the network service, the main process can load the server configuration of the website server, and initialize the socket programming interface for receiving the HTTP request.
[0064] S102, the target sub-process performs packet analysis on the HTTP request to obtain the request resource information corresponding to the HTTP request.
[0065] In the embodiments of the present application, after receiving the HTTP request forwarded by the main process, the target sub-process can perform packet analysis on the HTTP request to obtain the request resource information corresponding to the HTTP request.
[0066] In actual application, after obtaining the request resource information, the target sub-process can call the target function to process the HTTP request to obtain the target resource, so that the response packet can be generated according to the target resource, and the request processing is ended. The target function is a function defined in advance in the server configuration, and the target function can obtain the target resource.
[0067] S103, a target request for obtaining the request resource information is sent to the external expansion server through the public gateway interface, and the target resource obtained by calling the custom function to process the target request by the external expansion application is received.
[0068] In the embodiments of the present application, considering that the preconfigured target function can not be able to handle the hypertext transfer protocol request, the external expansion server can be utilized to continue the request processing, so as to obtain the target resource. The website server can send a target request for obtaining the request resource information to the external expansion server through the common gateway interface, where the target request can be a CGI message. After receiving the target request, the external expansion server can call a custom function to process the target request to obtain the target resource, and return the target resource to the website server. The target resource meets the request resource information.
[0069] Since the external expansion server includes a control process and a plurality of working processes, the website server can send a target request for obtaining the request resource information to the control process through the common gateway interface, the control process forwards the target request to the working process, the working process calls a custom function to process the target request to obtain the target resource and returns the target resource to the control process, and the control process returns the target resource to the target sub-process of the website server.
[0070] When the control process forwards the target request to the working process, an idle working process can be selected, so as to realize efficient target request processing.
[0071] In the embodiments of the present application, when the target request is processed by the custom function to obtain the target resource, the selected custom function is determined according to the request resource type included in the request resource information, and the obtained target resource meets the request resource type.
[0072] S104, the target sub-process generates a response message by using the target resource, and the main process sends the response message to the terminal device.
[0073] In the embodiments of the present application, after obtaining the target resource, the target sub-process can generate a response message by using the target resource and send it to the main process, and the main process sends the response message to the terminal device, so as to realize the access response of the terminal device.
[0074] In the embodiments of the present application, the website server can also limit the access of the terminal device, that is, the website server can also configure an access control function. Specifically, a limit access configuration file can be obtained, and it is determined whether the target resource meets the limit access condition of the terminal device according to the limit access configuration file. If yes, a response message that the terminal device cannot access is returned to the terminal device.
[0075] The limit access configuration file includes a preconfigured limit field, the limit field constitutes a limit access condition, and the limit access condition is used to control the access of the terminal device to the target resource, so as to improve the control of the website server on the resource.
[0076] It can be seen that the access method provided by the embodiment of the application is based on a website server, the website server has low development cost, is easy to maintain and expand, and has good portability. The architecture of the main process and the plurality of sub-processes can be used to build small WEB applications, such as personal blogs or online stores. Since the website server is implemented based on standard HTTP and HTTPS, the website server has high security.
[0077] Based on the access method provided in the above embodiment, the embodiment of the application further provides an access system, and the working principle thereof will be described in detail below with reference to the drawings.
[0078] Referring to Figure 5 , the figure is a structural schematic diagram of an access system provided by the embodiment of the application.
[0079] The access system 100 provided by the embodiment includes a website server application program 110 and an external extension application program 120, the website server application program 110 includes a main process, a plurality of sub-processes and an external extension client application program;
[0080] The main process is configured to receive a hypertext transfer protocol request sent by a website client application program, and forward the hypertext transfer protocol request to a target sub-process, the target sub-process being any one of the plurality of sub-processes that has not processed a request;
[0081] The target sub-process is configured to perform packet analysis on the hypertext transfer protocol request to obtain request resource information corresponding to the hypertext transfer protocol request;
[0082] The target sub-process is configured to send a target request for obtaining the request resource information to the external extension application program 120 through a common gateway interface by using the external extension client application program 120, and receive a target resource obtained by the external extension application program 120 by calling a custom function to process the target request;
[0083] The target sub-process is configured to generate a response packet by using the target resource, and the main process is configured to send the response packet to the website client application program.
[0084] Optionally, the external extension client application program 120 includes a control process and a plurality of working processes;
[0085] The website server application 110 is configured to send a target request for obtaining the requested resource information to the control process through the public gateway interface, the control process forwards the target request to the work process, the work process calls a custom function to process the target request to obtain a target resource, and returns the target resource to the control process, and the target sub-process receives the target resource sent by the control process.
[0086] Optionally, the custom function is configured to determine the request resource type according to the request resource information.
[0087] Optionally, the website server application 110 comprises a socket programming interface.
[0088] The main process is configured to receive a hypertext transfer protocol request sent by a website client application by using the socket programming interface.
[0089] Optionally, the website server application 110 is further configured to:
[0090] obtain a restricted access configuration file;
[0091] determine whether the target resource meets a restricted access condition of the website client application according to the restricted access configuration file, and if so, return an access denied response message to the website client application.
[0092] The target sub-process is further configured to call a target function to process the hypertext transfer protocol request to obtain a target resource.
[0093] Optionally, the website server application 110 comprises a socket programming interface.
[0094] The main process is configured to load a server configuration of the website server application 110, and initialize a socket programming interface for receiving the hypertext transfer protocol request.
[0095] Based on the access method provided in the above embodiments, the embodiments of the present application further provide an access device, which comprises:
[0096] a processor and a memory, the number of processors can be one or more. In some embodiments of the present application, the processor and the memory can be connected through a bus or other means.
[0097] The memory can include a read-only memory and a random access memory, and provide the processor with instructions and data. A portion of the memory can also include a NVRAM. The memory stores operating systems and operating instructions, executable modules or data structures, or subsets thereof, or expanded sets thereof, wherein the operating instructions can include various operating instructions for implementing various operations. The operating system can include various system programs for implementing various basic services and processing hardware-based tasks.
[0098] The processor controls the operation of the terminal device, and can also be referred to as a CPU.
[0099] The method disclosed in the embodiments of the present application can be applied to a processor or implemented by the processor. The processor can be an integrated circuit chip with a signal processing capability. In the implementation process, the steps of the above method can be completed by hardware integrated logic circuits in the processor or by instructions in the form of software. The processor mentioned above can be a general processor, a DSP, an ASIC, an FPGA, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, or other mature storage media in the art. The storage medium is located in the memory, and the processor reads the information in the memory and combines the hardware to complete the steps of the above method.
[0100] The embodiments of the present application also provide a computer readable storage medium for storing program codes, the program codes being used to execute any one of the methods of the above-mentioned various embodiments.
[0101] In the context of this application, a machine-readable medium can be a tangible medium that can contain or store program code for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include one or more lines of electrical wire, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0102] Note that the computer-readable medium or media discussed above can be or include computer-readable storage media or computer-readable signal media or any combination thereof. Computer-readable storage media can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media can include, but are not limited to, the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present context, computer-readable storage media can be any tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present context, computer-readable signal media can include any computer-readable medium that is not a computer-readable storage medium and that can communicate programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable media in the present context can include, but are not limited to, any suitable medium for communicating programs from one place to another. Programs can be communicated, for example, on a tangible medium, in a carrier wave, and / or on any suitable combination of the foregoing. Computer-readable media in the present context can include, but are not limited to, any medium that can be accessed by a computer. A computer-readable medium can include one or more computer-readable storage media or computer-readable signal media.
[0103] The terms "first" and "second" are used to denote different units in various embodiments of the present application and are not intended to denote a particular chronological order, or a particular sequence. The terms "coupled" and "connected" and variations thereof describe functional relationships, rather than physical relationships. For example, one device can be "connected" to another device to perform a function for that device, even though the devices are not physically connected to one another.
[0104] It should be noted that, those skilled in the art can understand that all or part of the processes in the above method embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium. When the program is executed, the processes of the above method embodiments can be included. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM), etc.
[0105] Computer program code for carrying out operations of the present application can be written in one or more programming languages or combinations of languages including object oriented programming languages such as Java, Smalltalk, C++ or conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0106] Each of the embodiments in the present specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. Especially, the device embodiments are described more simply because they are basically similar to the method embodiments. The relevant parts can be referred to the part of the method embodiments. The device embodiments described above are only schematic and the units and modules described as separate components can or can not be physically separate. In addition, some or all of the units and modules can be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement without creative labor.
[0107] The above description is only the preferred embodiment of the present application, although the present application has been disclosed as above with the preferred embodiment, however, not to limit the present application. Any skilled person in the art, without departing from the scope of the technical scheme of the present application, can utilize the above disclosed methods and technical contents to make many possible changes and modifications to the technical scheme of the present application, or modify as equivalent embodiments of equivalent changes. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application, without departing from the content of the technical scheme of the present application, still belongs to the scope of protection of the technical scheme of the present application.
Claims
1. An access method, characterized in that, The method is applied to a website server, the website server comprising a main process, a plurality of sub-processes and a common gateway interface, and the method comprises: The main process receives a hypertext transfer protocol request sent by a terminal device, forwards the hypertext transfer protocol request to a target sub-process, and the target sub-process is any one of the sub-processes which has not processed a request; The target sub-process performs packet analysis on the hypertext transfer protocol request to obtain request resource information corresponding to the hypertext transfer protocol request; A target request for obtaining the request resource information is sent to an external expansion server through the common gateway interface, and a target resource obtained by the external expansion server by calling a custom function to process the target request is received; The target sub-process generates a response packet by using the target resource, and the main process sends the response packet to the terminal device.
2. The method of claim 1, wherein, The external expansion server comprises a control process and a plurality of working processes; The target request for obtaining the request resource information is sent to the control process through the common gateway interface, the control process forwards the target request to the working process, the working process calls a custom function to process the target request to obtain a target resource and returns the target resource to the control process, and the target sub-process receives the target resource sent by the control process. The custom function is determined according to a request resource type included in the request resource information.
3. The method of claim 1, wherein, The website server comprises a socket programming interface; 4. The method of claim 1, wherein, The main process receives a hypertext transfer protocol request sent by a terminal device comprises: The main process receives a hypertext transfer protocol request sent by a terminal device by using the socket programming interface. The method further comprises:
5. The method of claim 1, wherein, An access restriction configuration file is obtained; It is determined whether the target resource meets an access restriction condition of the terminal device according to the access restriction configuration file, and if so, a response packet indicating that access is not allowed is returned to the terminal device. The method further comprises:
6. The method of claim 1, wherein, The target sub-process calls a target function to process the hypertext transfer protocol request to obtain a target resource. The website server comprises a socket programming interface; 7. The method according to any one of claims 1 to 6, characterized in that, The method further comprises: The main process loads a server configuration of the website server and initializes a socket programming interface for receiving the hypertext transfer protocol request. The system comprises a website server application and an external expansion application, the website server application comprising a main process, a plurality of sub-processes and an external expansion client application; 8. An access system, characterized in that The main process receives a hypertext transfer protocol request sent by a website client application, forwards the hypertext transfer protocol request to a target sub-process, and the target sub-process is any one of the sub-processes which has not processed a request; The target sub-process is configured to parse the HTTP request to obtain request resource information corresponding to the HTTP request; The target sub-process is configured to send a target request for obtaining the request resource information to an external extension application through a public gateway interface by using the external extension client application, and receive a target resource obtained by invoking a custom function of the external extension application to process the target request; The target sub-process is configured to generate a response message by using the target resource, and the main process is configured to send the response message to the website client application.
9. An access device, characterized in that The device comprises a processor and a memory; The memory is configured to store instructions; The processor is configured to execute the instructions in the memory to perform the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer program product comprises instructions which, when executed on a computer, cause the computer to perform the method according to any one of claims 1-7.
Citation Information
Patent Citations
Separating multi-stage buffer network content filtering system and method
CN101989916A
C++ based webpage access request response method and system
CN105260183A