CN115865885A - Protocol request forwarding method, device, equipment and medium based on browser plug-in - Google Patents

Protocol request forwarding method, device, equipment and medium based on browser plug-in Download PDF

Info

Publication number
CN115865885A
CN115865885A CN202211480778.8A CN202211480778A CN115865885A CN 115865885 A CN115865885 A CN 115865885A CN 202211480778 A CN202211480778 A CN 202211480778A CN 115865885 A CN115865885 A CN 115865885A
Authority
CN
China
Prior art keywords
request
interface
browser plug
protocol
class
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211480778.8A
Other languages
Chinese (zh)
Inventor
王颖奇
冯斌
吕宗远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Fulin Technology Co Ltd
Original Assignee
Shenzhen Fulin 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 Shenzhen Fulin Technology Co Ltd filed Critical Shenzhen Fulin Technology Co Ltd
Priority to CN202211480778.8A priority Critical patent/CN115865885A/en
Publication of CN115865885A publication Critical patent/CN115865885A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention relates to the field of computer communication, and discloses a protocol request forwarding method based on a browser plug-in, which comprises the following steps: the method comprises the steps of building a module based on a plug-in interaction module to obtain a browser plug-in, intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, forwarding a standard updating request obtained by regularly updating a request header in the interface request to a rear end when the interface request is a hypertext transfer protocol request, obtaining a defined interface class according to the interface request when the interface request is a full-duplex communication protocol request, performing data replacement on the interface request by using a rewritten interface class obtained by logic rewriting, and judging that the interface request is forwarded when the data replacement is completed. In addition, the invention also relates to a block chain technology, and the standard updating request can be stored in the node of the block chain. The invention also provides a protocol request forwarding device based on the browser plug-in, electronic equipment and a storage medium. The invention can improve the efficiency of protocol request forwarding.

Description

