CN106033448A - Method and device for compressing Html page - Google Patents

Method and device for compressing Html page Download PDF

Info

Publication number
CN106033448A
CN106033448A CN201510115508.0A CN201510115508A CN106033448A CN 106033448 A CN106033448 A CN 106033448A CN 201510115508 A CN201510115508 A CN 201510115508A CN 106033448 A CN106033448 A CN 106033448A
Authority
CN
China
Prior art keywords
data
compression
html page
static
compression section
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510115508.0A
Other languages
Chinese (zh)
Inventor
张荣华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510115508.0A priority Critical patent/CN106033448A/en
Priority to PCT/CN2016/075942 priority patent/WO2016146009A1/en
Publication of CN106033448A publication Critical patent/CN106033448A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for compressing an Html page. The method comprises: according to http header in a browser request, obtaining a static data compression section of an Html page corresponding to a cache, and compressing dynamic data corresponding to the Html page to a dynamic data compression section; combining the static data compression section and the dynamic data compression section to Html page compressed data, and sending the Html page compressed data to a browser. The method can precompress static contents on the Html page, and cache the static contents, when the browser request is received, only the dynamic data in the Html page is compressed, and the data is combined with the static contents and is returned. Thus, large amount of compression is needed when requesting a server is prevented, and calculation pressure of the server is greatly reduced.

Description

