CN106302792B - Compression sends the method and system of browser Cookie - Google Patents

Compression sends the method and system of browser Cookie Download PDF

Info

Publication number
CN106302792B
CN106302792B CN201610770243.2A CN201610770243A CN106302792B CN 106302792 B CN106302792 B CN 106302792B CN 201610770243 A CN201610770243 A CN 201610770243A CN 106302792 B CN106302792 B CN 106302792B
Authority
CN
China
Prior art keywords
request
cookie
javascript
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.)
Active
Application number
CN201610770243.2A
Other languages
Chinese (zh)
Other versions
CN106302792A (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 CN201610770243.2A priority Critical patent/CN106302792B/en
Publication of CN106302792A publication Critical patent/CN106302792A/en
Application granted granted Critical
Publication of CN106302792B publication Critical patent/CN106302792B/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 the method and system that a kind of compression sends browser Cookie, comprising: the Cookie content in acquisition request, and carry out gzip compression and send, it is converted into Blob object;It backs up in the variable that above-mentioned Cookie is defined to browser Javascript, and empties the Cookie of current domain name;Javascript initiates request, the Blob object is placed in request body, and be sent to server-side;The Cookie being stored in variable is reverted in current domain name by Javascript.Server-side receives the request, and Blob object in request body is decompressed into Cookie, assembles with request header, to restore request.By the above-mentioned means, the present invention, by Cookie boil down to binary format, can reduce server since Cookie transmits occupied bandwidth, improve and submit the speed of request in slow network in the case where compatibility existing browser.

Description

Compression sends the method and system of browser Cookie
Technical field
The present invention relates to browser technology fields, send the method for browser Cookie more particularly, to a kind of compression and are System.
Background technique
Cookie also refers to certain websites with its plural form Cookies, i.e. browser rs cache sometimes in order to distinguish user Identity, the data (generally going through encryption) for carrying out session tracking and being stored on user local terminal.Cookie is by servicing Device end generates, and is sent to User-Agent (usually browser), the key/value of Cookie can be saved in some by browser In text file under catalogue, request next time just to send the Cookie when same website to server (on condition that browser is arranged To enable Cookie).Cookie name claims and is worth can be developed oneself definition by server end, can also be direct for JSP Jsessionid is written, such server is known that whether the user is legitimate user and whether needs to log in again, Server can be set or read comprising information in Cookies, safeguard user with the state in server session whereby.
It includes the arbitrariness of information to screen and regular these information of maintenance that server, which can use Cookies, to sentence The state broken in HTTP transmission.The most typical application of Cookies is to determine whether registration user has logged on website, Yong Huke It can be prompted, if retain user information when entering this website next time to simplify and log in formality, these are all The function of Cookies.Another important application occasion is " shopping cart " etc processing.User may be whithin a period of time same Different commodity are selected in the different pages of one home Web site, Cookies can be all written in these information, to mention in complete payment It wins the confidence breath.
Browser largely uses Cookie transmission state at present, is to be transmitted using character string, greatly wastes upstream service Device bandwidth resources influence to submit the speed of request in slow network.
Summary of the invention
The technical problems to be solved by the present invention are: providing the scheme of compression transmission Cookie a kind of, reduce server Since Cookie transmits occupied bandwidth, improves and submit the speed of request in slow network.
In order to solve the above-mentioned technical problem, the technical solution adopted by the present invention are as follows: a kind of compression transmission browser is provided The method of Cookie, comprising:
The Cookie content in browser is obtained, and carries out gzip compression, Blob object is converted into and is ready for sending;
It backs up in the variable that above-mentioned Cookie is defined to browser Javascript, and empties the Cookie of current domain name;
Javascript initiates request, the Blob object is placed in request body, and be sent to server-side;
The Cookie being stored in variable is reverted in current domain name by Javascript.
Server-side receives the request, and Blob object in request body is decompressed into Cookie, assembles with request header, with Reduction request.
To solve the above problems, the present invention also provides a kind of systems that compression sends browser Cookie, comprising:
Compression sends conversion module, for the Cookie content in acquisition request, and carries out gzip compression, is converted into Blob Object is ready for sending;
Backup empties module, for backing up in the variable that above-mentioned Cookie is defined to browser Javascript, and empties The Cookie of current domain name;
Sending module is placed, request is initiated for Javascript, the Blob object is placed in request body, concurrently It is sent to server-side;
Backup module is restored, for the Cookie being stored in variable to be reverted to current domain name by Javascript In.
Decompression assembling module, receives the request for server-side, Blob object in request body is decompressed into Cookie is assembled with request header, to restore request.
The beneficial effects of the present invention are: be different from the prior art, the present invention by the way that cookie is compressed into blob format, And after backup, current cookie is emptied, when initiating request, server-side is sent by blob object, after decompression, with request Head assembling, to restore request.By the above-mentioned means, the present invention can press Cookie in the case where compatibility existing browser It is condensed to binary format, reduces server since Cookie transmits occupied bandwidth, improves to submit in slow network and request Speed.
Detailed description of the invention
Fig. 1 is the flow diagram of embodiment of the present invention method one.
Specific embodiment
To explain the technical content, the achieved purpose and the effect of the present invention in detail, below in conjunction with embodiment and cooperate attached Figure is explained.
The most critical design of the present invention is: Cookie is compressed into binary system, to be placed in request body, parsing When, by unziping in request header, reduction request.
Fig. 1 is please referred to, the embodiment of the present invention one provides a kind of method that compression sends browser Cookie, comprising:
S1: the Cookie content in acquisition request, and gzip compression is carried out, it is converted into Blob object and is ready for sending;
S2: backing up in the variable that above-mentioned Cookie is defined to browser Javascript, and empties current domain name Cookie;
S3:Javascript initiates request, the Blob object is placed in request body, and be sent to server-side;
S4: the Cookie being stored in variable is reverted in current domain name by Javascript;
S5: server-side receives the request, Blob object in request body is decompressed into Cookie, with request header group Dress, to restore request.
It should be understood that Cookie is the text usually under some file directory in a browser before initiating to request In this document.It is stored according to domain name, for example the cookie of www.baidu.com this domain name there is In the file of www.baidu.com.txt.
It is different from the prior art, for the present invention by the way that cookie is compressed into blob format, and after backup, diligent work is current Cookie sends server-side for blob object when initiating request, after decompression, assembles with request header, to restore request. By the above-mentioned means, the present invention, by Cookie boil down to binary format, can be reduced in the case where compatibility existing browser Server improves since Cookie transmits occupied bandwidth and submits the speed of request in slow network.
Wherein, the Blob object is binary data.
When Javascript initiates request, the Blob object is placed in request body, and is sent together with request header To server-side.Therefore being sent to server-side at this time is request header and compressed request body.
Accordingly, second embodiment of the present invention provides a kind of systems that compression sends browser Cookie, comprising:
Compression sends conversion module, for the Cookie content in acquisition request, and carries out gzip compression, is converted into Blob Object is ready for sending;
Backup empties module, for backing up in the variable that above-mentioned Cookie is defined to browser Javascript, and empties The Cookie of current domain name;
Sending module is placed, request is initiated for Javascript, the Blob object is placed in request body, concurrently It is sent to server-side;
Backup module is restored, for the Cookie being stored in variable to be reverted to current domain name by Javascript In.
Decompression assembling module, receives the request for server-side, Blob object in request body is decompressed into Cookie is assembled with request header, to restore request.
Wherein, the Blob object is binary data.
Javascript initiates request, and the Blob object is placed in request body, and is sent to together with request header Server-side.
For convenience of understanding, it is illustrated below by way of a specific embodiment.
Such as: the step of function of a similar Web editions QQ, is as follows:
1. when register, user's QQ account information is stored in the cookie of current domain name in a manner of encrypting;
2. obtaining Cookie content, that is, encrypted QQ account information in browser, and gzip compression is carried out, is converted into Blob object is ready for sending;
3: it backs up in the variable that the i.e. encrypted QQ account information of above-mentioned Cookie is defined to browser Javascript, and Empty the Cookie of current domain name;It is just obtained with original mode for sending request less than QQ account information in this way before reduction ?;
4:Javascript initiates request, the Blob object is placed in request body, and be sent to server-side;Wherein Http request substantially format is as follows:
POST http://www.qq.com/xxx HTTP/1.1
Content-Length:58
Host:www.qq.com
The encrypted account information of Cookie:UserInfo=
For request body after the present invention improves, format 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: being reverted to the i.e. encrypted QQ account information of the Cookie being stored in variable currently by Javascript In domain name;
If lacking above-mentioned steps 5, it will lead to there are the loss of the QQ account information in Cookie, then, carry out other and ask When asking, just obtains less than QQ account information, can not identify it is which user, be equivalent to and be rejected login.
6: server-side receives the request, and Blob object in request body is decompressed into Cookie, assembles with request header, To restore request.
The above description is only an embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalents made by bright specification and accompanying drawing content are applied directly or indirectly in relevant technical field, similarly include In scope of patent protection of the invention.

Claims (4)

1. a kind of method that compression sends browser Cookie characterized by comprising
Cookie content in acquisition request, and gzip compression is carried out, it is converted into Blob object;
It backs up in the variable that the unpressed Cookie content in the request of above-mentioned acquisition is defined to browser Javascript, and Empty the Cookie of current domain name;
Javascript initiates request, the Blob object is placed in request body, and be sent to service together with request header End;
The Cookie being stored in variable is reverted in current domain name by Javascript;
Server-side receives the request, and Blob object in request body is decompressed into Cookie, assembles with request header, with reduction Request.
2. the method that compression sends browser Cookie according to claim 1, which is characterized in that the wherein Blob object For binary data.
3. a kind of system that compression sends browser Cookie characterized by comprising
Compressing and converting module for the Cookie content in acquisition request, and carries out gzip compression, is converted into Blob object;
Backup empties module, the unpressed Cookie content in the request for backing up above-mentioned acquisition to browser In the variable that Javascript is defined, and empty the Cookie of current domain name;
Sending module is placed, request is initiated for Javascript, the Blob object is placed in request body, and and request It is first and be sent to server-side;
Backup module is restored, for reverting to the Cookie being stored in variable in current domain name by Javascript;
Decompression assembling module, receives the request for server-side, Blob object in request body is decompressed into Cookie, with Request header assembling, to restore request.
4. the system that compression sends browser Cookie according to claim 3, which is characterized in that the wherein Blob object For binary data.
CN201610770243.2A 2016-08-30 2016-08-30 Compression sends the method and system of browser Cookie Active CN106302792B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610770243.2A CN106302792B (en) 2016-08-30 2016-08-30 Compression sends the method and system of browser Cookie

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610770243.2A CN106302792B (en) 2016-08-30 2016-08-30 Compression sends the method and system of browser Cookie

Publications (2)

Publication Number Publication Date
CN106302792A CN106302792A (en) 2017-01-04
CN106302792B true CN106302792B (en) 2019-07-09

Family

ID=57675880

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610770243.2A Active CN106302792B (en) 2016-08-30 2016-08-30 Compression sends the method and system of browser Cookie

Country Status (1)

Country Link
CN (1) CN106302792B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102447714A (en) * 2010-10-07 2012-05-09 鸿富锦精密工业(深圳)有限公司 Cookie management method
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102447714A (en) * 2010-10-07 2012-05-09 鸿富锦精密工业(深圳)有限公司 Cookie management method
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

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于Web前端的性能优化方案研究";刘柳;《万方数据》;20160504;全文

Also Published As

Publication number Publication date
CN106302792A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN110300056B (en) Real-time response type API gateway and request processing method thereof
CN103905497B (en) Realize the method, apparatus and application platform of third-party application business website log
US20180212963A1 (en) Method and apparatus for accessing website
CN102655481B (en) A kind of instant messaging chat content inspection method based on webpage and system
EP3013015B1 (en) Packet compression method and apparatus
CN108718337B (en) Website account login, verification and verification information processing method, device and system
US9473592B2 (en) Methods for optimizing a web content proxy server and devices thereof
CN104378399A (en) Data push method, platform server, client terminal and system
CN110290055B (en) Method and system for communication between WeChat applet WebView and native component
CN104869136A (en) High-concurrency safe transmission method of Internet advertisement monitoring information
CN108124007A (en) The method and apparatus of message data real-time Transmission
CN106878460A (en) Communication processing method and device
CN106790334A (en) A kind of page data transmission method and system
EP3393104B1 (en) Requests and responses processing methods, terminal, server and computer-readable media
CN103873443B (en) Information processing method, local proxy server and network proxy server
CN102739680A (en) Session life prolonging device and method
US20160330298A1 (en) System, Terminal, Server, and Method for Data Transmission
CN106302792B (en) Compression sends the method and system of browser Cookie
CN102609864A (en) Method, device, server and system for releasing advertisements
CN106412893A (en) Rapid Portal authentication method, system, and WIFI device
CN106302791B (en) The transmission method and system of browser Cookie
US20140047014A1 (en) Network access system
CN104301285A (en) Method for logging in web system
JP2007035053A (en) Method for maintaining session between different-terminals
CN102255912B (en) Method, system and device for authenticating access of IMS (internet protocol multimedia subsystem) terminal to IMS network

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