Protocol request forwarding method, device, equipment and medium based on browser plug-in
Technical Field
The invention relates to the field of computer communication, in particular to a protocol request forwarding method and device based on a browser plug-in, electronic equipment and a storage medium.
Background
In the process of developing and testing different projects and products, a forwarding function of an application programming interface request is often required, wherein the application programming interface includes a hypertext transfer protocol and a full-duplex communication protocol, and the request forwarding function is used for a front end under different environments to request a back end of any one deployment environment. Therefore, it is necessary to provide a protocol request forwarding method.
The existing protocol request forwarding method is that a configuration file pointed by a back end is modified in a code, and the modified configuration file is reconstructed, deployed and applied to take effect.
Disclosure of Invention
The invention provides a protocol request forwarding method and device based on a browser plug-in, electronic equipment and a storage medium, and mainly aims to improve the efficiency of protocol request forwarding.
In order to achieve the above object, the present invention provides a protocol request forwarding method based on a browser plug-in, including:
building a module based on a pre-built plug-in interaction module to obtain a browser plug-in;
intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, and judging the type of the interface request;
when the interface request is a hypertext transfer protocol request, performing rule updating processing on a request header in the interface request to obtain a standard updating request, forwarding the standard updating request to a corresponding back end, and when the back end receives the standard updating request, judging that the interface request is forwarded completely;
when the interface request is a full duplex communication protocol request, acquiring a defined interface class according to the interface request, and logically rewriting the defined interface class to obtain a rewritten interface class;
and carrying out data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
Optionally, the module building is performed based on the pre-built plug-in interaction module to obtain the browser plug-in, where the module building includes:
initializing the pre-constructed interface frame by using a front-end tool chain to obtain an initial frame;
creating a plug-in component directory and a configuration file corresponding to a pre-constructed plug-in interaction module;
and declaring a plurality of reference authorities in the configuration file, and laying the configuration file with the declared plurality of reference authorities and the plugin component directory under the initial frame to obtain the browser plugin.
Optionally, before performing rule update processing on a request header in the interface request and obtaining a standard update request, the method further includes:
locating a request header in the interface request and identifying a protocol type in the request header;
when the protocol type is a hypertext transfer protocol, judging the interface request as a hypertext transfer protocol request;
and when the protocol type is a full-duplex communication protocol, judging the interface request as a full-duplex communication protocol request.
Optionally, the performing rule update processing on the request header in the interface request to obtain a standard update request includes:
acquiring a preset rule structure and checking a processing rule in the request header by using the preset rule structure;
and updating the processing rule by using an updating method to obtain a standard updating request.
Optionally, the obtaining a defined interface class according to the interface request includes:
identifying a full-duplex communication class to which the interface request belongs, and declaring a defined full-duplex communication class having an inheritance relationship with the full-duplex communication class;
and taking the defined full-duplex communication class as the defined interface class.
Optionally, the logically rewriting the defined interface class to obtain a rewritten interface class includes:
receiving uniform resource positioning parameters in the defined interface class, and performing character processing on the uniform resource positioning parameters to obtain conversion parameters;
and transmitting the conversion parameters to a preset interface class by using a transmission method to obtain a re-interface class.
Optionally, after the data replacement processing is performed on the interface request by using the rewriting interface class, the method further includes:
the method for replacing data is executed in script codes in the browser plug-in.
In order to solve the above problem, the present invention further provides a protocol request forwarding apparatus based on a browser plug-in, where the apparatus includes:
the plug-in building module is used for building a module based on a pre-built plug-in interaction module to obtain a browser plug-in;
the rule updating module is used for intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, judging the type of the interface request, performing rule updating processing on a request header in the interface request to obtain a standard updating request when the interface request is a hypertext transfer protocol request, forwarding the standard updating request to a corresponding rear end, and judging that the interface request is forwarded when the rear end receives the standard updating request;
the logic rewriting module is used for acquiring a defined interface class according to the interface request when the interface request is a full duplex communication protocol request, and performing logic rewriting on the defined interface class to obtain a rewritten interface class;
and the data replacement module is used for performing data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the browser plug-in based protocol request forwarding method described above.
In order to solve the above problem, the present invention further provides a storage medium, where at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the above protocol request forwarding method based on a browser plug-in.
In the embodiment of the invention, the browser plug-in is constructed by the plurality of plug-in interaction modules, the browser plug-in is realized without intrusiveness to the project source code, and the browser plug-in is convenient to use and high in flexibility. And the protocol request is forwarded by adopting a rule updating and full duplex communication protocol rewriting mode according to different types of the interface requests when the browser plug-in intercepts the interface requests, so that the protocol request forwarding efficiency is higher. Therefore, the method, the device, the electronic equipment and the storage medium for forwarding the protocol request based on the browser plug-in can solve the problem of low efficiency of forwarding the protocol request based on the browser plug-in.
Drawings
Fig. 1 is a schematic flowchart of a protocol request forwarding method based on a browser plug-in according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart showing a detailed implementation of one of the steps in FIG. 1;
fig. 3 is a functional block diagram of a protocol request forwarding apparatus based on a browser plug-in according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device for implementing the protocol request forwarding method based on the browser plug-in according to an embodiment of the present invention.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a protocol request forwarding method based on a browser plug-in. The execution subject of the protocol request forwarding method based on the browser plug-in includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the protocol request forwarding method based on the browser plug-in may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Fig. 1 is a schematic flowchart of a protocol request forwarding method based on a browser plug-in according to an embodiment of the present invention. In this embodiment, the protocol request forwarding method based on the browser plug-in includes the following steps S1 to S4:
s1, building a module based on a pre-built plug-in interaction module to obtain a browser plug-in.
In the embodiment of the invention, the plug-in interaction module comprises a background module, a contentScript module, a popup module and the like.
In detail, the background module is a background module of the browser plug-in, and is used for logic processing, such as network interception. The contentScript module is script code that the browser plug-in injects into the web page, for example, websocket overlay processing. The popup module is an interactive page of the browser plug-in and is used as a window popped up when a user clicks the plug-in.
Specifically, referring to fig. 2, the module building based on the pre-built plug-in interaction module to obtain the browser plug-in includes the following steps S11 to S13:
s11, initializing a pre-constructed interface frame by using a front-end tool chain to obtain an initial frame;
s12, creating a plugin component directory and a configuration file corresponding to the pre-constructed plugin interactive module;
and S13, declaring a plurality of reference authorities in the configuration file, and laying the configuration file with the declared plurality of reference authorities and the plugin component directory under the initial frame to obtain the browser plugin.
In detail, the front end toolchain refers to a Vite tool, and the Vite is a front end toolchain of the next generation based on front end packing tools Ebuild and Esm modules. The pre-constructed interface framework is a JavaScript framework for constructing a user interface by utilizing Vue, which is one of the most popular development frameworks in the current Web front-end development, and the Vue3 framework used in the scheme provides higher performance and combined API compared with the Vue2 framework in which the Proxy method is used at the bottom layer of Vue 3.
The plug-in component directories corresponding to the plug-in interaction modules are a background directory, a contentScript directory and a popup directory respectively, and the configuration file is a manifest. Json declares that a plurality of reference rights needed to be used are storage rights and network request related rights, namely, clearationnetrequest and clearationnetrequestfeedback.
S2, intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, and judging the type of the interface request.
In the embodiment of the invention, the browser plug-in is a tool which is additionally provided with new functions based on the existing functions of the browser, so that the browser plug-in is positioned on the browser to which the browser plug-in belongs, and an interception interface request sent by the browser to which the browser belongs can be intercepted according to the browser plug-in.
Specifically, the type of the intercepted interface request sent by the browser to which the browser plug-in belongs needs to be judged, the type of the interface request is judged, and subsequent request forwarding processing is performed according to the type of the interface request.
And S3, when the interface request is a hypertext transfer protocol request, performing rule updating processing on a request header in the interface request to obtain a standard updating request, forwarding the standard updating request to a corresponding rear end, and when the rear end receives the standard updating request, judging that the interface request is forwarded completely.
In this embodiment of the present invention, before performing rule update processing on the request header in the interface request to obtain a standard update request, the method further includes:
locating a request header in the interface request and identifying a protocol type in the request header;
when the protocol type is a hypertext transfer protocol, judging the interface request as a hypertext transfer protocol request;
and when the protocol type is a full-duplex communication protocol, judging the interface request as a full-duplex communication protocol request.
In detail, the request header is used for informing the server of some information related to the client environment and the request body, such as the browser version, the protocol type or the length of the request parameter. The server may try to provide a better response to the client based on the client information given in the header of the request header.
Preferably, the HyperText Transfer Protocol refers to HTTP (HyperText Transfer Protocol), where the HyperText Transfer Protocol is a basis for data exchange on Web and is a "client-server side" Protocol. The full-duplex communication protocol request refers to a protocol for performing full-duplex communication on a single TCP connection, and the full-duplex communication protocol in the scheme refers to Websocket, so that data exchange between the client and the server is simpler, and the server is allowed to actively push data to the client. In the Websocket API, the browser and the server only need to complete one handshake, and persistent connection can be directly established between the browser and the server, and bidirectional data transmission is carried out.
Further, the performing rule update processing on the request header in the interface request to obtain a standard update request includes:
acquiring a preset rule structure and checking a processing rule in the request header by using the preset rule structure;
and updating the processing rule by using an updating method to obtain a standard updating request.
In detail, the preset rule structure is a rule structure, the rule structure can view the rule document, and the processing rule is updated through browser.
Among them, the code of the update process may refer to the following:
Figure BDA0003960452000000071
specifically, if it is desired to implement rule clearing, it may be implemented by changing rules into an empty array, and it is necessary to call browse, clearing netrequest, update sessionrules again for processing, that is, the previous proxy rule may be cleared.
And S4, when the interface request is a full duplex communication protocol request, acquiring a defined interface class according to the interface request, and logically rewriting the defined interface class to obtain a rewritten interface class.
In this embodiment of the present invention, the acquiring a defined interface class according to the interface request includes:
identifying a full-duplex communication class to which the interface request belongs, and declaring a defined full-duplex communication class having an inheritance relationship with the full-duplex communication class;
taking the defined full duplex communication class as the defined interface class.
In detail, a proxyWebsocket method needs to be realized, a self-defined MyWebsocket class is declared first, and the Websocket class carried by the page is inherited.
Specifically, the logically rewriting the defined interface class to obtain a rewritten interface class includes:
receiving uniform resource positioning parameters in the defined interface class, and performing character processing on the uniform resource positioning parameters to obtain conversion parameters;
and transmitting the conversion parameters to a preset interface class by using a transmission method to obtain a re-interface class.
In detail, the URL parameter is a URL (Uniform Resource Locator) parameter, a parameter linked to the URL is received, a certain character processing is performed on the URL, and a super method of a class is used to transmit a processed URL, that is, a super (URL).
And S5, carrying out data replacement processing on the interface request by utilizing the rewriting interface class, and judging that the interface request is completely forwarded when the data replacement processing is completed.
In the embodiment of the invention, the rewriting interface class is used for replacing the original full duplex communication Websocket in the interface request, namely, the defined MyWebsocket is used for covering the original Websocket of the page, and the code can be expressed as window.
Specifically, after the data replacement processing is performed on the interface request by using the rewriting interface class, the method further includes:
and executing the data replacing method in script codes in the browser plug-in.
In detail, the script code of the browser plug-in is contentScript, comes into the contentScript, introduces the proxyWebsocket method realized by the browser plug-in, and automatically executes the code to replace the original Websocket when a page is loaded. When the page calls the Websocket to initialize the connection of the Websocket protocol, the actually used MyWebsocket is replaced, and the forwarding of the Websocket request protocol is realized.
In the embodiment of the invention, the browser plug-in is constructed by the plurality of plug-in interaction modules, so that the browser plug-in is realized without intrusiveness to the project source code, and is convenient to use and high in flexibility. And the protocol request is forwarded by adopting a rule updating and full duplex communication protocol rewriting mode according to different types of the interface requests when the browser plug-in intercepts the interface requests, so that the protocol request forwarding efficiency is higher. Therefore, the protocol request forwarding method based on the browser plug-in can solve the problem of low efficiency of improving the forwarding of the protocol request based on the browser plug-in.
Fig. 3 is a functional block diagram of a protocol request forwarding apparatus based on a browser plug-in according to an embodiment of the present invention.
The protocol request forwarding device 100 based on the browser plug-in of the present invention can be installed in an electronic device. According to the implemented functions, the browser plug-in based protocol request forwarding apparatus 100 may include a plug-in construction module 101, a rule updating module 102, a logic rewriting module 103, and a data replacement module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the plug-in constructing module 101 is used for constructing a module based on a pre-constructed plug-in interaction module to obtain a browser plug-in;
the rule updating module 102 is configured to intercept, by using the browser plug-in, an interface request sent by a browser to which the browser plug-in belongs, determine a type of the interface request, perform rule updating processing on a request header in the interface request when the interface request is a hypertext transfer protocol request, obtain a standard updating request, forward the standard updating request to a corresponding back end, and determine that the interface request is completely forwarded when the back end receives the standard updating request;
the logical rewriting module 103 is configured to, when the interface request is a full duplex communication protocol request, obtain a defined interface class according to the interface request, and perform logical rewriting on the defined interface class to obtain a rewritten interface class;
the data replacement module 104 is configured to perform data replacement processing on the interface request by using the rewriting interface class, and when the data replacement processing is completed, determine that the interface request is completed to be forwarded.
In detail, the specific implementation of each module of the protocol request forwarding device 100 based on the browser plug-in is as follows:
step one, building a module based on a pre-built plug-in interaction module to obtain a browser plug-in.
In the embodiment of the invention, the plug-in interaction module comprises a background module, a contentScript module, a popup module and the like.
In detail, the background module is a background module of the browser plug-in, and is used for logic processing, such as network interception. The contentScript module is script code that the browser plug-in injects into the web page, for example, websocket overlay processing. The popup module is an interactive page of the browser plug-in and is used as a window popped up when a user clicks the plug-in.
Specifically, the module construction is performed based on the pre-constructed plug-in interaction module to obtain the browser plug-in, and the method includes:
initializing the pre-constructed interface frame by using a front-end tool chain to obtain an initial frame;
creating a plug-in component directory and a configuration file corresponding to a pre-constructed plug-in interaction module;
and declaring a plurality of reference authorities in the configuration file, and laying the configuration file with the declared plurality of reference authorities and the plugin component directory under the initial frame to obtain the browser plugin.
In detail, the front end toolchain refers to a Vite tool, and the Vite is a front end toolchain of the next generation based on front end packing tools Ebuild and Esm modules. The pre-constructed interface framework is a JavaScript framework for constructing a user interface by utilizing Vue, which is one of the most popular development frameworks in the current Web front-end development, and the Vue3 framework used in the scheme provides higher performance and combined API compared with the Vue2 framework in which the Proxy method is used at the bottom layer of Vue 3.
The plug-in component directories corresponding to the plug-in interaction modules are a background directory, a contentScript directory and a popup directory respectively, and the configuration file is a manifest. And declaring a plurality of reference authorities required to be used in the configuration file manifest.json as storage authority and network request related authorities, namely, declarvationnetrequest and declarvationnetrequestfeedback.
And secondly, intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, and judging the type of the interface request.
In the embodiment of the invention, the browser plug-in is a tool which is additionally provided with new functions based on the existing functions of the browser, so that the browser plug-in is positioned on the browser to which the browser plug-in belongs, and an interception interface request sent by the browser to which the browser belongs can be intercepted according to the browser plug-in.
Specifically, the type of the intercepted interface request sent by the browser to which the browser plug-in belongs needs to be judged, the type of the interface request is judged, and subsequent request forwarding processing is performed according to the type of the interface request.
And step three, when the interface request is a hypertext transfer protocol request, performing rule updating processing on a request header in the interface request to obtain a standard updating request, forwarding the standard updating request to a corresponding rear end, and when the rear end receives the standard updating request, judging that the interface request is forwarded completely. In this embodiment of the present invention, before performing rule update processing on the request header in the interface request to obtain a standard update request, the method further includes:
locating a request header in the interface request and identifying a protocol type in the request header;
when the protocol type is a hypertext transfer protocol, judging the interface request as a hypertext transfer protocol request;
and when the protocol type is a full-duplex communication protocol, judging the interface request as a full-duplex communication protocol request.
In detail, the request header is used for informing the server of some information related to the client environment and the request body, such as the browser version, the protocol type or the length of the request parameter. The server may try to provide a better response to the client based on the client information given in the header of the request header.
Preferably, the HyperText Transfer Protocol refers to HTTP (HyperText Transfer Protocol), where the HyperText Transfer Protocol is a basis for data exchange on Web and is a "client-server side" Protocol. The full-duplex communication protocol request refers to a protocol for performing full-duplex communication on a single TCP connection, and the full-duplex communication protocol in the scheme refers to Websocket, so that data exchange between the client and the server is simpler, and the server is allowed to actively push data to the client. In the Websocket API, the browser and the server only need to complete one handshake, and persistent connection can be directly established between the browser and the server, and bidirectional data transmission is carried out.
Further, the performing rule update processing on the request header in the interface request to obtain a standard update request includes:
acquiring a preset rule structure and checking a processing rule in the request header by using the preset rule structure;
and updating the processing rule by using an updating method to obtain a standard updating request.
In detail, the preset rule structure is a rule structure, the rule structure can view the rule document, and the processing rule is updated through browser.
Among them, the code of the update process may refer to the following:
Figure BDA0003960452000000111
specifically, if it is desired to implement rule clearing, it may be implemented by changing rules into an empty array, and it is necessary to call browse, clearing netrequest, update sessionrules again for processing, that is, the previous proxy rule may be cleared.
And step four, when the interface request is a full duplex communication protocol request, acquiring a defined interface class according to the interface request, and logically rewriting the defined interface class to obtain a rewritten interface class.
In this embodiment of the present invention, the acquiring a defined interface class according to the interface request includes:
identifying a full-duplex communication class to which the interface request belongs, and declaring a defined full-duplex communication class having an inheritance relationship with the full-duplex communication class;
and taking the defined full-duplex communication class as the defined interface class.
In detail, a proxyWebsocket method needs to be realized, a self-defined MyWebsocket class is declared first, and the Websocket class carried by the page is inherited.
Specifically, the logically rewriting the defined interface class to obtain a rewritten interface class includes:
receiving uniform resource positioning parameters in the defined interface class, and performing character processing on the uniform resource positioning parameters to obtain conversion parameters;
and transmitting the conversion parameters to a preset interface class by using a transmission method to obtain a re-interface class.
In detail, the URL parameter is a URL (Uniform Resource Locator) parameter, a parameter linked to the URL is received, a certain character processing is performed on the URL, and a super method of the class is used to transmit the processed URL, that is, the super.
And fifthly, carrying out data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
In the embodiment of the invention, the rewriting interface class is used for replacing the original full duplex communication Websocket in the interface request, namely the defined MyWebsocket is used for covering the original Websocket of the page, and the code can be expressed as window.
Specifically, after the data replacement processing is performed on the interface request by using the rewriting interface class, the method further includes:
the method for replacing data is executed in script codes in the browser plug-in.
In detail, the script code of the browser plug-in is contentScript, comes into the contentScript, introduces the proxyWebsocket method realized by the browser plug-in, and automatically executes the code to replace the original Websocket when a page is loaded. When the page calls the Websocket to initialize the connection of the Websocket protocol, the actually used MyWebsocket is replaced, and the forwarding of the Websocket request protocol is realized.
In the embodiment of the invention, the browser plug-in is constructed by the plurality of plug-in interaction modules, so that the browser plug-in is realized without intrusiveness to the project source code, and is convenient to use and high in flexibility. And the protocol request is forwarded by adopting a rule updating and full duplex communication protocol rewriting mode according to different types of the interface requests when the browser plug-in intercepts the interface requests, so that the protocol request forwarding efficiency is higher. Therefore, the protocol request forwarding device based on the browser plug-in can solve the problem of low efficiency of improving the forwarding of the protocol request based on the browser plug-in.
Fig. 4 is a schematic structural diagram of an electronic device for implementing a protocol request forwarding method based on a browser plug-in according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a browser plug-in based protocol request forwarding program, stored in the memory 11 and operable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules stored in the memory 11 (for example, executing a protocol request forwarding program based on a browser plug-in, etc.), and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as a code of a protocol request forwarding program based on a browser plug-in, etc., but also to temporarily store data that has been output or will be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 4 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 4 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the embodiments described are illustrative only and are not to be construed as limiting the scope of the claims.
The browser plug-in based protocol request forwarding program stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, and when running in the processor 10, can realize:
building a module based on a pre-built plug-in interaction module to obtain a browser plug-in;
intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, and judging the type of the interface request;
when the interface request is a hypertext transfer protocol request, performing rule updating processing on a request header in the interface request to obtain a standard updating request, forwarding the standard updating request to a corresponding back end, and when the back end receives the standard updating request, judging that the interface request is forwarded completely;
when the interface request is a full duplex communication protocol request, acquiring a defined interface class according to the interface request, and logically rewriting the defined interface class to obtain a rewritten interface class;
and carrying out data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
Specifically, the specific implementation method of the instruction by the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, which is not described herein again.
Further, the integrated modules/units of the electronic device 1 may be stored in a storage medium if they are implemented in the form of software functional units and sold or used as separate products. The storage medium may be volatile or nonvolatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, a recording medium, a usb-disk, a removable hard disk, a magnetic diskette, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a storage medium, which is readable and stores a computer program that, when executed by a processor of an electronic device, can implement:
building a module based on a pre-built plug-in interaction module to obtain a browser plug-in;
intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, and judging the type of the interface request;
when the interface request is a hypertext transfer protocol request, performing rule updating processing on a request header in the interface request to obtain a standard updating request, forwarding the standard updating request to a corresponding rear end, and when the rear end receives the standard updating request, judging that the interface request is forwarded completely;
when the interface request is a full duplex communication protocol request, acquiring a definition interface class according to the interface request, and logically rewriting the definition interface class to obtain a rewritten interface class;
and carrying out data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A protocol request forwarding method based on a browser plug-in is characterized by comprising the following steps:
building a module based on a pre-built plug-in interaction module to obtain a browser plug-in;
intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, and judging the type of the interface request;
when the interface request is a hypertext transfer protocol request, performing rule updating processing on a request header in the interface request to obtain a standard updating request, forwarding the standard updating request to a corresponding back end, and when the back end receives the standard updating request, judging that the interface request is forwarded completely;
when the interface request is a full duplex communication protocol request, acquiring a definition interface class according to the interface request, and logically rewriting the definition interface class to obtain a rewritten interface class;
and carrying out data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
2. The method for forwarding a protocol request based on a browser plug-in according to claim 1, wherein the module construction is performed based on a pre-constructed plug-in interaction module to obtain the browser plug-in, and the method comprises:
initializing the pre-constructed interface frame by using a front-end tool chain to obtain an initial frame;
creating a plug-in component directory and a configuration file corresponding to a pre-constructed plug-in interaction module;
and declaring a plurality of reference authorities in the configuration file, and laying the configuration file with the declared plurality of reference authorities and the plugin component directory under the initial frame to obtain the browser plugin.
3. The method for forwarding a protocol request based on a browser plug-in of claim 1, wherein before the rule update processing is performed on the request header in the interface request and a standard update request is obtained, the method further comprises:
locating a request header in the interface request and identifying a protocol type in the request header;
when the protocol type is a hypertext transfer protocol, judging the interface request as a hypertext transfer protocol request;
and when the protocol type is a full-duplex communication protocol, judging the interface request as a full-duplex communication protocol request.
4. The method for forwarding a protocol request based on a browser plug-in according to claim 1, wherein the step of performing rule update processing on a request header in the interface request to obtain a standard update request comprises:
acquiring a preset rule structure and checking a processing rule in the request header by using the preset rule structure;
and updating the processing rule by using an updating method to obtain a standard updating request.
5. The browser plug-in based protocol request forwarding method of claim 1, wherein the obtaining a defined interface class according to the interface request comprises:
identifying a full-duplex communication class to which the interface request belongs, and declaring a defined full-duplex communication class having an inheritance relationship with the full-duplex communication class;
taking the defined full duplex communication class as the defined interface class.
6. The browser plug-in based protocol request forwarding method of claim 1, wherein the logically rewriting the defined interface class to obtain a rewritten interface class comprises:
receiving uniform resource positioning parameters in the defined interface class, and performing character processing on the uniform resource positioning parameters to obtain conversion parameters;
and transmitting the conversion parameters to a preset interface class by using a transmission method to obtain a re-interface class.
7. The browser plug-in based protocol request forwarding method of claim 1, wherein after the performing the data replacement process on the interface request by using the rewritten interface class, the method further comprises:
the method for replacing data is executed in script codes in the browser plug-in.
8. A browser plug-in based protocol request forwarding apparatus, the apparatus comprising:
the plug-in building module is used for building a module based on a pre-built plug-in interaction module to obtain a browser plug-in;
the rule updating module is used for intercepting an interface request sent by a browser to which the browser plug-in belongs by using the browser plug-in, judging the type of the interface request, performing rule updating processing on a request header in the interface request to obtain a standard updating request when the interface request is a hypertext transfer protocol request, forwarding the standard updating request to a corresponding rear end, and judging that the interface request is forwarded when the rear end receives the standard updating request;
the logic rewriting module is used for acquiring a defined interface class according to the interface request when the interface request is a full duplex communication protocol request, and performing logic rewriting on the defined interface class to obtain a rewritten interface class;
and the data replacement module is used for performing data replacement processing on the interface request by using the rewriting interface class, and judging that the interface request is forwarded completely when the data replacement processing is completed.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform a browser plug-in based protocol request forwarding method according to any one of claims 1 to 7.
10. A storage medium storing a computer program, wherein the computer program, when executed by a processor, implements a browser plug-in based protocol request forwarding method according to any one of claims 1 to 7.
CN202211480778.8A 2022-11-24 2022-11-24 Protocol request forwarding method, device, equipment and medium based on browser plug-in Pending CN115865885A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211480778.8A CN115865885A (en) 2022-11-24 2022-11-24 Protocol request forwarding method, device, equipment and medium based on browser plug-in

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211480778.8A CN115865885A (en) 2022-11-24 2022-11-24 Protocol request forwarding method, device, equipment and medium based on browser plug-in