Html page compression method and device
Technical field
The present invention relates to internet arena, especially relate to a kind of Html page compression method and device.
Background technology
The process of current Html page compression is: receive the request of browser, and server returns and should ask Seek the corresponding Html page, and this Html page is got ready, and carry out page compression afterwards getting ready.Institute With current Html page compression, any once ask time, be required for the data of full page are pressed Contracting, causes server stress bigger.
Summary of the invention
It is an object of the invention to provide a kind of Html page compression method and device.
One of for achieving the above object, an embodiment of the present invention provides a kind of Html page compression side Method, described method includes:
The static data pressure of the Html page corresponding in caching is obtained according to the http header in browse request Contracting section, and by the dynamic data boil down to dynamic data compression section corresponding with the described Html page;
Described static data compression section and described dynamic data compression section are merged into Html page compression data, And described Html page compression data are sent to browser.
As the further improvement of an embodiment of the present invention, by described static data compression section and described dynamically Data compression section merges into Html page compression data, specifically includes:
By original suitable according to the described Html page of described static data compression section and described dynamic data compression section Sequence merges into Html page compression data.
As the further improvement of an embodiment of the present invention, in described Html page compression data, by one Individual compression header and a compression tail information are by described static data compression section and described dynamic data compression section Encapsulation.
As the further improvement of an embodiment of the present invention, obtaining static data compression section and compressing dynamically Before data, described method includes:
Receive browse request;
The corresponding Html page is generated according to the http header in described browse request;
Static data and the dynamic data of the described Html page are peeled off;
By described static data boil down to static data compression section and cache.
As the further improvement of an embodiment of the present invention, by described static data boil down to static data pressure Contracting section also caches, and specifically includes:
Described static data is completed in first compression is asked compression, to generate at least one static data pressure Contracting section, and store at least one static data compression section described.
As the further improvement of an embodiment of the present invention, described method is to static data compression and to dynamic Specifically include during state data compression:
If described static data or header data that described dynamic data is the Html page or data of middle part, then Call z_full_flush function to be compressed;
If described static data or the tail data that described dynamic data is the Html page, then call Z_sync_flush function is compressed.
As the further improvement of an embodiment of the present invention, call z_full_flush function to the Html page Data of middle part is compressed specifically including:
It is compressed after the character string head of Html page data of middle part adds null character string;
The compression header formed in described null character string is deleted.
As the further improvement of an embodiment of the present invention, each static data compression section all includes dictionary number According to, can individually decompress.
As the further improvement of an embodiment of the present invention, merge according to the original order of the described Html page Specifically include for Html page compression data:
Described static data compression section and described dynamic data compression section are assemblied into according to the order of character string Html page compression data.
As the further improvement of an embodiment of the present invention, described method also includes:
Configuration Http response header, to notify the pressure of its Html page compression data received of browser Contracting form.
One of for achieving the above object, an embodiment of the present invention provides a kind of Html page compression dress Putting, described device includes:
Transfer module, for obtaining corresponding in caching Html page according to the http header in browse request The static data compression section in face;
Compression module, for by the dynamic data boil down to dynamic data compression section corresponding with the described Html page;
Processing module, for merging into Html by described static data compression section and described dynamic data compression section Page compression data, and described Html page compression data are sent to browser.
As the further improvement of an embodiment of the present invention, described processing module is used for:
Described static data compression section is closed according to the original order of the described Html page with described dynamic segment And compress data for the Html page.
As the further improvement of an embodiment of the present invention, in described Html page compression data, by one Individual compression header and a compression tail information are by described static data compression section and described dynamic data compression section Encapsulation.
As the further improvement of an embodiment of the present invention, described processing module is additionally operable to:
Receive browse request;
The corresponding Html page is generated according to the http header in described browse request;
Static data and the dynamic data of the described Html page are peeled off;Described compression module is additionally operable to:
By described static data boil down to static data compression section and cache.
As the further improvement of an embodiment of the present invention, described compression module is for by described static data Completing compression in first compression is asked, to generate at least one static data compression section, described device also wraps Including memory module, described memory module is used for:
Storage at least one static data compression section described.
As the further improvement of an embodiment of the present invention, described compression module is used for:
If described static data or header data that described dynamic data is the Html page or data of middle part, then Call z_full_flush function to be compressed;
If described static data or the tail data that described dynamic data is the Html page, then call Z_sync_flush function is compressed.
As the further improvement of an embodiment of the present invention, described processing module is used for:
Press for described compression module after the character string head of Html page data of middle part adds null character string Contracting;
The compression header formed in described null character string is deleted.
As the further improvement of an embodiment of the present invention, each static data compression section all includes dictionary number According to, can individually decompress.
As the further improvement of an embodiment of the present invention, described processing module is used for:
Described static data compression section and described dynamic data compression section are assemblied into according to the order of character string Html page compression data.
As the further improvement of an embodiment of the present invention, described device also includes configuring module, is used for:
Configuration Http response header, to notify the pressure of its Html page compression data received of browser Contracting form.
Relative to prior art, the method have technical effect that: the Html page compression method of the present invention and Static content on the Html page can be compressed by device in advance, and caches, when receiving browse request, Can be only by the compression of the dynamic data in the Html page, and return after merging with static content, so, it is to avoid Each request server is required for carrying out substantial amounts of compression, greatly reduces the calculating pressure of server.
Accompanying drawing explanation
Fig. 1 is the flow chart of Html page compression method in an embodiment of the present invention;
Fig. 2 is that in an embodiment of the present invention, server receives after browse request, carries out this request instead The complete job flow chart of feedback;
Fig. 3 is the schematic diagram of Html page compression method in an embodiment of the present invention;
Fig. 4 is the module map of Html page compressor in an embodiment of the present invention.
Detailed description of the invention
Describe the present invention below with reference to detailed description of the invention shown in the drawings.But these Embodiment is not limiting as the present invention, and those of ordinary skill in the art is made according to these embodiments Structure, method or conversion functionally be all contained in protection scope of the present invention.
As it is shown in figure 1, in an embodiment of the present invention, described Html page compression method includes:
The static data pressure of the Html page corresponding in caching is obtained according to the http header in browse request Contracting section, and by the dynamic data boil down to dynamic data compression section corresponding with the described Html page;
Described static data compression section and described dynamic data compression section are merged into Html page compression data, And described Html page compression data are sent to browser.
By the above-mentioned flow process that Fig. 1 is corresponding, the static content on the Html page can be compressed in advance, and delay Deposit, when receiving browse request, can only by the compression of the dynamic data in the Html page, and with static state Content returns after merging, and so, compared with prior art avoids each request server and is required for carrying out greatly The compression of amount, thus greatly reduce the calculating pressure of server.
As in figure 2 it is shown, in a concrete example, normally, server after receiving browse request, Can first pass around some public codes, such as cookie judges.It is determined that whether browser accepts compression Data, if not accepting, the most directly producing the Html page, and being back to browser.If browser accepts Compression data, then can use the Html page compression method of an embodiment of the present invention, to form Html page Browser is returned again to after face compression data.
Specifically, server receives browse request, and comprises according to the http header in browse request Some critical fielies, such as the critical data in user-agent or locale, transfer in caching corresponding Static data compression section.Now, exist two kinds may:
1) caching exists the static data compression section of correspondence.
Now, the static data compression section in caching can be obtained, and by corresponding with the described Html page Dynamic data boil down to dynamic data compression section.
Html page data includes header data, data of middle part and tail data.Wherein, described head Portion's data, data of middle part and tail data can be respectively corresponding to static data or dynamic data.
Further, specifically include when to static data compression and dynamic data being compressed:
If described static data or header data that described dynamic data is the Html page or data of middle part, then Call z_full_flush function to be compressed;
If described static data or the tail data that described dynamic data is the Html page, then call Z_sync_flush function is compressed.
Here, succinct in order to describe, with header data static data corresponding with tail data, middle part As a example by data correspondence dynamic data, the compression to now dynamic data is described in detail:
Call z_full_flush function Html page data of middle part (dynamic data) is compressed.This Place, needing to call the reason that described data of middle part is compressed by z_full_flush function is, if for Data of middle part in Html uses the compress mode of acquiescence to be compressed, then return is that compressed package is all Complete.Such as, if directly using the DEFLATEOutputStream in JDK to realize middle part number According to compression, then each compressed package can carry complete DEFLATE head and tail information.And for certain For a little browsers, these multiple complete compressed packages can not be identified.So in java environment, Introduce zlib a java realize version: jzlib (http://www.jcraft.com/jzlib/, for this area The common knowledge of those of ordinary skill, no longer repeats it at this), jzlib supports in compression Flush_mode (jzlib), therefore present embodiment can correspondingly be called the z_full_flush function of jzlib It is compressed described data of middle part obtaining corresponding dynamic data compression section.
In concrete compression process: the first character string head at data of middle part (dynamic data) adds sky It is compressed after character string, at this moment, the compressed file obtained can comprise one in described null character string The compression header formed;And further the compression header formed in described null character string is deleted, So that carrying out " merging of data compression section " then, this partial content will do detailed explaining below State.
2) caching does not exist the static data compression section of correspondence.
In this case, represent that the data of caching are the most expired, or after startup of server, to this The request of the Html page arrives for the first time, so caching is sky.Now, according to an enforcement of the present invention Mode:
First receive browse request, and generate correspondence according to the http header in described browse request The Html page, then the static data of the described Html page and dynamic data are peeled off, and by described quiet State data compression is static data compression section and caches.Normally, comprise here with in http header Critical data, such as key message in user-agent is (exemplarily: judge to need to return is clear Device of looking at is applied to PC or mobile phone) generate the corresponding Html page.
Here, static data completes compression in first compression is asked.For improving compression efficiency, this reality Execute mode, the static state to the multiple separation in same Html page data can be performed in once request Data carry out many second compression.Further, synchronize the static data compression section now compressed is deposited Storing up, the cycle of storage can be set according to the update status of Html, in order to after one cycle, This static data compression section can be updated.
The most similarly with header data static data corresponding with tail data, data of middle part correspondence the most dynamically The compression of now dynamic data and static data is described in detail by data instance:
Call the z_full_flush function of jzlib to Html page header data (static data) and middle part Data (dynamic data) are compressed and call the z_sync_flush function of jzlib to the Html page Tail data (static data) is compressed.Herein, need to call z_full_flush function, Corresponding described header data, data of middle part and tail data are compressed by z_sync_flush function Reason is, if using the compress mode of acquiescence to be compressed for the data in Html, then return is Each compressed package is complete.Such as, if directly using in JDK DEFLATEOutputStream realizes the compression of each several part data, then each compressed package can be taken Carry complete DEFLATE head and tail information.And for some browser, these multiple complete pressures Contracting bag can not be identified.So in java environment, introduce the java of zlib and realize version: Jzlib, jzlib support the flush_mode (jzlib) in compression, therefore present embodiment is correspondingly adjusted It is compressed obtaining to above-mentioned each several part data with z_full_flush function and z_sync_flush function Static data compression section and dynamic data compression section.
Further, in the present embodiment, described " by described static data compression section and described dynamic State data compression section merges into Html page compression data " specifically include:
By former according to the described Html page of described static data compression section and described dynamic data compression section Beginning order merges into Html page compression data.
" according to the original order of the Html page " refers to compress static data compression section and dynamic data Section is assemblied into Html page compression data according to the order of character string.Now, due on the Html page Static content has been compressed in advance and has been cached, therefore avoids each request server and be required for carrying out in a large number Repeated compression, greatly reduce the calculating pressure of server.Exemplarily, dynamic data here is Get data ready.
Further, in order to make more browser can recognize that, this Html page compresses data, described Html In page compression data, compress tail information by described static data pressure by a compression header and one Contracting section and the encapsulation of described dynamic data compression section.
As it is shown on figure 3, include two static data compression section: DEFLATE with a Html page Data A (header data compression section), DEFLATE Data C (tail data compression section) and one are dynamic State data compression section: as a example by DEFLATE Data B (data of middle part compression section).DEFLATE Data A is formed by the compression of z_full_flush function, and it comprises a DEFLATE Header, DEFLATE Data C is formed by the compression of z_sync_flush function, and it comprises a DEFLATE Tail. DEFLATE Data B is formed, in the compression of DEFLATE Data B by the compression of z_full_flush function During, the character string head in its correspondence inserts null character string, and the most again will be in this NUL The compression header formed on string is deleted.So, DEFLATE Data A, DEFLATE Data B, DEFLATE Data C can sequentially be merged into a complete Html page compression data.
Certainly, exemplary one replace embodiment in, DEFLATE Data B can also be by The compression of z_sync_flush function forms, correspondingly, in the compression process of DEFLATE Data B, Tail of string in its correspondence inserts null character string, and will be formed in this null character string the most again Compression tail information deletion.So, equally by DEFLATE Data A, DEFLATE Data B, DEFLATE Data C order is merged into a complete Html page compression data.
In the present embodiment, each static data compression section all includes dictionary data, and and non-usage The dictionary data of the first compression section, can individually decompress.
Finally, then by above-mentioned Html page compression data send to browser.In the process, first Configuration Http response header, to notify the compression of its Html page compression data received of browser Form, then Html page compression data are put into the relief area of response.Relief area is by the Html page Compression data eventually return to browser again and send the process to browser to complete the whole Html page.
Java version scheme at a Html page compression method of the present invention realizes, in example, previously generating A_html and c_html, some dynamic data in the middle of the two page.First a_html with C_html compresses and puts into caching, and then request transfers this Static Compression data from caching when coming every time, and Caching is if it is not, the most dynamically generate Static Compression data;Then produce dynamic data and compress, Then HTTP response header is set, finally according to the original order of the page, compressed package brush is entered The relief area of response.
It should be noted that during compression dynamic data, it is not necessary to create ZStream every time, Have only to for every thread creation once, the most reusable.By such mode, one hundreds of The page of KB, a small amount of dynamic data will be carried out compression, and the data of the overwhelming majority can be pressed in advance After contracting, subsequent request comes without recompression, successfully avoids a lot of double counting.
As shown in Figure 4, in an embodiment of the present invention, described Html page compressor 100 wraps Include and transfer module 10, compression module 20 and processing module 30.
Described module 10 of transferring is for obtaining correspondence in caching according to the http header in browse request The static data compression section of the Html page;
Described compression module 20 is for by the dynamic data boil down to dynamic data corresponding with the described Html page Compression section;
Described processing module 30 is for closing described static data compression section and described dynamic data compression section And compress data for the Html page, and described Html page compression data are sent to browser.
In a concrete example, normally, server, can first after receiving browse request Through some public codes, such as cookie judges.It is determined that whether browser accepts to compress data, If not accepting, the most directly producing the Html page, and being back to browser.If browser accepts pressure Contracting data, then can use the Html page compressor of an embodiment of the present invention, to form Html page Browser is returned again to after face compression data.
Specifically, server receives browse request, and comprises according to the http header in browse request Some critical fielies, such as the critical data in user-agent or locale, transfer in caching corresponding Static data compression section.Now, exist two kinds may:
1) caching exists the static data compression section of correspondence.
Now, the static data compression section in caching can be obtained, and by corresponding with the described Html page Dynamic data boil down to dynamic data compression section.
Html page data includes header data, data of middle part and tail data.Wherein, described head Portion's data, data of middle part and tail data can be respectively corresponding to static data or dynamic data.
Described compression module 20 is used for:
If described static data or header data that described dynamic data is the Html page or data of middle part, then Call z_full_flush function to be compressed;
If described static data or the tail data that described dynamic data is the Html page, then call Z_sync_flush function is compressed.
Here, succinct in order to describe, with header data static data corresponding with tail data, middle part As a example by data correspondence dynamic data, the compression to now dynamic data is described in detail:
Compression module 20 calls z_full_flush function and enters Html page data of middle part (dynamic data) Row compression.Herein, need to call the reason that described data of middle part is compressed by z_full_flush function It is that if using the compress mode of acquiescence to be compressed for the data of middle part in Html, then return is Compressed package is all complete.Such as, if directly using the DEFLATEOutputStream in JDK to come Realize the compression of data of middle part, then each compressed package can carry complete DEFLATE head and tail information. And for some browser, these multiple complete compressed packages can not be identified.So at java In environment, introduce zlib a java realize version: jzlib (http://www.jcraft.com/jzlib/, For the common knowledge of those of ordinary skill in the art, no longer it is repeated at this), jzlib supports Flush_mode (jzlib) in compression, therefore present embodiment can correspondingly call jzlib's Described data of middle part is compressed obtaining corresponding dynamic data compression section by z_full_flush function.
In concrete compression process: processing module 30 is first at the character of data of middle part (dynamic data) String head is compressed, at this moment, in the compressed file obtained for compression module 20 after adding null character string A compression header formed in described null character string can be comprised;Processing module 30 further will be In described null character string formed compression header delete, in order to carry out then " data compression section Merge ", this partial content will be described in detail below.
2) caching does not exist the static data compression section of correspondence.
In this case, represent that the data of caching are the most expired, or after startup of server, to this The request of the Html page arrives for the first time, so caching is sky.Now, according to an enforcement of the present invention Mode:
Processing module 30 is used for first receiving browse request, and according to the http in described browse request Header generates the corresponding Html page, then static data and the dynamic data of the described Html page is shelled From, compression module 20 is used for described static data boil down to static data compression section and caches.Generally Ground, here with the key message in the critical data comprised in http header, such as user-agent (exemplarily: judge that the browser needing to return is applied to PC or mobile phone) generates correspondence The Html page.
Here, static data completes compression in first compression is asked to multiple static state.For improving efficiency, In present embodiment, can be in first compression be asked, perform in same Html page data is multiple Many second compression of the static data separated.Further, memory module 40 synchronizes quiet to now compress State data compression section stores, and the cycle of storage can be set according to the update status of Html, After one cycle, this static data compression section can be updated.
The most similarly with header data static data corresponding with tail data, data of middle part correspondence the most dynamically The compression of now dynamic data and static data is described in detail by data instance:
Call the z_full_flush function of jzlib to Html page header data (static data) and middle part Data (dynamic data) are compressed and call the z_sync_flush function of jzlib to the Html page Tail data (static data) is compressed.Herein, need to call z_full_flush function, Corresponding described header data, data of middle part and tail data are compressed by z_sync_flush function Reason is, if using the compress mode of acquiescence to be compressed for the data in Html, then return is Each compressed package is complete.Such as, if directly using in JDK DEFLATEOutputStream realizes the compression of each several part data, then each compressed package can be taken Carry complete DEFLATE head and tail information.And for some browser, these multiple complete pressures Contracting bag can not be identified.So in java environment, introduce the java of zlib and realize version: Jzlib, jzlib support the flush_mode (jzlib) in compression, therefore present embodiment is correspondingly adjusted It is compressed obtaining to above-mentioned each several part data with z_full_flush function and z_sync_flush function Static data compression section and dynamic data compression section.
Further, in the present embodiment, processing module 30 is additionally operable to:
By former according to the described Html page of described static data compression section and described dynamic data compression section Beginning order merges into Html page compression data.
" according to the original order of the Html page " refers to that processing module 30 by static data compression section and is moved State data compression section is assemblied into Html page compression data according to the order of character string.Now, due to Static content on the Html page has been compressed in advance and has been cached, therefore avoids each request server It is required for carrying out substantial amounts of repeated compression, greatly reduces the calculating pressure of server.Exemplarily, this In dynamic data for getting data ready.
Further, in order to make more browser can recognize that, this Html page compresses data, at Html page In face compression data, it is to compress tail information by static data compression section by a compression header and one Encapsulate with dynamic data compression section.
As it is shown on figure 3, include two static data compression section: DEFLATE with a Html page Data A (header data compression section), DEFLATE Data C (tail data compression section) and one are dynamic State data compression section: as a example by DEFLATE Data B (data of middle part compression section).DEFLATE Data A is formed by the compression of z_full_flush function, and it comprises a DEFLATE Header, DEFLATE Data C is formed by the compression of z_sync_flush function, and it comprises a DEFLATE Tail. DEFLATE Data B is formed, in the compression of DEFLATE Data B by the compression of z_full_flush function During, the character string head in its correspondence inserts null character string, and the most again will be in this NUL The compression header formed on string is deleted.So, DEFLATE Data A, DEFLATE Data B, DEFLATE Data C can sequentially be merged into a complete Html page compression data.
Certainly, exemplary one replace embodiment in, DEFLATE Data B can also be by Compression module 20 calls the compression of z_sync_flush function and forms, correspondingly, at DEFLATE Data B Compression process in, processing module 30 its correspondence tail of string insert null character string, and pressure The compression tail information deletion that will be formed in this null character string again after contracting.So, equally will DEFLATE Data A, DEFLATE Data B, DEFLATE Data C order be merged into one complete Whole Html page compression data.
In the present embodiment, each static data compression section all includes dictionary data, and and non-usage The dictionary data of the first compression section, can individually decompress.
Finally, above-mentioned Html page compression data are sent to browser by processing module 30 again.At this During, first configuration module 50 compresses data configuration Http response header for the Html page, The compressed format of the Html page compression data that it receives with notice browser, processing module 30 will again Html page compression data put into the relief area of response.Relief area will compression Html page compression number The process to browser is sent to complete the whole Html page according to eventually returning to browser again.
It should be noted that above-mentioned transfers module 10, compression module 20, processing module 30, storage Module 40 and configuration module 50 are all the exemplary division of the one according to logic function, and actual should In with, it may be possible to assisted by proxy server or application server or proxy server and application server With realizing the function of each module in above-mentioned embodiment, and above-mentioned each module can also correspondingly be considered Collectively form at least part of of described proxy server and application server.
In sum, the Html page compression method of the present invention and device can quiet by the Html page State content is compressed in advance, and caches, when receiving browse request, and can be only by the Html page The compression of dynamic data, and returning after merging with static content, so, it is to avoid each request server It is required for carrying out substantial amounts of compression, greatly reduces the calculating pressure of server.
Those skilled in the art is it can be understood that arrive, for convenience and simplicity of description, and foregoing description Device, the specific works process of device and module, the corresponding mistake being referred in preceding method embodiment Journey, does not repeats them here.
In sum, the Html page compression method of the present invention and device can quiet by the Html page State content is compressed in advance, and caches, when receiving browse request, and can be only by the Html page The compression of dynamic data, and returning after merging with static content, so, it is to avoid each request server It is required for carrying out substantial amounts of compression, greatly reduces the calculating pressure of server.
In several embodiments provided by the present invention, it should be understood that disclosed device, device and Method, can realize by another way.Such as, device embodiments described above is only shown Meaning property, such as, the division of described module, it is only a kind of logic function and divides, actual permissible when realizing Have other dividing mode, the most multiple modules or assembly can in conjunction with or be desirably integrated into another device, Or some features can ignore, or do not perform.Another point, shown or discussed coupling each other or Direct-coupling or communication connection can be the INDIRECT COUPLING by some interfaces, device or module or communication connection, Can be electrical, machinery or other form.
The described module illustrated as separating component can be or may not be physically separate, as The parts that module shows can be or may not be physical module, i.e. may be located at a place, or Can also be distributed on multiple mixed-media network modules mixed-media.Can select therein some or all of according to the actual needs Module realizes the purpose of present embodiment scheme.
It addition, each functional module in each embodiment of the present invention can be integrated in a processing module, Can also be that modules is individually physically present, it is also possible to 2 or 2 are integrated in a module with upper module In.Above-mentioned integrated module both can realize to use the form of hardware, it would however also be possible to employ hardware adds software function The form of module realizes.
The above-mentioned integrated module realized with the form of software function module, can be stored in a computer can Read in storage medium.Above-mentioned software function module is stored in a storage medium, uses including some instructions So that a computer installation (can be personal computer, server, or network equipment etc.) or place Reason device (processor) performs the part steps of method described in each embodiment of the present invention.And aforesaid storage Medium includes: USB flash disk, portable hard drive, read only memory (Read-Only Memory, ROM), random Access memorizer (Random Access Memory, RAM), magnetic disc or CD etc. are various can be stored The medium of program code.
Last it is noted that embodiment of above is only in order to illustrate technical scheme, rather than to it Limit;Although the present invention being described in detail with reference to aforementioned embodiments, the ordinary skill of this area Personnel it is understood that the technical scheme described in aforementioned each embodiment still can be modified by it, or Person carries out equivalent to wherein portion of techniques feature;And these amendments or replacement, do not make relevant art The essence of scheme departs from the spirit and scope of the present invention each embodiment technical scheme.

