[go: up one dir, main page]

CN102752320B - Proxy server active compression method and proxy server - Google Patents

Proxy server active compression method and proxy server Download PDF

Info

Publication number
CN102752320B
CN102752320B CN201210275177.3A CN201210275177A CN102752320B CN 102752320 B CN102752320 B CN 102752320B CN 201210275177 A CN201210275177 A CN 201210275177A CN 102752320 B CN102752320 B CN 102752320B
Authority
CN
China
Prior art keywords
data
response
head response
head
proxy server
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
CN201210275177.3A
Other languages
Chinese (zh)
Other versions
CN102752320A (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.)
Guangzhou Zhi Le Internet of things Technology Co., Ltd.
Original Assignee
BEIJING GLASS PERIOD COMMUNICATION 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 BEIJING GLASS PERIOD COMMUNICATION TECHNOLOGY Co Ltd filed Critical BEIJING GLASS PERIOD COMMUNICATION TECHNOLOGY Co Ltd
Priority to CN201210275177.3A priority Critical patent/CN102752320B/en
Publication of CN102752320A publication Critical patent/CN102752320A/en
Application granted granted Critical
Publication of CN102752320B publication Critical patent/CN102752320B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a proxy server active compression method. The method includes receiving data from a website, determining whether response headers are in receiving or not, if the response headers are in receiving, enabling received data to serve as the response headers to be temporarily stored, determining whether the receiving of the response headers is completed or not, if the receiving of the response headers is not completed, continuing receiving data from the website, if the receiving of the response headers is completed, determining whether the response headers comprise blocking transmission code instructions or not, if the response headers do not comprise blocking transmission coded instructions, compulsively subjecting the response headers to a blocking transmission coding operation, adding entity coding instructions in the response headers, storing the data in a compressed buffer memory and sending the data to a client, if the response headers comprise blocking transmission code instructions, storing the data in the compressed buffer memory and sending the data to the client, if the response headers are not in receiving, compressing the data of a local block response body, storing the data in the compressed buffer memory and sending the data to the client, determining whether the receiving of all response bodies is completed or not according to the length of all response bodies in the response headers or a blocking transmission coding operation mark, if the receiving of all response bodies is completed, closing the connection and finishing, and if the receiving of all response bodies is not completed, continuing receiving data from the website. A proxy server is further disclosed.

Description

