Disclosure of Invention
In view of the above, the main objective of the present invention is to provide a method and an apparatus for correcting a Cookie, which can solve the problem that a mobile terminal cannot access a corresponding SP because the mobile terminal carries wrong Cookie information, meet the practical requirements of a user in time, and improve the satisfaction of the user.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the invention provides a Cookie error correction method, which comprises the following steps:
determining that Cookie information carried in a service request message sent by a mobile terminal is the same as the prestored Cookie information when the mobile terminal requests for the first service, and sending the Cookie information carried in the service request message of the mobile terminal to a Service Provider (SP);
and when the Cookie information carried in the service request message sent by the mobile terminal is determined to be different from the Cookie information which is stored in advance when the mobile terminal requests the first service, replacing the Cookie information carried in the service request message of the mobile terminal with the Cookie information which is stored in advance when the mobile terminal requests the first service, and sending the Cookie information to a Service Provider (SP).
Preferably, the determining that the Cookie information carried in the service request message sent by the mobile terminal is the same as the pre-stored Cookie information when the mobile terminal requests for the first service includes:
determining that the number of the mobile terminal, the value of the Domain, the path and the name in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first time service are the same as the value of the Cookie information carried in the service request message sent by the mobile terminal, and when the Domain and the path in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first time service are the same as the Cookie information carried in the service request message sent by the mobile terminal, the Cookie information carried in the service request message sent by the mobile terminal is the same as the prestored Cookie information carried in the service request message sent by the mobile terminal.
Preferably, the determining that the Cookie information carried in the service request message sent by the mobile terminal is different from the pre-stored Cookie information when the mobile terminal requests for the first service includes:
determining that the number of the mobile terminal, the value of Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal are different from the value of the Cookie information carried in the service request message sent by the mobile terminal, wherein the value of the Domain, path and name values in the Cookie information is corresponding to the prestored Cookie information when the mobile terminal requests for the first service; and/or when the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal are different from the prestored Cookie information carried in the service request message sent by the mobile terminal in the information corresponding to the Cookie information when the mobile terminal requests for the first time of service, the Cookie information carried in the service request message sent by the mobile terminal is different from the prestored Cookie information when the mobile terminal accesses for the first time of service.
Preferably, the replacing the Cookie information carried in the mobile terminal service request message with the pre-stored Cookie information when the mobile terminal requests for the first service includes:
replacing a value in Cookie information carried in a service request message sent by the mobile terminal with a value corresponding to the mobile terminal number, the Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first service; and/or the presence of a gas in the gas,
and replacing the Cookie information carried in the service request message sent by the mobile terminal with the corresponding information of the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first service.
Preferably, the method further comprises:
when determining that the service request message sent by the mobile terminal does not carry Cookie information, forwarding the service request message sent by the mobile terminal to the SP;
and when a response message aiming at the service request message and sent by the SP is received, analyzing and storing the Cookie information in the response message, and sending the Cookie information to the mobile terminal.
Preferably, after forwarding the service request message sent by the mobile terminal to the SP, the method further includes:
and storing the mobile terminal identification information, the mobile terminal type information, the Domain information and the Path information in the mobile terminal service request message.
A Cookie error correction device comprises a storage module, a determination module, a replacement module and a sending module; wherein,
the storage module is used for storing Cookie information when the mobile terminal requests for the first service;
the determining module is used for determining whether the Cookie information carried in the service request message sent by the mobile terminal is the same as the Cookie information which is stored in the storage module in advance when the mobile terminal requests for the first service, and if so, the sending module is triggered and the replacing module is not triggered simultaneously;
the replacing module is used for replacing the Cookie information carried in the mobile terminal service request message with the prestored Cookie information when the mobile terminal requests for the first service and triggering the sending module;
the sending module is used for sending the Cookie information carried in the mobile terminal service request message to a Service Provider (SP); or sending the pre-stored Cookie information when the mobile terminal requests for the first service to the SP.
Preferably, the determining module is further configured to determine that the number of the mobile terminal, the value of Domain, path, and name in the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal makes a first service request are the same as the value of the Cookie information carried in the service request message sent by the mobile terminal, and the value of Domain and path in the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal makes a first service request are the same as the value of the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal makes a first service request, and the value of Domain and path in the service request message sent by the mobile terminal are the same as the value of the Cookie information carried in the service request message sent by the mobile terminal, and the Cookie information carried in the service request message sent by the mobile terminal is the same as the pre-stored Cookie information when the mobile terminal makes a first service request;
determining that the number of the mobile terminal, the value of Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal are different from the value of the Cookie information carried in the service request message sent by the mobile terminal, wherein the value of the Domain, path and name values in the Cookie information is corresponding to the prestored Cookie information when the mobile terminal requests for the first service; and/or when the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal are different from the prestored Cookie information carried in the service request message sent by the mobile terminal in the information corresponding to the Cookie information when the mobile terminal requests for the first time of service, the Cookie information carried in the service request message sent by the mobile terminal is different from the prestored Cookie information when the mobile terminal accesses for the first time of service.
Preferably, the replacing module is further configured to replace a value in Cookie information carried in a service request message sent by the mobile terminal with a value corresponding to the mobile terminal number, the Domain, path, and name values in the Cookie information carried in the service request message sent by the mobile terminal, in the Cookie information when the mobile terminal requests for the first service stored in advance; and/or the presence of a gas in the gas,
and the mobile terminal is further configured to replace the Cookie information carried in the service request message sent by the mobile terminal with the corresponding information of the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal requests for the first service.
Preferably, the apparatus further comprises a receiving unit and a parsing unit, wherein:
a receiving unit, configured to receive a response message sent by the SP for the service request message;
the analysis unit is used for analyzing the Cookie information in the response message;
the sending module is further configured to forward a service request message sent by the mobile terminal to the SP; and sending the Cookie information in the response message aiming at the service request message sent by the SP to the mobile terminal.
Preferably, the storage module is further configured to store the mobile terminal identification information, the mobile terminal type information, the Domain information, and the Path information in the mobile terminal service request message.
The method and the device for correcting the Cookie error increase the processing flow of the Cookie error correction on the basis of the Cookie processing flow specified by the original WAP gateway equipment, provide a friendly interface for an operator to set and manage, can access any SP by any mobile terminal to carry out the Cookie error correction, can meet the practical requirements of users in time and improve the satisfaction degree of the users.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings.
Fig. 1 is a schematic flow chart of an implementation process of a Cookie error correction method of the present invention, as shown in fig. 1, the method includes:
step 101: determining that Cookie information carried in a service request message sent by a mobile terminal is the same as the prestored Cookie information when the mobile terminal requests for the first service, and sending the Cookie information carried in the service request message of the mobile terminal to a Service Provider (SP);
step 102: and when the Cookie information carried in the service request message sent by the mobile terminal is determined to be different from the Cookie information which is stored in advance when the mobile terminal requests the first service, replacing the Cookie information carried in the service request message of the mobile terminal with the Cookie information which is stored in advance when the mobile terminal requests the first service, and sending the Cookie information to a Service Provider (SP).
In the present invention, the determining that the Cookie information carried in the service request message sent by the mobile terminal is the same as the pre-stored Cookie information when the mobile terminal requests for the first service includes:
determining that the number of the mobile terminal, the value of the Domain, the path and the name in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first time service are the same as the value of the Cookie information carried in the service request message sent by the mobile terminal, and when the Domain and the path in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first time service are the same as the Cookie information carried in the service request message sent by the mobile terminal, the Cookie information carried in the service request message sent by the mobile terminal is the same as the prestored Cookie information carried in the service request message sent by the mobile terminal.
The determining that the Cookie information carried in the service request message sent by the mobile terminal is different from the prestored Cookie information when the mobile terminal requests for the first service comprises:
determining that the number of the mobile terminal, the value of Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal are different from the value of the Cookie information carried in the service request message sent by the mobile terminal, wherein the value of the Domain, path and name values in the Cookie information is corresponding to the prestored Cookie information when the mobile terminal requests for the first service; and/or when the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal are different from the prestored Cookie information carried in the service request message sent by the mobile terminal in the information corresponding to the Cookie information when the mobile terminal requests for the first time of service, the Cookie information carried in the service request message sent by the mobile terminal is different from the prestored Cookie information when the mobile terminal accesses for the first time of service.
The replacing the Cookie information carried in the mobile terminal service request message with the prestored Cookie information when the mobile terminal requests for the first service comprises:
replacing a value in Cookie information carried in a service request message sent by the mobile terminal with a value corresponding to the mobile terminal number, the Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first service; and/or the presence of a gas in the gas,
and replacing the Cookie information carried in the service request message sent by the mobile terminal with the corresponding information of the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first service.
When the service request message sent by the mobile terminal does not carry Cookie information, an operator server may determine that the mobile terminal accesses the SP through the operator server for the first time, and fig. 2 is a schematic diagram of an implementation flow when the mobile terminal accesses the service in the SP for the first time, where as shown in fig. 2, a processing flow when the mobile terminal accesses the service in the SP for the first time includes the following steps:
step 201: the mobile terminal sends a service request message to an operator server;
step 202: the operator server forwards a service request message sent by the mobile terminal to the SP;
step 203: the operator server stores the mobile terminal identification information, the mobile terminal type information, the Domain information and the Path information in the mobile terminal service request message;
step 204: and when the operator server receives a response message aiming at the service request message sent by the SP, analyzing and storing the Cookie information in the response message, and sending the Cookie information to the mobile terminal.
Here, the Cookie information is mainly Cookie information carried in Set-Cookie header information, and mainly includes: name, value, Domain, path, etc.;
the steps 201 to 204 are implementation procedures when the mobile terminal accesses the SP for the first time, and after the mobile terminal accesses the SP for the first time and the SP returns response information, the mobile terminal identification information, the mobile terminal type information, the Domain information, the Path information and the like are stored, and the Cookie information carried in the response information returned by the SP lays a foundation for subsequent Cookie error correction.
Compared with the prior Cookie processing flow, the method increases the Cookie error correction processing flow on the Cookie processing flow specified by the prior WAP gateway equipment, provides a way for analyzing and correcting the Cookie on the operator equipment for the mobile terminal supporting the Cookie, and ensures that an operator administrator can shorten the time for processing the mobile phone Cookie information carrying errors, improves the efficiency of the operator and further improves the satisfaction degree of users.
The essence of the technical solution of the present invention is further clarified by specific examples below.
Fig. 3 is a schematic flow chart of a process for implementing Cookie error correction on a mobile terminal by using the method of the present invention when the mobile terminal accesses the SP again, and as shown in fig. 3, the specific steps are as follows:
step 301: the operator server sets mobile terminal information and a trust SP, and stores the mobile terminal information and the trust SP;
here, the operator server can set the mobile terminal information and trust the SP through the operation maintenance and design interface module, so that the operation business provides a Cookie error correction process only for a user who accesses the specific SP by the specific mobile terminal;
step 302: the method comprises the steps that a mobile terminal sends a service request message to an operator server to request the mobile terminal to access a specific service in an SP;
step 303: the operator server judges whether the mobile terminal and the SP are contained in the mobile terminal information and the trust SP, if yes, step 304 is executed; otherwise, go to step 307;
step 304: the operator server corrects the Cookie information carried in the service request message sent by the mobile terminal, namely, the operator server judges whether the Cookie information carried in the service request message sent by the mobile terminal is the same as the Cookie information which is stored in advance when the mobile terminal requests for the first service, if so, the step 305 is executed; otherwise, go to step 306;
step 305: the operator server sends Cookie information carried in the mobile terminal service request message to the SP;
step 306: the operator server replaces Cookie information carried in the service request message sent by the mobile terminal with prestored Cookie information when the mobile terminal requests for the first service, and sends the replaced Cookie information to the SP;
step 307: and the operator server sends the Cookie information carried in the service request message sent by the mobile terminal to the SP.
In the invention, the error correction of the Cookie information carried in the request message of the mobile terminal requesting the SP again by the operator server comprises the following steps:
the operator server judges whether the Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal are the same as the prestored corresponding values in the Cookie information when the mobile terminal requests for the first service, if so, the step a is executed, otherwise, the step d is executed;
step a: if yes, executing step c; otherwise, executing step e;
step c: the operator server sends Cookie information carried in the service request message sent by the mobile terminal to the SP;
step d: the operator server replaces the value in the Cookie information carried in the service request message sent by the mobile terminal with the value corresponding to the mobile terminal number, the Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal in the Cookie information when the mobile terminal requests for the first service stored in advance; then executing the step a;
step e: and the operator server replaces the Cookie information carried in the service request message sent by the mobile terminal with the corresponding information of Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal in the prestored Cookie information when the mobile terminal requests for the first service, and then sends the Cookie information carried in the service request message sent by the mobile terminal to the SP.
Step 308: after the mobile terminal finishes the one-time access of the SP, sending offline request information to the operator server;
step 309: the operator server judges whether the Cookie information stored in advance when the mobile terminal requests for the first service contains an Expire parameter, if so, the step 310 is executed; otherwise, go to step 311;
step 310: the operator server stores the Cookie information when the mobile terminal requests for the first service and ends the current process;
step 311: and the operator server deletes the Cookie information which is prestored when the mobile terminal requests for the first service, and finishes the current flow.
The invention also discloses a Cookie error correction device, which comprises a storage module, a determination module, a replacement module and a sending module; wherein,
the storage module is used for storing Cookie information when the mobile terminal requests for the first service;
the determining module is used for determining whether the Cookie information carried in the service request message sent by the mobile terminal is the same as the Cookie information which is stored in the storage module in advance when the mobile terminal requests for the first service, and if so, the sending module is triggered and the replacing module is not triggered simultaneously;
the replacing module is used for replacing the Cookie information carried in the mobile terminal service request message with the prestored Cookie information when the mobile terminal requests for the first service and triggering the sending module;
the sending module is used for sending the Cookie information carried in the mobile terminal service request message to a Service Provider (SP); or sending the pre-stored Cookie information when the mobile terminal requests for the first service to the SP.
The determining module is further configured to determine that the number of the mobile terminal, the value of Domain, path, and name in the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal makes a first service request are the same as the value of the Cookie information carried in the service request message sent by the mobile terminal, and that the Domain and the path in the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal makes a first service request are the same as the Cookie information carried in the service request message sent by the mobile terminal, and that the Cookie information carried in the service request message sent by the mobile terminal is the same as the pre-stored Cookie information when the mobile terminal makes a first service request;
determining that the number of the mobile terminal, the value of Domain, path and name values in the Cookie information carried in the service request message sent by the mobile terminal are different from the value of the Cookie information carried in the service request message sent by the mobile terminal, wherein the value of the Domain, path and name values in the Cookie information is corresponding to the prestored Cookie information when the mobile terminal requests for the first service; and/or when the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal are different from the prestored Cookie information carried in the service request message sent by the mobile terminal in the information corresponding to the Cookie information when the mobile terminal requests for the first time of service, the Cookie information carried in the service request message sent by the mobile terminal is different from the prestored Cookie information when the mobile terminal accesses for the first time of service.
The replacing module is further configured to replace a value in Cookie information carried in a service request message sent by the mobile terminal with a value corresponding to the mobile terminal number, the Domain, path, and name values in the Cookie information carried in the service request message sent by the mobile terminal, in the Cookie information stored in advance when the mobile terminal requests for the first service; and/or the presence of a gas in the gas,
and the mobile terminal is further configured to replace the Cookie information carried in the service request message sent by the mobile terminal with the corresponding information of the Domain and path values in the Cookie information carried in the service request message sent by the mobile terminal in the pre-stored Cookie information when the mobile terminal requests for the first service.
The device further comprises a receiving unit and an analyzing unit, wherein:
a receiving unit, configured to receive a response message sent by the SP for the service request message;
the analysis unit is used for analyzing the Cookie information in the response message;
the sending module is further configured to forward a service request message sent by the mobile terminal to the SP; and sending the Cookie information in the response message aiming at the service request message sent by the SP to the mobile terminal.
The invention can also provide an operation maintenance and design interface module for the operator, which is convenient for the operator to set the mobile terminal information and trust SP so as to provide the Cookie error correction process for the user of the specific mobile terminal accessing the specific SP.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.