Claims (20)

1. a Html page compression method, it is characterised in that described method includes:
The static data pressure of the Html page corresponding in caching is obtained according to the http header in browse request Contracting section, and by the dynamic data boil down to dynamic data compression section corresponding with the described Html page;
Described static data compression section and described dynamic data compression section are merged into Html page compression data, And described Html page compression data are sent to browser.
Html page compression method the most according to claim 1, it is characterised in that by described static state Html page compression data are merged in data compression section and described dynamic data compression section, specifically include:
By original suitable according to the described Html page of described static data compression section and described dynamic data compression section Sequence merges into Html page compression data.
Html page compression method the most according to claim 1 and 2, it is characterised in that described Html In page compression data, by a compression header and a compression tail information, described static data is compressed Section and described dynamic data compression section encapsulate.
Html page compression method the most according to claim 1, it is characterised in that obtaining static state Before data compression section and compression dynamic data, described method includes:
Receive browse request;
The corresponding Html page is generated according to the http header in described browse request;
Static data and the dynamic data of the described Html page are peeled off;
By described static data boil down to static data compression section and cache.
Html page compression method the most according to claim 4, it is characterised in that by described static state Data compression is static data compression section and caches, and specifically includes:
Described static data is completed in first compression is asked compression, to generate at least one static data pressure Contracting section, and store at least one static data compression section described.
Html page compression method the most according to claim 4, it is characterised in that described method exists When to static data compression and dynamic data being compressed, specifically include:
If described static data or header data that described dynamic data is the Html page or data of middle part, then Call z_full_flush function to be compressed;
If described static data or the tail data that described dynamic data is the Html page, then call Z_sync_flush function is compressed.
Html page compression method the most according to claim 6, it is characterised in that call z_full_flush The data of middle part of the Html page is compressed by function, specifically includes:
It is compressed after the character string head of Html page data of middle part adds null character string;
The compression header formed in described null character string is deleted.
Html page compression method the most according to claim 1, it is characterised in that each static number Dictionary data is all included, can individually decompress according to compression section.
Html page compression method the most according to claim 2, it is characterised in that according to described Html The original order of the page merges into Html page compression data, specifically includes:
Described static data compression section and described dynamic data compression section are assemblied into according to the order of character string Html page compression data.
Html page compression method the most according to claim 1, it is characterised in that described method is also Including:
Configuration Http response header, to notify the pressure of its Html page compression data received of browser Contracting form.
11. 1 kinds of Html page compressor, it is characterised in that described device includes:
Transfer module, for obtaining corresponding in caching Html page according to the http header in browse request The static data compression section in face;
Compression module, for by the dynamic data boil down to dynamic data compression section corresponding with the described Html page;
Processing module, for merging into Html by described static data compression section and described dynamic data compression section Page compression data, and described Html page compression data are sent to browser.
12. Html page compressor according to claim 11, it is characterised in that described process Module is used for:
Described static data compression section is closed according to the original order of the described Html page with described dynamic segment And compress data for the Html page.
13. according to the Html page compressor described in claim 11 or 12, it is characterised in that described In Html page compression data, compress tail information by described static data by a compression header and one Compression section and the encapsulation of described dynamic data compression section.
14. Html page compressor according to claim 11, it is characterised in that described process Module is additionally operable to:
Receive browse request;
The corresponding Html page is generated according to the http header in described browse request;
Static data and the dynamic data of the described Html page are peeled off;Described compression module is additionally operable to:
By described static data boil down to static data compression section and cache.
15. Html page compressor according to claim 14, it is characterised in that described compression Module for completing compression in first compression is asked by described static data, to generate at least one static number According to compression section, described device also includes that memory module, described memory module are used for:
Storage at least one static data compression section described.
16. Html page compressor according to claim 14, it is characterised in that described compression Module is used for:
If described static data or header data that described dynamic data is the Html page or data of middle part, then Call z_full_flush function to be compressed;
If described static data or the tail data that described dynamic data is the Html page, then call Z_sync_flush function is compressed.
17. Html page compressor according to claim 16, it is characterised in that described process Module is used for:
Press for described compression module after the character string head of Html page data of middle part adds null character string Contracting;
The compression header formed in described null character string is deleted.
18. Html page compressor according to claim 11, it is characterised in that each static state Data compression Duan Jun includes dictionary data, can individually decompress.
19. Html page compressor according to claim 12, it is characterised in that described process Module is used for:
Described static data compression section and described dynamic data compression section are assemblied into according to the order of character string Html page compression data.
20. Html page compressor according to claim 11, it is characterised in that described device Also include configuring module, be used for:
Configuration Http response header, to notify the pressure of its Html page compression data received of browser Contracting form.
CN201510115508.0A 2015-03-17 2015-03-17 Method and device for compressing Html page Pending CN106033448A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201510115508.0A CN106033448A (en) 2015-03-17 2015-03-17 Method and device for compressing Html page
PCT/CN2016/075942 WO2016146009A1 (en) 2015-03-17 2016-03-09 Html page compression method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510115508.0A CN106033448A (en) 2015-03-17 2015-03-17 Method and device for compressing Html page

Publications (1)

Publication Number Publication Date
CN106033448A true CN106033448A (en) 2016-10-19

Family

ID=56918334

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510115508.0A Pending CN106033448A (en) 2015-03-17 2015-03-17 Method and device for compressing Html page

Country Status (2)

Country Link
CN (1) CN106033448A (en)
WO (1) WO2016146009A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790662A (en) * 2017-01-20 2017-05-31 济南浪潮高新科技投资发展有限公司 A kind of HTTP data compression method of use key frame compression
CN113364508A (en) * 2021-04-30 2021-09-07 深圳震有科技股份有限公司 Voice data transmission control method, system and equipment
CN113518088A (en) * 2021-07-12 2021-10-19 北京百度网讯科技有限公司 Data processing method, device, server, client and medium
CN113612516A (en) * 2021-07-13 2021-11-05 深圳震有科技股份有限公司 Compression test method, system and equipment for satellite communication data packet

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115065725B (en) * 2022-05-12 2024-01-12 北京奇艺世纪科技有限公司 Data processing method, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7484007B2 (en) * 2002-02-01 2009-01-27 Codekko Inc. System and method for partial data compression and data transfer
CN102298630A (en) * 2011-08-30 2011-12-28 国电南瑞科技股份有限公司 Line style-based process data lossy compression method
CN102375884A (en) * 2011-10-21 2012-03-14 北京百度网讯科技有限公司 Method and device for data compression for page access object
CN104283777A (en) * 2013-07-03 2015-01-14 华为技术有限公司 Message compression method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7484007B2 (en) * 2002-02-01 2009-01-27 Codekko Inc. System and method for partial data compression and data transfer
CN102298630A (en) * 2011-08-30 2011-12-28 国电南瑞科技股份有限公司 Line style-based process data lossy compression method
CN102375884A (en) * 2011-10-21 2012-03-14 北京百度网讯科技有限公司 Method and device for data compression for page access object
CN104283777A (en) * 2013-07-03 2015-01-14 华为技术有限公司 Message compression method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790662A (en) * 2017-01-20 2017-05-31 济南浪潮高新科技投资发展有限公司 A kind of HTTP data compression method of use key frame compression
CN113364508A (en) * 2021-04-30 2021-09-07 深圳震有科技股份有限公司 Voice data transmission control method, system and equipment
CN113518088A (en) * 2021-07-12 2021-10-19 北京百度网讯科技有限公司 Data processing method, device, server, client and medium
CN113612516A (en) * 2021-07-13 2021-11-05 深圳震有科技股份有限公司 Compression test method, system and equipment for satellite communication data packet