A kind of proxy server active compression method and proxy server
Technical field
The present invention relates to data compression technique, refer to a kind of proxy server active compression method and proxy server especially.
Background technology
Under the environment of mobile Internet, the transmission delay between user terminal (as mobile phone, panel computer, 3G card of surfing Internet etc.) and backbone network is usually comparatively large, and larger network delay can cause user's networking speed slow, affects Consumer's Experience.
When cannot solve transmission delay in a short time, if transferring content can be carried out Lossless Compression, also will bring very large lifting to user's networking speed.
Browser (as IE, chrome, firefox etc.) is under HTTP (as http1.1 agreement), and for contents such as webpages, proxy server can ask common data compression (as gzip compression) usually; And if this compress mode is not supported in website, the problem that cannot respond compression request will be caused; And then cause the increase of user's transmitted data amount, waste bandwidth.
Summary of the invention
In view of this, the object of the invention is to propose a kind of proxy server active compression method and proxy server, improve network speed largely.
Based on above-mentioned purpose a kind of proxy server active compression method provided by the invention, comprising:
Data are received from website;
Judge whether to receive head response;
If receive head response, then by the data received responsively head keep in, and judge whether head response receives; If head response does not receive, then continue to receive data from website; If head response receives, then judge whether head response comprises block transmission coded command, if head response does not comprise block transmission coded command, head response is then forced to be set to block transmission encoding operation, and in head response, add entity coding instruction, and data are saved in compressed cache and mail to client; If head response comprises block transmission coded command, then data be saved in compressed cache and mail to client;
If not receive head response, then the data of this block response body are compressed, and data are saved in compressed cache and mail to client;
Judge all whether response body finishes receiving according to the whole response body length in head response or block transmission encoding operation mark, if so, then close and connect and terminate; If not, then continue to receive data from website.
In one embodiment, described subsequent processing steps also comprises:
Before closedown connects and terminates, refresh operation is carried out to compressed cache.
In another embodiment, the described step judging whether head response receives comprises:
Judge whether to receive 2 special identifier symbols, if so, then think that head response receives.
In another embodiment, described special identifier symbol for r n.
Present invention also offers a kind of proxy server, comprising:
Receiver module, for receiving data from website, and judges whether data are head response; If receive head response, then by the data received responsively head keep in, and judge whether head response receives; If head response does not receive, then described receiver module continues to receive data from website; If head response receives, then data are mail to head response processing module;
Head response processing module, for judging whether head response comprises block transmission coded command, if head response does not comprise block transmission coded command, then force head response to be set to block transmission encoding operation, and in head response, add entity coding instruction, then data are mail to sending module; If head response comprises block transmission coding, then direct data are mail to sending module;
Data, for compressing the data of this block response body, are then mail to sending module by compression module;
According to the whole response body length in head response or block transmission encoding operation mark, sending module, for data being saved in compressed cache and mailing to client, and judges all whether response body finishes receiving, if so, then closes and connect and terminate; If not, then described receiver module continues to receive data from website.
In one embodiment, described sending module also for before closedown connects and terminates, carries out refresh operation to compressed cache.
As can be seen from above, a kind of proxy server active compression method provided by the invention and proxy server, by proxy server in the downloading data of website, compress data simultaneously, greatly save bandwidth; And the data after compression preserved by described proxy server in compressed cache, time later each client asks this packed data, can quickly call from compressed cache and directly provide, reduce the consumption of CPU; And improve network speed largely.
Accompanying drawing explanation
Fig. 1 is the flow chart of a kind of proxy server active compression method embodiment 1 that the present invention proposes;
Fig. 2 is the flow chart of a kind of proxy server active compression method embodiment 2 that the present invention proposes.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly understand, below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in more detail.
With reference to figure 1, it is the flow chart of a kind of proxy server active compression method embodiment 1 that the present invention proposes.
1 illustrated embodiment flow chart with reference to the accompanying drawings, a kind of proxy server active compression method provided by the present invention, comprising:
Step 101: start;
Step 102: receive data from website;
Step 103: judge whether to receive head response (header);
Step 104: if receiving head response (header), then by the data that receive responsively head (header) keep in;
Step 105: judge whether head response (header) receives; If head response (header) does not receive, then continue to jump to step 102;
Step: 106: if head response (header) receives, then judge whether head response comprises block transmission coded command (Chunked); If head response comprises block transmission coded command (Chunked), then jump to step 110;
Step 107: if head response does not comprise block transmission coded command (Chunked), then force head response to be set to block transmission encoding operation (Chunked);
Step 108: add entity coding instruction (Content-Encoding:gzip) in head response, and jump to step 110;
Step 109: if not receiving head response (header), then compress the data of this block response body (body);
Step 110: data be saved in compressed cache (cache) and mail to client;
Step 111: judge whether all respond body (body) finishes receiving according to whole response body (body) length in head response (header) or block transmission encoding operation (Chunked) mark; If not, then step 102 is jumped to;
Step 112: if so, then close and connect and terminate compression.
Head response (header) described in said method, it is the character string sent before server transmits HTML(Hypertext Markup Language) to browser with HTTP (http protocol), before HTML sent back in supertext preliminary treatment language (PHP), all head response data first need be passed.
Response body (body) described in said method is a kind of HTML label be used in webpage, represents the main part of webpage, and namely the content that can see of user, can comprise the various contents such as text, picture, audio frequency, video.
Block transmission coding (Chunked---Chunked transferencoding) described in said method is a kind of data transmission mechanism in HTTP(Hypertext Transport Protocol), allows HTML (Hypertext Markup Language) to send to the data of client application (normally web browser) can be divided into multiple part by web page server; Use block transmission is encoded, and data decomposition becomes a series of data block, and with one or more pieces of transmissions, such server can send data and not need to know the total size sending content in advance.
HTML(Hypertext Markup Language) is transmitted in the process of browser with HTTP (http protocol) at server, be divided into head response (header) and response body (body) in whole response, all respond the determination methods that body (body) data receiver completes and comprise:
Method 1: head response (header) is inner comprises physical length instruction (Content-Length), the length then all responding body (body) is length represented in physical length instruction (Content-Length), namely terminates after having accepted the data of this length.
Method 2: head response (header) is inner comprises block transmission coded command (Transfer-Encoding:Chunked), when running into one piece of response body (Chunk) that a length is 0, then represents that all responding body (body) data receiver completes.
As can be seen from above-described embodiment 1, a kind of proxy server active compression method provided by the invention, by proxy server in the downloading data of website, compresses data simultaneously, greatly saves bandwidth; And the data after compression preserved by described proxy server in compressed cache, time later each client asks this packed data, can quickly call from compressed cache and directly provide, while saving bandwidth, also reduce the consumption of CPU; And improve network speed largely.
With reference to figure 2, it is the flow chart of a kind of proxy server active compression method embodiment 2 that the present invention proposes.
Step 201: start;
Step 202: receive data from website;
Step: 203: judge whether to receive head response (header);
Step 204: if receiving head response (header), then by the data that receive responsively head (header) keep in;
Step 205: judge whether to receive 2 special identifier symbols, then jump to step 202 if not;
Step 206: if so, then think that head response (header) receives;
Step 207: judge whether head response comprises block transmission coded command (Chunked);
Step 208: if head response does not comprise block transmission coded command (Chunked), then all responded the length of body (body) according to head response (header);
Step 209: force head response to be set to block transmission encoding operation (Chunked);
Step 210: add entity coding instruction (Content-Encoding:gzip) in head response, and jump to step 213;
Step 211: if so, then learn that this response is block transmission coding (Chunked), then jump to step 213;
Step 212: if not receiving head response (header), then compress the data of this block response body (body);
Step 213: data be saved in compressed cache (cache) and mail to client;
Step 214: judge that whether all respond body (body) finishes receiving, and if not, then jumps to step 202 according to whole response body (body) length in head response (header) or block transmission encoding operation (Chunked) mark;
Step 215: if so, then refresh operation is carried out to compressed cache;
Step 216: close and connect and terminate compression.
As can be seen from above-described embodiment 2, a kind of proxy server active compression method provided by the invention, by proxy server in the downloading data of website, compresses data simultaneously, greatly saves bandwidth; And the data after compression preserved by described proxy server in compressed cache, time later each client asks this packed data, can quickly call from compressed cache and directly provide, while saving bandwidth, also reduce the consumption of CPU; And further, before closedown connects and terminates, refresh operation is carried out to compressed cache, compression process can be made more smooth; And improve network speed largely.
Transmit HTML(Hypertext Markup Language) in the process of browser at server with HTTP (http protocol), in whole response, be divided into head response (header) and response body (body).The end of head response (header) be 2 r n, this be http agreement regulation (as long as that is: detect 2 r n, represent that http head receives.) therefore, preferred described special identifier symbol for r n.
Those skilled in the art should know, when server adopts HTTP (http protocol), described special identifier symbol for r n, but in other transportation protocols, this special identifier symbol may change, therefore, special identifier should not accorded with r n as restriction technical characteristic of the present invention.
Here must illustrate; above-mentioned two embodiments are proxy server and transmit the embodiment of HTML(Hypertext Markup Language) to browser with HTTP (http protocol), but also should belong to protection scope of the present invention based on the similar active compression method transmitting data under other protocols of the present invention's design.
Present invention also offers a kind of proxy server, it comprises:
Receiver module, for receiving data from website, and judges whether data are head response; If receive head response, then by the data received responsively head keep in, and judge whether head response receives; If head response does not receive, then described receiver module continues to receive data from website; If head response receives, then data are mail to head response processing module;
Head response processing module, for judging whether head response comprises block transmission coded command, if head response does not comprise block transmission coded command, then force head response to be set to block transmission encoding operation, and in head response, add entity coding instruction, then data are mail to sending module; If head response comprises block transmission coding, then direct data are mail to sending module;
Data, for compressing the data of this block response body, are then mail to sending module by compression module;
According to the whole response body length in head response or block transmission encoding operation mark, sending module, for data being saved in compressed cache and mailing to client, and judges all whether response body finishes receiving, if so, then closes and connect and terminate; If not, then described receiver module continues to receive data from website.
Preferably, described sending module also for closedown connects and terminate compress before, refresh operation is carried out to compressed cache.
As can be seen from the above, a kind of proxy server provided by the invention, by proxy server in the downloading data of website, compresses data simultaneously, greatly saves bandwidth; And the data after compression preserved by described proxy server in compressed cache, time later each client asks this packed data, can quickly call from compressed cache and directly provide, while saving bandwidth, also reduce the consumption of CPU; And further, before closedown connects and terminates, refresh operation is carried out to compressed cache, compression process can be made more smooth; And improve network speed largely.
Here must illustrate; above-described embodiment is that proxy server transmits the embodiment of HTML(Hypertext Markup Language) to browser with HTTP (http protocol), but also should belong to protection scope of the present invention based on the similar proxy server transmitting data under other protocols of the present invention's design.
Those of ordinary skill in the field are to be understood that: the foregoing is only specific embodiments of the invention; be not limited to the present invention; within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (6)