Publications (1)

Publication Number Publication Date
CN115865885A true CN115865885A (en) 2023-03-28

Family

ID=85665697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211480778.8A Pending CN115865885A (en) 2022-11-24 2022-11-24 Protocol request forwarding method, device, equipment and medium based on browser plug-in

Country Status (1)

Country Link
CN (1) CN115865885A (en)

Similar Documents

Publication Publication Date Title
CN112506559B (en) Gray release method and device based on gateway, electronic equipment and storage medium
US9912522B2 (en) Automatic task tracking
CN113238929B (en) Code testing method and device based on Mock data, electronic equipment and storage medium
CN112486490B (en) Front-end code packaging method and device, electronic equipment and storage medium
CN112506779A (en) Software interface testing method and device, electronic equipment and storage medium
CN114356530A (en) Task scheduling method and device, electronic equipment and storage medium
CN114844792A (en) Dynamic monitoring method, device, equipment and storage medium based on LUA language
CN114185776A (en) Big data point burying method, device, equipment and medium for application program
CN114006885A (en) Data acquisition method and device based on intelligent equipment and electronic equipment
CN115865885A (en) Protocol request forwarding method, device, equipment and medium based on browser plug-in
CN114064033A (en) Front-end component development method and device, electronic equipment and readable storage medium
CN115080899A (en) Interactive sub-web page starting method, device, equipment and storage medium
CN114942855A (en) Interface calling method and device, electronic equipment and storage medium
CN114844693A (en) Lightweight communication data encryption method, device, equipment and storage medium
CN115174555A (en) File transmission method and device, electronic equipment and storage medium
CN114371962A (en) Data acquisition method and device, electronic equipment and storage medium
CN114185588A (en) Incremental package generation method, device, equipment and storage medium
CN112051952A (en) Picture dynamic browsing method and device, electronic equipment and readable storage medium
US11017032B1 (en) Document recovery utilizing serialized data
CN113778447B (en) Service compatibility method and device of front-end system, electronic equipment and storage medium
CN112637280B (en) Data transmission method, device, electronic equipment and storage medium
CN115934576B (en) Test case generation method, device, equipment and medium in transaction scene
CN115080894A (en) Method, device, equipment and storage medium for calling and updating data of H5 page
CN113452785B (en) Service access method and device based on offline resources, electronic equipment and medium
CN114510666A (en) Page jump method, device, equipment and storage medium

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