Also Published As

Publication number Publication date
WO2016146009A1 (en) 2016-09-22

Similar Documents

Publication Publication Date Title
CN106033448A (en) Method and device for compressing Html page
CN109274731B (en) Method and device for deploying and calling web service based on multi-tenant technology
US7945698B2 (en) System and method for partial data compression and data transfer
CN104199951B (en) Web page processing method and device
CN111368520A (en) Editing method and device for electronic forms
CN101079041A (en) Dynamic web page updating method and system
CN102891873A (en) Method for storing log data and log data storage system
CN105354237A (en) Business data display method
CN106453572B (en) Method and system based on Cloud Server synchronous images
CN109785939A (en) Medical image display methods, device, equipment and storage medium based on cloud
CN104573066A (en) Page reusing method and page reusing device
CN107196998B (en) Mobile Web request processing method, equipment and system based on data deduplication
US20150373150A1 (en) Server, client, system and method for preloading browsed page in browser
CN102739654A (en) Method for realizing application program to access database
CN112615759B (en) Full link voltage measurement assembly, full link voltage measurement method and device
CN101197773B (en) Packet compressed transmitting and received de-compression method and system based on multilink
CN105955714A (en) Mixed development front end MVC frame implementation method and system
CN109325006A (en) A kind of method and apparatus for compressing the method and apparatus stored, decompression downloading
CN101420324B (en) Network management system and version renovating method for proxy software
WO2013171751A1 (en) Method and apparatus for storing network data
CN104408178A (en) Device and method for WEB control loading
CN109683916A (en) A kind of method of cloud mirrored host computer of the autonomous creation comprising application software
CN108897582A (en) Interface loading method, device, electronic equipment, server and storage medium
CN106844763B (en) A kind of method showed to the Internet media file formula of modifying and its device
CN103197920B (en) A kind of concurrency control method, control node and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20161019

RJ01 Rejection of invention patent application after publication