1. a proxy server active compression method, is characterized in that, comprising:
Data are received from website;
Judge whether to receive head response;
If receive head response, then by the data received responsively head keep in, and judge whether head response receives; If head response does not receive, then continue to receive data from website; If head response receives, then judge whether head response comprises block transmission coded command, if head response does not comprise block transmission coded command, head response is then forced to be set to block transmission encoding operation, and in head response, add entity coding instruction, and data are saved in compressed cache and mail to client; If head response comprises block transmission coded command, then data be saved in compressed cache and mail to client;
If not receive head response, then the data of this block response body are compressed, and data are saved in compressed cache and mail to client;
Judge all whether response body finishes receiving according to the whole response body length in head response or block transmission encoding operation mark, if so, then close and connect and terminate; If not, then continue to receive data from website.
2. a kind of proxy server active compression method according to claim 1, it is characterized in that, subsequent processing steps also comprises:
Before closedown connects and terminates, refresh operation is carried out to compressed cache.
3. a kind of proxy server active compression method according to claim 1 and 2, is characterized in that, the described step judging whether head response receives comprises:
Judge whether to receive 2 special identifier symbols, if so, then think that head response receives.
4. a kind of proxy server active compression method according to claim 3, is characterized in that, described special identifier symbol for r n.
5. a proxy server, is characterized in that, comprising:
Receiver module, for receiving data from website, and judges whether data are head response; If receive head response, then by the data received responsively head keep in, and judge whether head response receives; If head response does not receive, then described receiver module continues to receive data from website; If head response receives, then data are mail to head response processing module;
Head response processing module, for judging whether head response comprises block transmission coded command, if head response does not comprise block transmission coded command, then force head response to be set to block transmission encoding operation, and in head response, add entity coding instruction, then data are mail to sending module; If head response comprises block transmission coding, then direct data are mail to sending module;
Data, for compressing the data of this block response body, are then mail to sending module by compression module;
According to the whole response body length in head response or block transmission encoding operation mark, sending module, for data being saved in compressed cache and mailing to client, and judges all whether response body finishes receiving, if so, then closes and connect and terminate; If not, then described receiver module continues to receive data from website.
6. a kind of proxy server according to claim 5, is characterized in that, described sending module also for before closedown connects and terminates, carries out refresh operation to compressed cache.
CN201210275177.3A 2012-08-03 2012-08-03 Proxy server active compression method and proxy server Active CN102752320B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210275177.3A CN102752320B (en) 2012-08-03 2012-08-03 Proxy server active compression method and proxy server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210275177.3A CN102752320B (en) 2012-08-03 2012-08-03 Proxy server active compression method and proxy server

Publications (2)

Publication Number Publication Date
CN102752320A CN102752320A (en) 2012-10-24
CN102752320B true CN102752320B (en) 2015-07-01

Family

ID=47032219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210275177.3A Active CN102752320B (en) 2012-08-03 2012-08-03 Proxy server active compression method and proxy server

Country Status (1)

Country Link
CN (1) CN102752320B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103929447B (en) * 2013-01-11 2017-07-07 中国科学院声学研究所 A kind of method of the parsing HTTP chunked coded datas based on PEEK operations
CN104780182B (en) * 2014-01-09 2018-05-22 中国科学院声学研究所 HTTP chunked are encoded and IP encapsulations, analytic method
CN106559468A (en) * 2015-09-30 2017-04-05 北京奇虎科技有限公司 A kind of method for accessing data
CN106559465A (en) * 2015-09-30 2017-04-05 北京奇虎科技有限公司 Save the determination method and device of flow data
CN106559466A (en) * 2015-09-30 2017-04-05 北京奇虎科技有限公司 Save the determination method and device of flow data
CN112187858B (en) * 2020-08-24 2023-04-18 浙江百应科技有限公司 Method for matching pipeline type http request and response

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101088084A (en) * 2003-12-29 2007-12-12 文丘里无线公司 Reusable compressed objects
CN101199181A (en) * 2006-03-23 2008-06-11 喷流数据有限公司 Browser plug-in based approach for advanced HTTPS data processing
CN101656985A (en) * 2009-08-18 2010-02-24 中兴通讯股份有限公司 Method for managing url resource cache and device thereof
CN102281305A (en) * 2004-12-30 2011-12-14 茨特里克斯系统公司 Systems and methods for providing client-side accelerating technology

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6795848B1 (en) * 2000-11-08 2004-09-21 Hughes Electronics Corporation System and method of reading ahead of objects for delivery to an HTTP proxy server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101088084A (en) * 2003-12-29 2007-12-12 文丘里无线公司 Reusable compressed objects
CN102281305A (en) * 2004-12-30 2011-12-14 茨特里克斯系统公司 Systems and methods for providing client-side accelerating technology
CN101199181A (en) * 2006-03-23 2008-06-11 喷流数据有限公司 Browser plug-in based approach for advanced HTTPS data processing
CN101656985A (en) * 2009-08-18 2010-02-24 中兴通讯股份有限公司 Method for managing url resource cache and device thereof

Also Published As

Publication number Publication date
CN102752320A (en) 2012-10-24

Similar Documents

Publication Publication Date Title
CN102752320B (en) Proxy server active compression method and proxy server
US9866356B2 (en) Data distribution method and device
US8694609B2 (en) Method and apparatus for improving wireless data networks performance
CN102970287A (en) HTTP request data processing method
US10277658B2 (en) Reduction of web page load time using http header compression
CN103945003A (en) Dynamic self-adapting method for connection of Web RTC (Real Time Communication) client
CN101794298A (en) Method for realizing page adaptation, page adaptation system and communication system
CN103716136A (en) Data transmission method and system
CN102111437A (en) Simple object access protocol (SOAP) extension-based WEB service transmission compression method
CN103731493A (en) Page transmission method, device and system
CN101179480B (en) Method for forwarding stream media
CN106851733A (en) A kind of adaptive H TTP message compression methods for mobile network's application
WO2017092389A1 (en) Packet processing method and device
KR102036579B1 (en) Method and apparatus for providing a web service in a wireless communication system
CN101621761A (en) Service propelling and receiving method, application server, user terminal and system
CN114221909A (en) Data transmission method, device, terminal and storage medium
KR100624142B1 (en) Gateway device for wireless data service and wireless data service processing method in gateway device
US8918516B2 (en) Symbiotic client and server for embedded network system
WO2022063058A1 (en) Netconf protocol-based transmission method, device and storage medium
CN103873443B (en) Information processing method, local proxy server and network proxy server
CN101364991A (en) System realizing WAP website fast browsing and method thereof
CN105933420A (en) Method and system for realizing file uploading from client to server through http
CN105635182A (en) Data compression transmission method and system
CN103167554B (en) Gateway flow constriction processing method and device, network service providing system
US20120254728A1 (en) Content acquiring method and client terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20180719

Address after: 510663 Guangdong science and Technology Development Zone, Guangzhou science and Technology Development Zone, No. 3, No. A4, scientific research road, No. 3, No. 458, No.

Patentee after: Guangzhou Zhi Le Internet of things Technology Co., Ltd.

Address before: 100070 Beijing Fengtai District headquarters base area 8, 4 floor.

Patentee before: Beijing Glass Period Communication Technology Co., Ltd.