CN106302791A - The transmission method of browser Cookie and system - Google Patents

The transmission method of browser Cookie and system Download PDF

Info

Publication number
CN106302791A
CN106302791A CN201610770090.1A CN201610770090A CN106302791A CN 106302791 A CN106302791 A CN 106302791A CN 201610770090 A CN201610770090 A CN 201610770090A CN 106302791 A CN106302791 A CN 106302791A
Authority
CN
China
Prior art keywords
request
cookie
service end
browser
blob object
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.)
Granted
Application number
CN201610770090.1A
Other languages
Chinese (zh)
Other versions
CN106302791B (en
Inventor
刘德建
陈丛亮
郭玉湖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian TQ Digital Co Ltd
Original Assignee
Fujian TQ Digital 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 Fujian TQ Digital Co Ltd filed Critical Fujian TQ Digital Co Ltd
Priority to CN201610770090.1A priority Critical patent/CN106302791B/en
Publication of CN106302791A publication Critical patent/CN106302791A/en
Application granted granted Critical
Publication of CN106302791B publication Critical patent/CN106302791B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a kind of method and system compressed and send browser Cookie, including: obtain the Cookie content in request, be compressed sending, be converted into Blob object;In the variable that backup Cookie defines to browser Javascript, empty the Cookie of current domain name;Javascript initiates request, is placed in request body by Blob object, and is sent to agency service end;After agency service termination receives request, it is judged that in request header, whether cookie information is empty;If cookie information is empty, then obtain the Blob object in request body;It is Cookie by Blob object decompression, and the Cookie content after decompression is reverted to the correspondence position of request header;Request after reduction is forwarded to service end by agency service end.The bandwidth occupancy of service end can be reduced to greatest extent.

Description

The transmission method of browser Cookie and system
Technical field
The present invention relates to browser technology field, especially relate to transmission method and the system of a kind of browser Cookie.
Background technology
Cookie, the most also by its plural form Cookies, i.e. browser rs cache, refers to that some website is in order to distinguish user Identity, carry out session tracking and the data (generally going through encryption) that are stored on user local terminal.Cookie is by servicing Device end generates, and is sent to User-Agent (usually browser), and the key/value of Cookie can be saved in certain by browser In text under catalogue, (premise is that browser is arranged to server to ask just to send this Cookie during same website next time For enabling Cookie).Cookie name claims and is worth can be by oneself definition of server end exploitation, can also be direct for JSP Write jsessionid, such server it is known that whether this user is validated user and the need of login again etc., Server can arrange or read and comprise information in Cookies, safeguards that user is with the state in server session whereby.
The arbitrariness that server can utilize Cookies to comprise information screens and regular safeguards these information, to sentence Break HTTP transmit in state.The most typical application of Cookies is to judge whether registration user has logged on website, Yong Huke Can be able to be pointed out, if upper once enter this website time retain user profile to simplify and logging in formality, these are all The function of Cookies.Another important application occasion is that " shopping cart " etc processes.User may be same within a period of time Selecting different commodity in the different pages of one home Web site, these information all can write Cookies, in order to carries when complete payment Win the confidence breath.
Browser uses Cookie transmission state in a large number at present, is to use character string transmission, wastes upstream service greatly Device bandwidth resources, affect the speed submitting request in slow network to;On the other hand, if using the form transmission of compression Cookie, is also a urgent problem to receiving compressed package and decompressing.
Summary of the invention
The technical problem to be solved is: provides the transmission plan of a kind of browser Cookie, decreases service Device bandwidth shared by Cookie transmits, improves the speed submitting request in slow network to.
In order to solve above-mentioned technical problem, the technical solution used in the present invention is: provide the biography of a kind of browser Cookie Transmission method, including:
Obtain the Cookie content in browser, and be compressed, be converted into Blob object and be ready for sending;
Back up in the variable that above-mentioned Cookie defines to browser Javascript, and empty the Cookie of current domain name;
Javascript initiates request, is placed in request body by described Blob object, and is sent to agency service end;
By Javascript, the Cookie being saved in variable is reverted in current domain name.
After agency service termination receives request, it is judged that in the request header of described request, whether cookie information is empty;
If described cookie information is empty, then obtain the Blob object in request body;
It is Cookie by described Blob object decompression, and the Cookie content after decompression is reverted to the right of described request header Answer position;
The request reducing described Cookie content is forwarded to service end by agency service end.
For solving the problems referred to above, the present invention also provides for the transmission system of a kind of browser Cookie, including:
Compression sends modular converter, for obtaining the Cookie content in request, and is compressed, is converted into Blob object It is ready for sending;
Backup empties module, for backing up in the variable that above-mentioned Cookie defines to browser Javascript, and empties The Cookie of current domain name;
Place sending module, initiate request for Javascript, described Blob object is placed in request body, concurrently Deliver to service end;
Reduction backup module, for reverting to current domain name by Javascript by the Cookie being saved in variable In.
Judge module, after agency service termination receives request, it is judged that cookie information in the request header of described request Whether it is empty;
Acquisition module, if being empty for described cookie information, then obtains the Blob object in request body;
Decompression assembles module, is Cookie for being decompressed by described Blob object, and by the Cookie content after decompression also The former correspondence position to described request header;
Forwarding module, is forwarded to service end for agency service end by the request reducing described Cookie content.
The beneficial effects of the present invention is: be different from prior art, the present invention by Cookie being compressed into Blob form, And after backup, empty current Cookie;When initiating request, Blob object is sent to agency service end, by introducing generation Reason service end, after the request decompression received, assembles with request header, with the request of reducing, then the request after reduction is sent extremely Former server, further avoid the waste of former server bandwidth resource;Further, since the present invention distinctive compression sender Formula, agency service termination only need to judge after receiving request that whether the cookie information in request header is that sky i.e. may know that receive please Seeking Truth is no compressed such that it is able to is rapidly selected correct mode and forwards.By the way, the present invention can be In the case of compatible existing browser, by Cookie boil down to binary format, decrease server due to Cookie and transmit institute The bandwidth taken, improves the speed submitting request in slow network to.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the transmission method of the browser Cookie of one embodiment of the invention;
Fig. 2 is the structural representation of the transmission system of the browser Cookie of one embodiment of the invention;
Fig. 3 is the structural representation of the transmission system of the browser Cookie of the embodiment of the present invention two.
1, compressing and converting module;2, backup empties module;3, sending module is placed;4, reduction backup module;5, mould is judged Block;6, acquisition module;7, decompression assembles module;8, forwarding module;9, processing module.
Detailed description of the invention
By describing the technology contents of the present invention in detail, being realized purpose and effect, below in conjunction with embodiment and coordinate attached Figure is explained.
The design of most critical of the present invention is: send after being compressed by Cookie to proxy server, proxy server After the compression request process decompression processing received, the Cookie content of compression is reverted in request header, and by reduction Request is forwarded to server.
Refer to Fig. 1, the present invention provides the transmission method of a kind of browser Cookie, including:
S1: obtain the Cookie content in request, and be compressed, be converted into Blob object and be ready for sending;
S2: back up in the variable that above-mentioned Cookie defines to browser Javascript, and empty current domain name Cookie;
S3:Javascript initiates request, is placed in request body by described Blob object, and is sent to service end;
S4: the Cookie being saved in variable is reverted in current domain name by Javascript;
After S5: agency service termination receives request, it is judged that in the request header of described request, whether cookie information is empty;
S6: if described cookie information is empty, then obtain the Blob object in request body;
S7: by described Blob object decompression for Cookie, and the Cookie content after decompression is reverted to described request header Correspondence position;
The request reducing described Cookie content is forwarded to service end by S8: agency service end.
It should be appreciated that Cookie is in a browser before initiating request, it is usually the literary composition under certain file directory In presents.Storing according to domain name, the cookie of this domain name of such as www.baidu.com exists for In the file of www.baidu.com.txt.
Further, in the described request header judging described request, whether cookie information is empty, farther includes afterwards:
If described cookie information is not empty, the request received is forwarded directly to service end by agency service end.
Knowable to foregoing description, in request header, cookie information is empty, illustrates that this request have employed Cookie compress mode, Need Cookie compressed content is decompressed;In request header, cookie information is not empty, then illustrate that this request is not carried out Cookie compresses, and directly forwards.
Further, after service end receives the request forwarded by agency service end, described request is processed.
Knowable to foregoing description, what request was finally responded by the present invention is former server, the effect of proxy server It is request to be decompressed and forwards.
Further, described Blob object is binary data.
When Javascript initiates request, described Blob object is placed in request body, and by described request body and Request header is sent to service end in the lump.The most now be sent to service end be request header with compression after request body.
Accordingly, please join Fig. 2, the present invention provides the transmission system of a kind of browser Cookie, including:
Compression sends modulus of conversion 1, for obtaining the Cookie content in request, and is compressed, is converted into Blob object It is ready for sending;
Backup empties module 2, for backing up in the variable that above-mentioned Cookie defines to browser Javascript, and empties The Cookie of current domain name;
Place sending module 3, initiate request for Javascript, described Blob object is placed in request body, and It is sent to service end;
Reduction backup module 4, for reverting to current domain name by Javascript by the Cookie being saved in variable In.
Judge module 5, after agency service termination receives request, it is judged that cookie information in the request header of described request Whether it is empty;
Acquisition module 6, if being empty for described cookie information, then obtains the Blob object in request body;
Decompression assembles module 7, is Cookie for being decompressed by described Blob object, and by the Cookie content after decompression also The former correspondence position to described request header;
Forwarding module 8, is forwarded to service end for agency service end by the request reducing described Cookie content.
Further, if described cookie information is not empty, described forwarding module will receive for agency service end Request is forwarded directly to service end.
Knowable to foregoing description, in request header, cookie information is empty, illustrates that this request have employed Cookie compress mode, After needing acquisition module and decompression assembling module that Cookie compressed content is decompressed, after forwarding module forwards decompression to assemble again Request;In request header, cookie information is not empty, then illustrate that this request does not carry out Cookie compression, and forwarding module directly turns Send out.
Further, also include processing module 9, after service end receives the request forwarded by agency service end, right Described request processes.
Further, described Blob object is binary data.
Javascript initiate request, described Blob object is placed in request body, and by described request body and please Ask first and be sent to service end.
For convenience of understanding, illustrate below by way of a specific embodiment one.
Such as: the step of the function of similar Web version QQ is as follows:
1., during register, user's QQ account information is stored in the cookie of current domain name in the way of encryption;
2. obtain the QQ account information after the Cookie content in browser is i.e. encrypted, and carry out gzip compression, be converted into Blob object is ready for sending;
3: back up in the variable that the QQ account information after above-mentioned Cookie i.e. encrypts defines to browser Javascript, and Empty the Cookie of current domain name;So just obtained less than QQ account information by original mode sending request before reduction ?;
4:Javascript initiates request, is placed in request body by described Blob object, and will prevent this Blob pair The request body of elephant and request header are sent to agency service end in the lump;Wherein http request substantially form is as follows:
POST http://www.qq.com/xxx HTTP/1.1
Content-Length:58
Host:www.qq.com
Account information after Cookie:UserInfo=encryption
Request body is after the present invention improves, and its form is as follows:
POST http://www.qq.com/xxx HTTP/1.1
Content-Length:58
Host:www.qq.com
That is: request body+Blob object form.
5: the QQ account information after i.e. being encrypted by the Cookie being saved in variable by Javascript is reverted to currently In domain name;
If lacking above-mentioned steps 5, the QQ account information existing in Cookie can be caused to lose, then, carrying out other please When asking, just obtain less than QQ account information, it is impossible to which user identification is, is equivalent to be rejected login.
6: after agency service termination receives request, it is judged that in the request header of described request, whether cookie information is empty;
7: if described cookie information is empty, then obtain the Blob object in request body in the request received;If institute State cookie information not for empty, then directly the request received is forwarded to service end;
8: by described Blob object decompression for Cookie, and the Cookie content after decompression is reverted to described request header Correspondence position;
9: the request of request body+Cookie decompression content-form is forwarded to service end by agency service end;
10: the request received is processed by service end.
Refer to Fig. 3, embodiments of the invention two are:
The transmission system of a kind of browser Cookie, it is characterised in that including:
Compressing and converting module 1, for obtaining the Cookie content in request, and carries out gzip compression, is converted into Blob pair As;Described Blob object is binary data;
Backup empties module 2, for backing up in the variable that above-mentioned Cookie defines to browser Javascript, and empties The Cookie of current domain name;
Place sending module 3, initiate request for Javascript, described Blob object is placed in request body, and Described request body and request header are sent to agency service end in the lump;
Reduction backup module 4, for reverting to current domain name by Javascript by the Cookie being saved in variable In.
Judge module 5, after agency service termination receives request, it is judged that cookie information in the request header of described request Whether it is empty;
Acquisition module 6, if being empty for described cookie information, then obtains the Blob object in request body;
Decompression assembles module 7, is Cookie for being decompressed by described Blob object, and by the Cookie content after decompression also The former correspondence position to described request header;
Forwarding module 8, is forwarded to service end for agency service end by the request reducing described Cookie content;If institute Stating cookie information not for empty, the request received is forwarded directly to service end for agency service end by described forwarding module.
Processing module 9, after service end receives the request forwarded by agency service end, at described request Reason.
In sum, the browser Cookie transmission method of the present invention and system, client is first carried out when sending request Cookie compresses, and decreases server bandwidth shared by Cookie transmission, improves the speed submitting request in slow network to Degree;And introducing proxy server, the request after compression is sent to agency service end by client, then by proxy server decompression also It is forwarded to former server after former, further reduces taking of former server bandwidth resource, it can be ensured that in the case of slow network Submit the speed of request to.
The foregoing is only embodiments of the invention, not thereby limit the scope of the claims of the present invention, every utilize this The equivalents that bright description and accompanying drawing content are made, or directly or indirectly it is used in relevant technical field, the most in like manner include In the scope of patent protection of the present invention.

Claims (10)

1. the transmission method of a browser Cookie, it is characterised in that including:
Obtain the Cookie content in request, and be compressed, be converted into Blob object;
Back up in the variable that above-mentioned Cookie defines to browser Javascript, and empty the Cookie of current domain name;
Javascript initiates request, is placed in request body by described Blob object, and is sent to agency service end;
By Javascript, the Cookie being saved in variable is reverted in current domain name;
After agency service termination receives request, it is judged that in the request header of described request, whether cookie information is empty;
If described cookie information is empty, then obtain the Blob object in request body;
It is Cookie by described Blob object decompression, and the Cookie content after decompression is reverted to the corresponding position of described request header Put;
The request reducing described Cookie content is forwarded to service end by agency service end.
The transmission method of browser Cookie the most according to claim 1, it is characterised in that the described request of described judgement In request header, whether cookie information is empty, farther includes afterwards:
If described cookie information is not empty, the request received is forwarded directly to service end by agency service end.
The transmission method of browser Cookie the most according to claim 2, it is characterised in that service end receives by acting on behalf of After the request that service end forwards, described request is processed.
The transmission method of browser Cookie the most according to claim 1, it is characterised in that wherein said Blob object is Binary data.
The transmission method of browser Cookie the most according to claim 1, it is characterised in that Javascript initiates please Ask, described Blob object is placed in request body, and described request body and request header are sent to service end in the lump.
6. the transmission system of a browser Cookie, it is characterised in that including:
Compressing and converting module, for obtaining the Cookie content in request, and is compressed, is converted into Blob object;
Backup empties module, for backing up in the variable that above-mentioned Cookie defines to browser Javascript, and empties current The Cookie of domain name;
Place sending module, initiate request for Javascript, described Blob object is placed in request body, and is sent to Agency service end;
Reduction backup module, for reverting to the Cookie being saved in variable in current domain name by Javascript;
Judge module, after agency service termination receives request, it is judged that in the request header of described request, whether cookie information For sky;
Acquisition module, if being empty for described cookie information, then obtains the Blob object in request body;
Decompression assembles module, is Cookie for being decompressed by described Blob object, and the Cookie content after decompression is reverted to The correspondence position of described request header;
Forwarding module, is forwarded to service end for agency service end by the request reducing described Cookie content.
The transmission system of browser Cookie the most according to claim 6, it is characterised in that if described cookie information is not For sky, the request received is forwarded directly to service end for agency service end by described forwarding module.
The transmission system of browser Cookie the most according to claim 7, it is characterised in that also include processing module, uses After service end receives the request forwarded by agency service end, described request is processed.
The transmission system of browser Cookie the most according to claim 6, it is characterised in that wherein said Blob object is Binary data.
The transmission system of browser Cookie the most according to claim 6, it is characterised in that Javascript initiates please Ask, described Blob object is placed in request body, and described request body and request header are sent to service end in the lump.
CN201610770090.1A 2016-08-30 2016-08-30 The transmission method and system of browser Cookie Active CN106302791B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610770090.1A CN106302791B (en) 2016-08-30 2016-08-30 The transmission method and system of browser Cookie

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610770090.1A CN106302791B (en) 2016-08-30 2016-08-30 The transmission method and system of browser Cookie

Publications (2)

Publication Number Publication Date
CN106302791A true CN106302791A (en) 2017-01-04
CN106302791B CN106302791B (en) 2019-08-13

Family

ID=57675781

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610770090.1A Active CN106302791B (en) 2016-08-30 2016-08-30 The transmission method and system of browser Cookie

Country Status (1)

Country Link
CN (1) CN106302791B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624918A (en) * 2012-03-30 2012-08-01 北京英富森信息技术有限公司 Proxy access method based on URL (Uniform Resource Locator) rewriting technique
CN102638581A (en) * 2012-03-31 2012-08-15 奇智软件(北京)有限公司 Cookie information storage method and cookie information storage system
CN105100084A (en) * 2015-07-07 2015-11-25 中国科学院计算技术研究所 Method and system for preventing cross-site request forgery attack

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624918A (en) * 2012-03-30 2012-08-01 北京英富森信息技术有限公司 Proxy access method based on URL (Uniform Resource Locator) rewriting technique
CN102638581A (en) * 2012-03-31 2012-08-15 奇智软件(北京)有限公司 Cookie information storage method and cookie information storage system
CN105100084A (en) * 2015-07-07 2015-11-25 中国科学院计算技术研究所 Method and system for preventing cross-site request forgery attack

Also Published As

Publication number Publication date
CN106302791B (en) 2019-08-13

Similar Documents

Publication Publication Date Title
CN102655481B (en) A kind of instant messaging chat content inspection method based on webpage and system
CN108476165B (en) Information interaction method, client and device
CN101662464A (en) System for realizing HTTP request service and method thereof
CN108616606B (en) Internet of things communication method and device
CN103905497A (en) Method, device and application platform for realizing login of third-party application service website
CN103001860A (en) Achieving system for converged communication Web instant messages
CN101674318A (en) Method for pushing data to mobile equipment at regular time
CN102130844B (en) Method and system for acquiring Web chat logs
CN110769009B (en) User identity authentication method and system
CN104135536A (en) Data interaction method of Web management system based on Json data protocols
CN103297453A (en) Method, browser end and system for achieving instant communication
CN102143177A (en) Portal authentication method, Portal authentication device,Portal authentication equipment and Portal authentication system
WO2013189394A2 (en) Resource information acquisition method, system and device for internet of things terminal device
CN102752320B (en) Proxy server active compression method and proxy server
CN103888348A (en) E-mail application system and method and device for transferring E-mails
CN103220343B (en) Big data multi-system retransmission method
US20090129378A1 (en) Surreptitious web server bias towards desired browsers
CN102075592A (en) Method for screening DNS (Domain Name System) request
CN103873443A (en) Information processing method, local proxy server and network proxy server
CN105306577A (en) Data sharing system and method between handheld devices based on APP
CN111427703A (en) Industrial data real-time display method and system
CN103533001A (en) Communication method and communication system based on HTTP multi-proxy, and intermediate proxy server
CN106302791B (en) The transmission method and system of browser Cookie
CN110324302B (en) IOT equipment communication method
CN103888433A (en) Method and system for communication between browser client and IM client

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant