[go: up one dir, main page]

CN103258056B - Process the method for style design table, server, client and system - Google Patents

Process the method for style design table, server, client and system Download PDF

Info

Publication number
CN103258056B
CN103258056B CN201310215270.XA CN201310215270A CN103258056B CN 103258056 B CN103258056 B CN 103258056B CN 201310215270 A CN201310215270 A CN 201310215270A CN 103258056 B CN103258056 B CN 103258056B
Authority
CN
China
Prior art keywords
css
child resource
server
client
resource
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.)
Expired - Fee Related
Application number
CN201310215270.XA
Other languages
Chinese (zh)
Other versions
CN103258056A (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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201310215270.XA priority Critical patent/CN103258056B/en
Publication of CN103258056A publication Critical patent/CN103258056A/en
Application granted granted Critical
Publication of CN103258056B publication Critical patent/CN103258056B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了处理风格样式表的方法、服务器、客户端和系统,方法包括:服务器将客户端的网页访问请求转发给网页所属的网站,接收网站返回的响应信息,判断服务器中是否已缓存网页的CSS子资源,如果未缓存,则将响应信息转发给客户端,将客户端发送的CSS子资源请求转发给网站,接收网站返回的CSS子资源转发给客户端,并优化CSS子资源后缓存;如果已缓存,则根据已缓存的内容对接收的响应信息进行修改,向客户端发送修改后的响应信息,接收到客户端发送的CSS子资源请求,在查找对应的优化后的CSS子资源返回给客户端。本发明能够解决客户端的网页加载速度缓慢的问题,取得了加快客户端的网页加载速度,减少网站的负担的有益效果。

The invention discloses a method, a server, a client and a system for processing a style sheet. The method includes: the server forwards the webpage access request of the client to the website to which the webpage belongs, receives the response information returned by the website, and judges whether the webpage has been cached in the server If the CSS sub-resource is not cached, forward the response information to the client, forward the CSS sub-resource request sent by the client to the website, and forward the CSS sub-resource returned by the website to the client, and optimize the CSS sub-resource before caching; If it has been cached, modify the received response information according to the cached content, send the modified response information to the client, receive the CSS sub-resource request sent by the client, find the corresponding optimized CSS sub-resource and return to the client. The invention can solve the problem of slow loading speed of the webpage of the client, and achieves the beneficial effects of accelerating the loading speed of the webpage of the client and reducing the burden of the website.

Description

处理风格样式表的方法、服务器、客户端和系统Method, server, client and system for processing style sheets

技术领域technical field

本发明涉及计算机网络技术领域,具体涉及一种处理风格样式表的方法、服务器、客户端和系统。The invention relates to the technical field of computer networks, in particular to a method for processing style sheets, a server, a client and a system.

背景技术Background technique

现有技术中,与终端浏览器相关的架构为C/S(客户端/服务器,Client/Server)架构。在此种架构中,作为客户端的终端浏览器中带有渲染引擎,当客户端请求访问页面,并且服务器返回页面资源时,客户端的渲染引擎在本地进行页面渲染。在此架构中,服务器(也称为“云端”),通常为代理加缓存的处理模块。客户端的请求通过服务器发送到网站,而从网站返回的响应也通过服务器返回至客户端,客户端在收到服务器的返回的网页信息之后,会通过浏览器渲染引擎进行渲染,从而呈现渲染后的页面。In the prior art, the architecture related to the terminal browser is a C/S (client/server, Client/Server) architecture. In this architecture, the terminal browser as the client has a rendering engine. When the client requests to access the page and the server returns the page resource, the client's rendering engine renders the page locally. In this architecture, the server (also referred to as "cloud") is usually a processing module of proxy plus cache. The client's request is sent to the website through the server, and the response returned from the website is also returned to the client through the server. After the client receives the webpage information returned by the server, it will render it through the browser rendering engine to present the rendered page. page.

CSS(风格样式表,也称为级联样式表,CascadingStyleSheet),是用来进行网页风格设置所用的数据。通过CSS可以统一地设置网页中各标志的显示属性。使用CSS能够更加有效地设置网页外观,具体地,可以精确指定网页元素位置,扩充外观以及创建特殊效果。网页中所使用的风格样式表主要包括三种:(1)外部样式,将网页链接到外部样式表;(2)内页样式,在网页中创建嵌入的样式表。(3)行内样式,应用内嵌样式到各个网页元素。CSS (style sheet, also known as cascading style sheet, CascadingStyleSheet), is the data used to set the style of the web page. The display properties of each logo in the web page can be uniformly set through CSS. CSS can be used to more effectively set the appearance of a web page, specifically, the position of elements of a web page can be precisely specified, the appearance can be expanded, and special effects can be created. The style sheet used in the web page mainly includes three types: (1) external style, which links the web page to the external style sheet; (2) internal page style, which creates an embedded style sheet in the web page. (3) Inline styles, apply inline styles to each web page element.

对于外部样式的CSS,客户端需要从网站中获得该CSS子资源,在本地渲染时应用该CSS子资源。由于CSS子资源传输所使用的传输层协议为TCP协议。TCP连接建立需要耗费较多的时间,随着网页效果越来越复杂,网页中所包含的外部CSS子资源的数量也越来越多。现有技术中,每获得一个外部CSS子资源,都需要与网站建立TCP连接,由此产生网页加载速度缓慢,加载时间过长的问题。此外,各个客户端在加载网站的网页时,都需要与该网站建立TCP连接以下载CSS子资源,由此造成网站的系统任务负担和通信传输负担显著增加,也进一步导致网页的加载速度缓慢。For external style CSS, the client needs to obtain the CSS sub-resource from the website, and apply the CSS sub-resource when rendering locally. Since the transport layer protocol used for the CSS sub-resource transmission is the TCP protocol. It takes a lot of time to establish a TCP connection. As the effect of the webpage becomes more and more complex, the number of external CSS sub-resources included in the webpage is also increasing. In the prior art, every time an external CSS sub-resource is obtained, a TCP connection needs to be established with the website, which causes the problem of slow loading of the webpage and too long loading time. In addition, each client needs to establish a TCP connection with the website to download the CSS sub-resources when loading the webpage of the website, which causes a significant increase in the system task burden and communication transmission burden of the website, and further leads to a slow loading speed of the webpage.

发明内容Contents of the invention

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的处理风格样式表的方法、服务器、客户端和系统。In view of the above problems, the present invention is proposed to provide a style sheet processing method, server, client and system that overcome the above problems or at least partially solve the above problems.

根据本发明的一个方面,提供了一种处理风格样式表的方法,所述方法包括:According to one aspect of the present invention, a method for processing a style sheet is provided, the method comprising:

服务器将客户端的网页访问请求转发给请求访问的网页所属的网站,接收所述网站返回的响应信息,判断所述服务器中是否已缓存所述网页的风格样式表CSS子资源,The server forwards the webpage access request of the client to the website to which the webpage requested to visit belongs, receives the response information returned by the website, and judges whether the style sheet CSS sub-resource of the webpage has been cached in the server,

如果所述服务器中未缓存所述网页的CSS子资源,则服务器将接收的响应信息转发给所述客户端,将所述客户端发送的CSS子资源请求转发给所述网站,接收到所述网站返回的CSS子资源后,将所述CSS子资源转发给所述客户端,将所述CSS子资源进行优化并缓存在所述服务器中;If the CSS subresource of the web page is not cached in the server, the server forwards the received response information to the client, forwards the CSS subresource request sent by the client to the website, and receives the After the website returns the CSS sub-resource, the CSS sub-resource is forwarded to the client, and the CSS sub-resource is optimized and cached in the server;

如果所述服务器中已缓存所述网页的CSS子资源,则服务器根据所述服务器中已缓存的内容对接收的响应信息进行修改,向所述客户端发送修改后的响应信息,接收到所述客户端发送的CSS子资源请求后,在所述服务器中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给所述客户端。If the CSS sub-resource of the web page has been cached in the server, the server modifies the received response information according to the content cached in the server, sends the modified response information to the client, and receives the After the client sends the CSS sub-resource request, it searches the server for the corresponding optimized CSS sub-resource, and returns the found optimized CSS sub-resource to the client.

其中,所述将所述CSS子资源进行优化包括:去除各个CSS子资源中的冗余信息。Wherein, said optimizing the CSS sub-resources includes: removing redundant information in each CSS sub-resource.

其中,所述将所述CSS子资源进行优化包括:根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组;在每个分组中,将分组中的CSS子资源聚合为一个CSS子资源。Wherein, said optimizing the CSS sub-resources includes: grouping multiple CSS sub-resources according to the semantics and/or logic of the CSS sub-resources; in each group, aggregating the CSS sub-resources in the group into one CSS subresource.

其中,所述将所述CSS子资源进行优化包括:为优化后的CSS子资源,生成对应的URL;记录访问的网页的URL与优化后的CSS子资源的URL的对应关系。Wherein, said optimizing the CSS sub-resource includes: generating a corresponding URL for the optimized CSS sub-resource; and recording the correspondence between the URL of the visited web page and the URL of the optimized CSS sub-resource.

其中,所述服务器根据所述服务器中已缓存的内容对接收的响应信息进行修改包括:在记录的对应关系中查找访问的网页的URL,将响应信息中包含的CSS子资源的URL修改为对应的优化后的CSS子资源的URL。Wherein, the server modifying the received response information according to the content cached in the server includes: searching for the URL of the visited webpage in the corresponding relationship of records, and modifying the URL of the CSS sub-resource contained in the response information to the corresponding The URL of the optimized CSS subresource.

其中,所述将查找到的优化后的CSS子资源返回给所述客户端包括:在封装优化后的CSS子资源的报文的报文头中添加CSS节省字节字段,该CSS节省字节字段中为优化后的CSS子资源与优化前的CSS子资源相比减少的字节数。Wherein, the returning the found optimized CSS sub-resource to the client includes: adding a CSS saving byte field in the message header of the packet encapsulating the optimized CSS sub-resource, the CSS saving byte The field is the number of bytes reduced between the optimized CSS sub-resource and the un-optimized CSS sub-resource.

根据本发明的一个方面,公开了一种在客户端加载访问网页的风格样式表的方法,所述方法包括:According to one aspect of the present invention, a method for loading a style sheet of an accessed webpage on a client side is disclosed, the method comprising:

客户端向服务器发送网页访问请求,并接收服务器返回的响应信息,所述响应信息为所述网页所属的网站返回的响应信息或所述服务器对其修改后的响应信息;The client sends a webpage access request to the server, and receives response information returned by the server, the response information being the response information returned by the website to which the webpage belongs or the modified response information by the server;

客户端对响应信息进行解析,根据解析出的内容向服务器发送CSS子资源请求,并接收服务器返回的CSS子资源,加载该CSS子资源。The client parses the response information, sends a CSS sub-resource request to the server according to the parsed content, receives the CSS sub-resource returned by the server, and loads the CSS sub-resource.

根据本发明的另一个方面,公开了一种处理风格样式表的服务器,所述服务器包括:代理模块、缓存模块和风格样式表CSS资源优化模块,According to another aspect of the present invention, a server for processing style sheets is disclosed, and the server includes: a proxy module, a caching module and a style sheet CSS resource optimization module,

所述代理模块,适于将客户端的网页访问请求转发给请求访问的网页所属网站,接收所述网站返回的响应信息,判断所述缓存模块中是否已缓存所述网页的CSS子资源,将判断结果通知给所述CSS资源优化模块;The proxy module is adapted to forward the webpage access request of the client to the website to which the webpage is requested to visit, receives the response information returned by the website, and judges whether the CSS sub-resource of the webpage has been cached in the caching module, and judges The result is notified to the CSS resource optimization module;

所述代理模块,还适于在判断结果为所述缓存模块中未缓存所述网页的CSS子资源时,将接收的响应信息转发给所述客户端,接收所述客户端发送的CSS子资源请求,将所述CSS子资源请求转发给所述网站,接收所述网站返回的CSS子资源,并将所述CSS子资源转发给所述客户端;The proxy module is further adapted to forward the received response information to the client when the judging result is that the CSS sub-resource of the web page is not cached in the caching module, and receive the CSS sub-resource sent by the client Requesting, forwarding the CSS subresource request to the website, receiving the CSS subresource returned by the website, and forwarding the CSS subresource to the client;

所述CSS资源优化模块具体包括:CSS优化子模块和CSS修改子模块;The CSS resource optimization module specifically includes: a CSS optimization submodule and a CSS modification submodule;

所述CSS优化子模块,适于在判断结果为所述缓存模块中未缓存所述网页的CSS子资源时,将从网站接收的CSS子资源进行优化,并缓存到所述缓存模块;The CSS optimization sub-module is adapted to optimize the CSS sub-resources received from the website and cache them in the cache module when the judgment result is that the CSS sub-resources of the webpage are not cached in the cache module;

所述CSS修改子模块,适于在判断结果为所述缓存模块中已缓存所述网页的CSS子资源时,根据所述缓存模块中已缓存的内容对接收的网站返回的响应信息进行修改;The CSS modification sub-module is adapted to modify the response information returned by the received website according to the cached content in the cache module when the judgment result is that the CSS sub-resource of the web page has been cached in the cache module;

所述代理模块,还适于将所述修改后的响应信息发送给所述客户端,接收到所述客户端发送的CSS子资源请求后,在所述缓存模块中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给所述客户端。The proxy module is further adapted to send the modified response information to the client, and after receiving the CSS sub-resource request sent by the client, search the cache module for the corresponding optimized CSS Sub-resources, returning the found and optimized CSS sub-resources to the client.

所述缓存模块,适于缓存优化后的CSS子资源。The caching module is suitable for caching optimized CSS sub-resources.

其中,所述CSS优化子模块,适于去除各个CSS子资源中的冗余信息。Wherein, the CSS optimization sub-module is adapted to remove redundant information in each CSS sub-resource.

其中,所述CSS优化子模块,适于根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组,在每个分组中,将分组中的CSS子资源聚合为一个CSS子资源。Wherein, the CSS optimization sub-module is adapted to group multiple CSS sub-resources according to the semantics and/or logic of the CSS sub-resources, and in each group, aggregate the CSS sub-resources in the group into one CSS sub-resource.

其中,所述CSS优化子模块,适于为优化后的CSS子资源,生成对应的URL,记录访问的网页的URL与优化后的CSS子资源的URL的对应关系,将优化后的CSS子资源缓存到所述缓存模块。Wherein, the CSS optimization sub-module is adapted to generate a corresponding URL for the optimized CSS sub-resource, record the corresponding relationship between the URL of the visited webpage and the URL of the optimized CSS sub-resource, and convert the optimized CSS sub-resource to Cache to the cache module.

其中,所述CSS修改子模块,适于在记录的对应关系中查找访问的网页的URL,将响应信息中包含的CSS子资源的URL修改为对应的优化后的CSS子资源的URL。Wherein, the CSS modifying sub-module is adapted to search the URL of the accessed webpage in the corresponding relationship of the record, and modify the URL of the CSS sub-resource contained in the response information to the URL of the corresponding optimized CSS sub-resource.

其中,所述代理模块,适于在封装优化后的CSS子资源的报文的报文头中添加CSS节省字节字段,该CSS节省字节字段中填写优化后的CSS子资源与优化前的CSS子资源相比减少的字节数。Wherein, the proxy module is adapted to add a CSS saving byte field in the packet header of the package-optimized CSS sub-resource, and the CSS saving byte field is filled with the optimized CSS sub-resource and the pre-optimized The number of bytes reduced compared to CSS subresources.

根据本发明的另一个方面,公开了一种加载访问网页的风格样式表的客户端,所述客户端包括:According to another aspect of the present invention, a client that loads a style sheet of an accessed web page is disclosed, and the client includes:

通信模块,适于向服务器发送网页访问请求,并接收服务器返回的响应信息,所述响应信息为所述网页所属的网站返回的响应信息或所述服务器对其修改后的响应信息;The communication module is adapted to send a web page access request to the server, and receive the response information returned by the server, the response information being the response information returned by the website to which the web page belongs or the modified response information of the server;

解析模块,适于对响应信息进行解析;An analysis module, suitable for analyzing the response information;

所述通信模块,还适于根据解析出的内容向服务器发送CSS子资源请求,并接收服务器返回的CSS子资源;The communication module is further adapted to send a CSS subresource request to the server according to the parsed content, and receive the CSS subresource returned by the server;

加载模块,适于加载接收到的服务器返回的CSS子资源。The loading module is suitable for loading the received CSS sub-resources returned by the server.

根据本发明的另一个方面,公开了一种加载访问网页的风格样式表的系统,所述系统包括:所述的服务器,以及所述的客户端。According to another aspect of the present invention, a system for loading a style sheet of an accessed webpage is disclosed, and the system includes: the server and the client.

根据本发明的技术方案,可以在服务器中缓存网页的CSS子资源,并对该CSS子资源进行优化,当客户端再次加载包含该CSS子资源的网页时,服务器修改网站返回的响应信息中内容,使得客户端无需与网站建立TCP连接,而直接从服务器中获得缓存的优化后的CSS子资源。由此,能够减少在加载网页时客户端与网站间建立的TCP连接的数量,从而解决了由于客户端与网站建立的TCP连接过多而导致的网页加载速度缓慢,加载时间过长的问题;取得了加快客户端的网页加载速度,以及减少网站的系统任务负担和通信传输负担的有益效果。According to the technical solution of the present invention, the CSS sub-resource of the web page can be cached in the server, and the CSS sub-resource can be optimized. When the client loads the web page containing the CSS sub-resource again, the server modifies the content in the response information returned by the website. , so that the client does not need to establish a TCP connection with the website, but directly obtains the cached optimized CSS sub-resource from the server. Thus, it is possible to reduce the number of TCP connections established between the client and the website when loading the webpage, thereby solving the problems of slow loading of the webpage and excessively long loading time caused by too many TCP connections established between the client and the website; The beneficial effects of accelerating the webpage loading speed of the client and reducing the system task burden and communication transmission burden of the website are obtained.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:

图1示出了根据本发明一个实施例的处理风格样式表的服务器的结构图;Fig. 1 shows a structural diagram of a server processing a style sheet according to an embodiment of the present invention;

图2示出了根据本发明一个实施例的CSS资源优化模块的结构图;Fig. 2 shows a structural diagram of a CSS resource optimization module according to an embodiment of the present invention;

图3示出了根据本发明一个实施例的加载访问网页的风格样式表的客户端的结构图;Fig. 3 shows a structural diagram of a client loading a style sheet of a web page according to an embodiment of the present invention;

图4示出了根据本发明一个实施例的加载访问网页的风格样式表的系统的结构图;FIG. 4 shows a structural diagram of a system for loading a style sheet of an accessed webpage according to an embodiment of the present invention;

图5示出了根据本发明一个实施例的处理风格样式表的方法的流程图;Fig. 5 shows a flowchart of a method for processing a style sheet according to an embodiment of the present invention;

图6示出了根据本发明一个实施例的客户端首次通过服务器访问网站时,服务器的操作流程图;Fig. 6 shows the operation flow chart of the server when the client accesses the website through the server for the first time according to one embodiment of the present invention;

图7示出了根据本发明一个实施例的客户端再次通过服务器访问网站时,服务器的操作流程图;以及Fig. 7 shows the operation flow chart of the server when the client accesses the website through the server again according to one embodiment of the present invention; and

图8示出了根据本发明一个实施例的在客户端加载访问网页的风格样式表的方法的流程图。Fig. 8 shows a flow chart of a method for loading a style sheet of an accessed web page at a client according to an embodiment of the present invention.

具体实施方式detailed description

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

如图1所示,为根据本发明一个实施例的处理风格样式表的服务器的结构图。服务器100包括:代理模块110、缓存模块120和CSS资源优化模块130。As shown in FIG. 1 , it is a structural diagram of a server for processing style sheets according to an embodiment of the present invention. The server 100 includes: a proxy module 110 , a cache module 120 and a CSS resource optimization module 130 .

代理模块110,适于将客户端200的网页访问请求转发给请求访问的网页所属网站,接收网站返回的响应信息,判断缓存模块120中是否已缓存该网页的CSS子资源,将判断结果通知给CSS资源优化模块130。The proxy module 110 is adapted to forward the webpage access request of the client 200 to the website to which the webpage is requested to visit, receives the response information returned by the website, judges whether the CSS sub-resource of the webpage has been cached in the caching module 120, and notifies the judgment result to CSS resource optimization module 130 .

代理模块110,还适于在判断结果为缓存模块120中未缓存该网页的CSS子资源时,将接收的响应信息转发给客户端200,接收客户端200发送的CSS子资源请求,将该CSS子资源请求转发给网站,接收网站返回的CSS子资源,并将该CSS子资源转发给客户端200。The proxy module 110 is further adapted to forward the received response information to the client 200 when the judging result is that the CSS sub-resource of the webpage is not cached in the cache module 120, receive the CSS sub-resource request sent by the client 200, and send the CSS sub-resource to the client 200. The subresource request is forwarded to the website, the CSS subresource returned by the website is received, and the CSS subresource is forwarded to the client 200 .

如图2所示,为根据本发明一个实施例的CSS资源优化模块的结构图。CSS资源优化模块130具体包括:CSS优化子模块132和CSS修改子模块134。As shown in FIG. 2 , it is a structural diagram of a CSS resource optimization module according to an embodiment of the present invention. The CSS resource optimization module 130 specifically includes: a CSS optimization submodule 132 and a CSS modification submodule 134 .

CSS优化子模块132,适于在代理模块110的判断结果为缓存模块120中未缓存该网页的CSS子资源时,将从网站接收的该网页的CSS子资源进行优化,并将优化后的CSS子资源缓存到缓存模块120。The CSS optimization sub-module 132 is adapted to optimize the CSS sub-resource of the web page received from the website when the judging result of the proxy module 110 is that the CSS sub-resource of the web page is not cached in the caching module 120, and convert the optimized CSS The sub-resources are cached to the caching module 120 .

在一具体实施例中,CSS优化子模块132进行的优化为去冗余。CSS优化子模块132去除各个CSS子资源中的冗余信息。In a specific embodiment, the optimization performed by the CSS optimization sub-module 132 is de-redundancy. The CSS optimization sub-module 132 removes redundant information in each CSS sub-resource.

举例而言,CSS优化子模块132去除掉CSS子资源中的空白和注释。For example, the CSS optimization sub-module 132 removes white space and comments in CSS sub-resources.

通过去除各个CSS子资源中的冗余信息,能够在客户端获取CSS子资源时减少网络传输的流量,进一步提高网页访问速度,并节省客户端的网络流量。By removing redundant information in each CSS sub-resource, it is possible to reduce network transmission traffic when the client obtains the CSS sub-resource, further improve the web page access speed, and save the network traffic of the client.

在另一具体实施例中,CSS优化子模块132进行的优化为聚合。CSS优化子模块132根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组,在每个分组中,将分组中的CSS子资源聚合为一个CSS子资源。In another specific embodiment, the optimization performed by the CSS optimization sub-module 132 is aggregation. The CSS optimization sub-module 132 groups multiple CSS sub-resources according to the semantics and/or logic of the CSS sub-resources, and in each group, aggregates the CSS sub-resources in the group into one CSS sub-resource.

举例而言,CSS优化子模块132分析各个CSS之间的相互关系。同一个网站的不同的CSS子资源间可能存在逻辑关系,CSS优化子模块132根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组,使得分到同一组的CSS子资源聚合后不会存在语义和逻辑冲突。CSS优化子模块132将各组内的CSS聚合成一个CSS。例如,网页具有6个CSS子资源,编号1至6。CSS优化子模块132根据CSS子资源的语义和/或逻辑将6个CSS子资源分为三组,编号1-3的CSS子资源为一组,编号4和6的CSS子资源为一组,编号5的CSS子资源为一组,在3个组内分别进行聚合,由此,CSS优化子模块132将网站的6个CSS子资源聚合成3个CSS子资源。For example, the CSS optimization sub-module 132 analyzes the relationship between each CSS. There may be a logical relationship between different CSS sub-resources on the same website. The CSS optimization sub-module 132 groups multiple CSS sub-resources according to the semantics and/or logic of the CSS sub-resources, so that the CSS sub-resources grouped into the same group are aggregated. There will be no semantic and logical conflicts. The CSS optimization sub-module 132 aggregates the CSS in each group into one CSS. For example, a webpage has 6 CSS subresources, numbered 1 to 6. The CSS optimization sub-module 132 divides the 6 CSS sub-resources into three groups according to the semantics and/or logic of the CSS sub-resources, the CSS sub-resources numbered 1-3 form a group, the CSS sub-resources numbered 4 and 6 form a group, The CSS sub-resources numbered 5 are one group, and are aggregated in three groups respectively. Therefore, the CSS optimization sub-module 132 aggregates the six CSS sub-resources of the website into three CSS sub-resources.

通过将多个CSS子资源进行聚合,能够在CSS子资源中信息不被损伤的情况下,减少客户端访问网页时TCP连接,从而进一步增加客户端访问网页的速度。By aggregating multiple CSS sub-resources, it is possible to reduce the TCP connections when the client accesses the webpage without damaging the information in the CSS sub-resources, thereby further increasing the speed of the client accessing the webpage.

此外,在进行CSS子资源聚合时,服务器100开销会增加。可以通过配置列表的方式,对需要进行CSS子资源聚合的网站进行设置。例如,对于用户访问量较大的网站(如网址导航中排名前25的网站)进行CSS子资源聚合。而对一些访问量较小的网站,不再进行CSS子资源聚合。所以,CSS优化子模块132还适于根据设置的聚合网站列表,对列表中的网站的CSS子资源进行聚合。由此,可以达到灵活调整CSS子资源聚合的效果。In addition, when CSS sub-resources are aggregated, the overhead of the server 100 will increase. The website that needs to aggregate CSS sub-resources can be set by configuring the list. For example, aggregate CSS sub-resources for websites with a large number of user visits (such as the top 25 websites in website navigation). However, for some websites with relatively small visits, CSS sub-resource aggregation is no longer performed. Therefore, the CSS optimization sub-module 132 is also adapted to aggregate the CSS sub-resources of the websites in the list according to the set aggregation website list. In this way, the effect of flexibly adjusting CSS sub-resource aggregation can be achieved.

CSS修改子模块134,适于在判断结果为缓存模块120中已缓存该网页的CSS子资源时,根据缓存模块120中已缓存的内容对接收的网站返回的响应信息进行修改。The CSS modification sub-module 134 is adapted to modify the received response information returned by the website according to the content cached in the cache module 120 when the judgment result is that the CSS sub-resource of the webpage has been cached in the cache module 120 .

代理模块110,还适于将修改后的响应信息发送给客户端200,接收到客户端200发送的CSS子资源请求后,在缓存模块120中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给客户端200。The proxy module 110 is also adapted to send the modified response information to the client 200. After receiving the CSS sub-resource request sent by the client 200, it searches the cache module 120 for the corresponding optimized CSS sub-resource, and finds The optimized CSS sub-resource is returned to the client 200.

缓存模块120,适于缓存优化后的CSS子资源。The cache module 120 is adapted to cache optimized CSS sub-resources.

在一具体实施例中,CSS优化子模块132为优化后的CSS子资源,生成对应的URL,记录访问的网页的URL与优化后的CSS子资源的URL的对应关系,将优化后的CSS子资源缓存到缓存模块120。In a specific embodiment, the CSS optimization sub-module 132 generates a corresponding URL for the optimized CSS sub-resource, records the corresponding relationship between the URL of the visited web page and the URL of the optimized CSS sub-resource, and converts the optimized CSS sub-resource to The resources are cached in the caching module 120 .

CSS修改子模块134在记录的对应关系中查找访问的网页的URL,将响应信息中包含的CSS子资源的URL修改为对应的优化后的CSS子资源的URL。The CSS modification sub-module 134 searches the URL of the accessed web page in the corresponding relationship of the records, and modifies the URL of the CSS sub-resource included in the response information to the URL of the corresponding optimized CSS sub-resource.

代理模块110在接收到客户端200发送的CSS子资源请求后,根据CSS子资源请求中的优化后的CSS子资源的URL在缓存模块120中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给客户端200。After receiving the CSS sub-resource request sent by the client 200, the proxy module 110 searches the caching module 120 for the corresponding optimized CSS sub-resource according to the URL of the optimized CSS sub-resource in the CSS sub-resource request. The optimized CSS sub-resource is returned to the client 200.

此外,在另一具体实施例中,代理模块110在封装优化后的CSS子资源的报文的报文头中添加CSS节省字节字段,该CSS节省字节字段中填写优化后的CSS子资源与优化前的CSS子资源相比减少的字节数。In addition, in another specific embodiment, the proxy module 110 adds a CSS saved byte field to the packet header of the packet encapsulating the optimized CSS sub-resource, and the CSS saved byte field is filled with the optimized CSS sub-resource The number of bytes reduced compared to the unoptimized CSS subresource.

CSS子资源优化能够节省流量,因此通过报文的报文头中添加CSS节省字节字段,例如CSS-Save-Bytes字段,能够使用户知晓此次访问网页中客户端200所节省的字节数。CSS sub-resource optimization can save traffic, so by adding a CSS saving byte field in the message header, such as the CSS-Save-Bytes field, the user can know the number of bytes saved by the client 200 in this visit to the web page .

通过本发明实施例中技术方案,能够减少在加载网页时客户端与网站间建立的TCP连接的数量,从而解决了由于客户端与网站建立的TCP连接过多而导致的网页加载速度缓慢,加载时间过长的问题;取得了加快客户端的网页加载速度,以及减少网站的系统任务负担和通信传输负担的有益效果。Through the technical solution in the embodiment of the present invention, it is possible to reduce the number of TCP connections established between the client and the website when loading the webpage, thereby solving the slow loading speed of the webpage caused by too many TCP connections established between the client and the website. The problem of too long time; the beneficial effects of accelerating the webpage loading speed of the client and reducing the system task burden and communication transmission burden of the website have been achieved.

以下以客户端200访问URL为http://www.a.com的网页为例,对本发明的处理风格样式表的服务器100进行举例说明。Hereinafter, the server 100 for processing style sheets of the present invention will be illustrated by taking the client 200 accessing a webpage whose URL is http://www.a.com as an example.

其中,所述客户端200可以为手机终端中浏览器,也可以为PC(个人电脑,PersonalComputer)终端中浏览器,或者其他网页访问请求方,在此没有特别限制。Wherein, the client 200 may be a browser in a mobile phone terminal, or a browser in a PC (Personal Computer, Personal Computer) terminal, or other webpage access requesting party, and there is no special limitation here.

当客户端200请求访问http://www.a.com时,客户端200向服务器100发送网页访问请求。When the client 200 requests to access http://www.a.com, the client 200 sends a web page access request to the server 100 .

服务器100的代理模块110接收客户端200发送的网页访问请求,将客户端200的网页访问请求转发给请求访问的网页所属网站,接收网站返回的响应信息,判断服务器100的缓存模块120中是否已缓存该网页的CSS子资源。The proxy module 110 of the server 100 receives the webpage access request sent by the client 200, forwards the webpage access request of the client 200 to the website to which the webpage requested to visit belongs, receives the response information returned by the website, and determines whether the cache module 120 of the server 100 has Cache the CSS subresources for this page.

当客户端200首次通过服务器100访问http://www.a.com时,代理模块110接收网站返回的响应信息,判断出缓存模块120中没有缓存该网页的CSS子资源。When the client 200 accesses http://www.a.com through the server 100 for the first time, the proxy module 110 receives the response information returned by the website, and determines that the caching module 120 does not cache the CSS sub-resource of the web page.

此外,代理模块110接收网站返回的响应信息,并判断出缓存模块120中未缓存该网页的CSS子资源后,将接收的响应信息转发给客户端200。In addition, the proxy module 110 receives the response information returned by the website, and after judging that the CSS sub-resource of the web page is not cached in the caching module 120 , forwards the received response information to the client 200 .

客户端200收到http://www.a.com的网页响应后,解析网页内容得到网页中的外部CSS子资源,该些CSS子资源的URL分别为http://xxx.b.css,http://xxx.c.css和http://xxx.d.css。客户端200向服务器100发送包括上述URL的CSS子资源请求。After receiving the web page response of http://www.a.com, the client 200 parses the content of the web page to obtain the external CSS sub-resources in the web page. The URLs of these CSS sub-resources are respectively http://xxx.b.css, http://xxx.c.css and http://xxx.d.css. The client 200 sends a CSS sub-resource request including the above URL to the server 100 .

代理模块110接收到客户端200发送的CSS子资源请求,将该CSS子资源请求转发给网站,接收网站返回的CSS子资源,并将该CSS子资源转发给客户端200。客户端200接收到服务器100转发的CSS子资源,使用该CSS子资源进行网页渲染。The proxy module 110 receives the CSS sub-resource request sent by the client 200 , forwards the CSS sub-resource request to the website, receives the CSS sub-resource returned by the website, and forwards the CSS sub-resource to the client 200 . The client 200 receives the CSS sub-resource forwarded by the server 100, and uses the CSS sub-resource to render the webpage.

此外,CSS资源优化模块130的CSS优化子模块132在代理模块110的判断结果为缓存模块120中未缓存该网页的CSS子资源后,将代理模块110从网站接收的该网页的CSS子资源进行优化,并将优化后的CSS子资源缓存到缓存模块120。并且,CSS优化子模块132为优化后的CSS子资源,生成对应的URL,记录访问的网页的URL与优化后的CSS子资源的URL的对应关系,将优化后的CSS子资源缓存到缓存模块120。In addition, after the CSS optimization sub-module 132 of the CSS resource optimization module 130 determines that the proxy module 110 has not cached the CSS sub-resource of the web page in the caching module 120, the CSS sub-resource of the web page received by the proxy module 110 from the website is processed. Optimize, and cache the optimized CSS sub-resources to the caching module 120. And, the CSS optimization sub-module 132 generates a corresponding URL for the optimized CSS sub-resource, records the corresponding relationship between the URL of the visited web page and the URL of the optimized CSS sub-resource, and caches the optimized CSS sub-resource into the caching module 120.

具体而言,CSS优化子模块132对网站返回的http://xxx.b.css,http://xxx.c.css和http://xxx.d.css对应的3个CSS子资源进行去冗余操作,然后将去冗余后的3个CSS子资源进行聚合。CSS优化子模块132将http://xxx.b.css和http://xxx.c.css分为一组,将http://xxx.d.css分为另一组,将每组中CSS子资源聚合成一个CSS子资源,聚合后的CSS子资源对应的URL分别为http://xxx.b+c.composite.css和http://xxx.d.composite.css。CSS优化子模块132记录http://www.a.com与http://xxx.b+c.composite.css和http://xxx.d.composite.css之间的对应关系,将聚合后的两个CSS子资源缓存到缓存模块120。Specifically, the CSS optimization sub-module 132 performs optimization on the three CSS sub-resources corresponding to http://xxx.b.css, http://xxx.c.css and http://xxx.d.css returned by the website De-redundancy operation, and then aggregate the 3 CSS sub-resources after de-redundancy. The CSS optimization sub-module 132 divides http://xxx.b.css and http://xxx.c.css into one group, divides http://xxx.d.css into another group, and divides the The CSS sub-resources are aggregated into one CSS sub-resource, and the URLs corresponding to the aggregated CSS sub-resources are http://xxx.b+c.composite.css and http://xxx.d.composite.css respectively. The CSS optimization sub-module 132 records the corresponding relationship between http://www.a.com and http://xxx.b+c.composite.css and http://xxx.d.composite.css, after aggregation The two CSS sub-resources of are cached to the caching module 120.

当客户端200再次通过服务器100访问http://www.a.com时,客户端200向服务器100发送网页访问请求。When the client 200 accesses http://www.a.com through the server 100 again, the client 200 sends a webpage access request to the server 100 .

服务器100的代理模块110将客户端200的网页访问请求转发给请求访问的网页所属网站,接收网站返回的响应信息,判断出服务器100的缓存模块120中已缓存该网页的CSS子资源。The proxy module 110 of the server 100 forwards the webpage access request of the client 200 to the website to which the requested webpage belongs, receives the response information returned by the website, and determines that the CSS sub-resource of the webpage has been cached in the caching module 120 of the server 100.

CSS资源优化模块130的CSS修改子模块134根据记录访问的网页的URL与优化后的CSS子资源的URL的对应关系对接收的网站返回的响应信息进行修改。The CSS modification sub-module 134 of the CSS resource optimization module 130 modifies the received response information returned by the website according to the corresponding relationship between the URL of the visited web page and the URL of the optimized CSS sub-resource.

具体而言,CSS修改子模块134在记录的对应关系中查找http://www.a.com,将响应信息中包含的http://xxx.b.css和http://xxx.c.css修改为http://xxx.b+c.composite.css,将响应信息中包含的http://xxx.d.css修改为http://xxx.d.composite.css。Specifically, the CSS modification sub-module 134 searches for http://www.a.com in the corresponding relationship of records, and sends http://xxx.b.css and http://xxx.c. The css is changed to http://xxx.b+c.composite.css, and the http://xxx.d.css contained in the response information is changed to http://xxx.d.composite.css.

代理模块110将修改后的响应信息发送给客户端200。The proxy module 110 sends the modified response information to the client 200 .

客户端200接收到代理模块110发送的响应信息,解析出外部CSS子资源对应的URL分别为http://xxx.b+c.composite.css和http://xxx.d.composite.cs,向服务器100发送包括上述URL的CSS子资源请求。The client 200 receives the response information sent by the proxy module 110, and parses out that the URLs corresponding to the external CSS sub-resources are http://xxx.b+c.composite.css and http://xxx.d.composite.cs respectively, A CSS subresource request including the above URL is sent to the server 100 .

代理模块110接收到客户端200发送的CSS子资源请求后,解析出优化后的CSS子资源的URL,根据该URL在缓存模块120中查找到优化后的CSS子资源,将该CSS子资源返回给客户端200。After receiving the CSS subresource request sent by the client 200, the proxy module 110 parses out the URL of the optimized CSS subresource, finds the optimized CSS subresource in the caching module 120 according to the URL, and returns the CSS subresource Give the client 200.

具体而言,代理模块110解析出http://xxx.b+c.composite.css和http://xxx.d.composite.css,在缓存模块120中查找http://xxx.b+c.composite.css和http://xxx.d.composite.css对应的聚合的CSS子资源,将查找到的聚合的CSS子资源返回给客户端200。Specifically, the proxy module 110 parses out http://xxx.b+c.composite.css and http://xxx.d.composite.css, and searches for http://xxx.b+c in the caching module 120 The aggregated CSS sub-resource corresponding to .composite.css and http://xxx.d.composite.css returns the found aggregated CSS sub-resource to the client 200 .

参见图3,示出了根据本发明一个实施例的加载访问网页的风格样式表的客户端200的结构图。客户端200包括:通信模块210、解析模块220和加载模块230。Referring to FIG. 3 , it shows a structural diagram of a client 200 for loading a style sheet of an accessed web page according to an embodiment of the present invention. The client 200 includes: a communication module 210 , an analysis module 220 and a loading module 230 .

通信模块210,适于向服务器100发送网页访问请求,并接收服务器100返回的响应信息,所述响应信息为所述网页所属的网站返回的响应信息或所述服务器对其修改后的响应信息。The communication module 210 is adapted to send a web page access request to the server 100, and receive the response information returned by the server 100, the response information being the response information returned by the website to which the web page belongs or the response information modified by the server.

解析模块220,适于对响应信息进行解析。The parsing module 220 is adapted to parse the response information.

通信模块210,还适于根据解析出的内容向服务器100发送CSS子资源请求,并接收服务器100返回的CSS子资源。The communication module 210 is further adapted to send a CSS subresource request to the server 100 according to the parsed content, and receive the CSS subresource returned by the server 100 .

加载模块230,适于加载接收到的服务器100返回的CSS子资源。The loading module 230 is adapted to load the received CSS sub-resource returned by the server 100 .

参见图4,示出了根据本发明一个实施例的加载访问网页的风格样式表的系统的结构图。系统包括前述服务器100和多个前述客户端200。其中,服务器100和客户端200间可以直接连接,也可以通过网络连接,在此没有特别限制。Referring to FIG. 4 , it shows a structural diagram of a system for loading a style sheet of an accessed web page according to an embodiment of the present invention. The system includes the aforementioned server 100 and multiple aforementioned clients 200 . Wherein, the server 100 and the client 200 may be connected directly or through a network, and there is no special limitation here.

参见图5,示出了根据本发明一个实施例的处理风格样式表的方法的流程图。所述方法包括如下步骤。Referring to FIG. 5 , it shows a flowchart of a method for processing a style sheet according to an embodiment of the present invention. The method includes the following steps.

步骤S510,服务器将客户端的网页访问请求转发给请求访问的网页所属的网站,接收网站返回的响应信息。In step S510, the server forwards the webpage access request of the client to the website to which the requested webpage belongs, and receives the response information returned by the website.

步骤S520,服务器判断该服务器中是否已缓存该网页的风格样式表CSS子资源,如果是,则执行步骤S540,否则,执行步骤S530。Step S520, the server judges whether the style sheet CSS sub-resource of the web page has been cached in the server, if yes, execute step S540, otherwise, execute step S530.

步骤S530,服务器将接收的响应信息转发给所客户端,将客户端发送的CSS子资源请求转发给网站,接收到网站返回的CSS子资源后,将该CSS子资源转发给客户端,将CSS子资源进行优化并缓存在服务器中。Step S530, the server forwards the received response information to the client, forwards the CSS sub-resource request sent by the client to the website, and after receiving the CSS sub-resource returned by the website, forwards the CSS sub-resource to the client, and sends the CSS sub-resource to the client. Subresources are optimized and cached on the server.

在一具体实施例中,所述优化为去冗余。所述将CSS子资源进行优化包括:去除各个CSS子资源中的冗余信息。In a specific embodiment, the optimization is de-redundancy. The optimizing the CSS sub-resources includes: removing redundant information in each CSS sub-resource.

举例而言,服务器去除掉CSS子资源中的空白和注释。For example, the server strips whitespace and comments in CSS subresources.

通过去除各个CSS子资源中的冗余信息,能够在客户端获取CSS子资源时减少网络传输的流量,进一步提高网页访问速度,并节省客户端的网络流量。By removing redundant information in each CSS sub-resource, it is possible to reduce network transmission traffic when the client obtains the CSS sub-resource, further improve the web page access speed, and save the network traffic of the client.

在另一具体实施例中,所述优化为聚合。所述将CSS子资源进行优化包括:根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组;在每个分组中,将分组中的CSS子资源聚合为一个CSS子资源。In another specific embodiment, said optimization is aggregation. The optimizing the CSS sub-resources includes: grouping multiple CSS sub-resources according to the semantics and/or logic of the CSS sub-resources; in each group, aggregating the CSS sub-resources in the group into one CSS sub-resource.

举例而言,服务器分析各个CSS之间的相互关系。同一个网站的不同的CSS子资源间可能存在逻辑关系,根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组,使得分到同一组的CSS子资源聚合后不会存在语义和逻辑冲突。服务器将各组内的CSS聚合成一个CSS。例如,网页具有6个CSS子资源,编号1至6。服务器根据CSS子资源的语义和/或逻辑将6个CSS子资源分为三组,编号1-3的CSS子资源为一组,编号4和6的CSS子资源为一组,编号5的CSS子资源为一组,在3个组内分别进行聚合,由此,服务器将网站的6个CSS子资源聚合成3个CSS子资源。For example, the server analyzes the interrelationships among CSSs. There may be a logical relationship between different CSS sub-resources of the same website. According to the semantics and/or logic of CSS sub-resources, multiple CSS sub-resources are grouped so that there will be no semantic and logical relationship between CSS sub-resources grouped into the same group. Conflict of logic. The server aggregates the CSS in each group into one CSS. For example, a webpage has 6 CSS subresources, numbered 1 to 6. The server divides the 6 CSS sub-resources into three groups according to the semantics and/or logic of the CSS sub-resources. The CSS sub-resources numbered 1-3 form a group, the CSS sub-resources numbered 4 and 6 form a group, and the CSS sub-resources numbered 5 form a group. The sub-resources are grouped into one group, and are aggregated in three groups. Thus, the server aggregates the six CSS sub-resources of the website into three CSS sub-resources.

通过将多个CSS子资源进行聚合,能够在CSS子资源中信息不被损伤的情况下,减少客户端访问网页时TCP连接,从而进一步增加客户端访问网页的速度。By aggregating multiple CSS sub-resources, it is possible to reduce the TCP connections when the client accesses the webpage without damaging the information in the CSS sub-resources, thereby further increasing the speed of the client accessing the webpage.

此外,在进行CSS子资源聚合时,服务器开销会增加。可以通过配置列表的方式,对需要进行CSS子资源聚合的网站进行设置。例如,对于用户访问量较大的网站(如网址导航中排名前25的网站)进行CSS子资源聚合。而对一些访问量较小的网站,不再进行CSS子资源聚合。所以,服务器还可以根据设置的聚合网站列表,对列表中的网站的CSS子资源进行聚合。由此,可以达到灵活调整CSS子资源聚合的效果。Additionally, server overhead increases when doing CSS subresource aggregation. The website that needs to aggregate CSS sub-resources can be set by configuring the list. For example, aggregate CSS sub-resources for websites with a large number of user visits (such as the top 25 websites in website navigation). However, for some websites with relatively small visits, CSS sub-resource aggregation is no longer performed. Therefore, the server may also aggregate the CSS sub-resources of the websites in the list according to the set aggregation website list. In this way, the effect of flexibly adjusting CSS sub-resource aggregation can be achieved.

步骤S540,服务器根据该服务器中已缓存的内容对接收的响应信息进行修改,向客户端发送修改后的响应信息,接收到客户端发送的CSS子资源请求后,在该服务器中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给客户端。Step S540, the server modifies the received response information according to the content cached in the server, sends the modified response information to the client, and searches the server for the corresponding optimized resource request after receiving the CSS sub-resource request sent by the client. The optimized CSS sub-resource is returned to the client after finding the optimized CSS sub-resource.

在一具体实施例中,服务器为优化后的CSS子资源,生成对应的URL,记录访问的网页的URL与优化后的CSS子资源的URL的对应关系。In a specific embodiment, the server generates a corresponding URL for the optimized CSS sub-resource, and records the correspondence between the URL of the visited webpage and the URL of the optimized CSS sub-resource.

服务器在根据该服务器中已缓存的内容对接收的响应信息进行修改时,在记录的对应关系中查找访问的网页的URL,将响应信息中包含的CSS子资源的URL修改为对应的优化后的CSS子资源的URL。When the server modifies the received response information based on the cached content in the server, it searches for the URL of the visited web page in the corresponding relationship of the records, and modifies the URL of the CSS sub-resource contained in the response information to the corresponding optimized URL. The URL of the CSS subresource.

服务器在接收到客户端发送的CSS子资源请求后,根据CSS子资源请求中的优化后的CSS子资源的URL查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给客户端。After receiving the CSS subresource request sent by the client, the server searches for the corresponding optimized CSS subresource according to the URL of the optimized CSS subresource in the CSS subresource request, and returns the found optimized CSS subresource to the client.

此外,在另一具体实施例中,服务器在封装优化后的CSS子资源的报文的报文头中添加CSS节省字节字段,该CSS节省字节字段中填写优化后的CSS子资源与优化前的CSS子资源相比减少的字节数。In addition, in another specific embodiment, the server adds a CSS saving byte field in the packet header of the packet encapsulating the optimized CSS sub-resource, and the CSS saving byte field is filled with the optimized CSS sub-resource and the optimized The number of bytes reduced compared to the previous CSS subresource.

CSS子资源优化能够节省流量,因此通过报文的报文头中添加CSS节省字节字段,例如CSS-Save-Bytes字段,能够使用户知晓此次访问网页中客户端所节省的字节数。CSS sub-resource optimization can save traffic, so by adding a CSS-saved byte field, such as the CSS-Save-Bytes field, in the header of the message, the user can know the number of bytes saved by the client during this visit to the web page.

通过本发明实施例中技术方案,能够减少在加载网页时客户端与网站间建立的TCP连接的数量,从而解决了由于客户端与网站建立的TCP连接过多而导致的网页加载速度缓慢,加载时间过长的问题;取得了加快客户端的网页加载速度,以及减少网站的系统任务负担和通信传输负担的有益效果。Through the technical solution in the embodiment of the present invention, it is possible to reduce the number of TCP connections established between the client and the website when loading the webpage, thereby solving the slow loading speed of the webpage caused by too many TCP connections established between the client and the website. The problem of too long time; the beneficial effects of accelerating the webpage loading speed of the client and reducing the system task burden and communication transmission burden of the website have been achieved.

以下以客户端访问URL为http://www.a.com的网页为例,对本发明的处理风格样式表的服务器进行举例说明。The server for processing the style sheet of the present invention will be illustrated below by taking the webpage accessed by the client with the URL http://www.a.com as an example.

其中,所述客户端可以为手机终端中浏览器,也可以为PC(个人电脑,PersonalComputer)终端中浏览器,或者其他网页访问请求方,在此没有特别限制。Wherein, the client may be a browser in a mobile terminal, or a browser in a PC (Personal Computer, Personal Computer) terminal, or other web page access requesting party, and there is no special limitation here.

当客户端请求访问http://www.a.com时,客户端向服务器发送网页访问请求。参见图6,示出了根据本发明一个实施例的客户端首次通过服务器访问网站时,服务器的操作流程图。When the client requests to access http://www.a.com, the client sends a webpage access request to the server. Referring to FIG. 6 , it shows an operation flowchart of the server when the client accesses the website through the server for the first time according to an embodiment of the present invention.

步骤S610,服务器接收客户端发送的网页访问请求,将客户端的网页访问请求转发给请求访问的网页所属网站。Step S610, the server receives the web page access request sent by the client, and forwards the web page access request from the client to the website to which the web page requested to access belongs.

步骤S620,服务器接收网站返回的响应信息,判断出该服务器中没有缓存该网页的CSS子资源,将接收的响应信息转发给客户端。Step S620, the server receives the response information returned by the website, determines that the server does not cache the CSS sub-resource of the webpage, and forwards the received response information to the client.

客户端收到http://www.a.com的网页响应后,解析网页内容得到网页中的外部CSS子资源,该些CSS子资源的URL分别为http://xxx.b.css,http://xxx.c.css和http://xxx.d.css。客户端向服务器发送包括上述URL的CSS子资源请求。After receiving the web page response from http://www.a.com, the client parses the content of the web page to obtain the external CSS sub-resources in the web page. The URLs of these CSS sub-resources are http://xxx.b.css and http://xxx.b.css respectively. ://xxx.c.css and http://xxx.d.css. The client sends a CSS subresource request including the URL above to the server.

步骤S630,服务器接收到客户端发送的CSS子资源请求,将该CSS子资源请求转发给网站,接收网站返回的CSS子资源,执行步骤S640和步骤S650。In step S630, the server receives the CSS sub-resource request sent by the client, forwards the CSS sub-resource request to the website, receives the CSS sub-resource returned by the website, and executes steps S640 and S650.

步骤S640,服务器将接收的网站返回的CSS子资源转发给客户端。Step S640, the server forwards the received CSS sub-resource returned by the website to the client.

客户端接收到服务器转发的CSS子资源,使用该CSS子资源进行网页渲染。The client receives the CSS sub-resource forwarded by the server, and uses the CSS sub-resource to render the webpage.

步骤S650,服务器将网站返回的网页的CSS子资源进行优化,并缓存优化后的CSS子资源,以及为优化后的CSS子资源,生成对应的URL,记录访问的网页的URL与优化后的CSS子资源的URL的对应关系。Step S650, the server optimizes the CSS sub-resources of the webpage returned by the website, caches the optimized CSS sub-resources, generates a corresponding URL for the optimized CSS sub-resources, and records the URL of the accessed webpage and the optimized CSS The correspondence between URLs of subresources.

具体而言,服务器对网站返回的http://xxx.b.css,http://xxx.c.css和http://xxx.d.css对应的3个CSS子资源进行去冗余操作,然后将去冗余后的3个CSS子资源进行聚合。服务器将http://xxx.b.css和http://xxx.c.css分为一组,将http://xxx.d.css分为另一组,将每组中CSS子资源聚合成一个CSS子资源,聚合后的CSS子资源对应的URL分别为http://xxx.b+c.composite.css和http://xxx.d.composite.css。服务器记录http://www.a.com与http://xxx.b+c.composite.css和http://xxx.d.composite.css之间的对应关系。Specifically, the server performs redundant operations on the three CSS sub-resources corresponding to http://xxx.b.css, http://xxx.c.css and http://xxx.d.css returned by the website , and then aggregate the three CSS sub-resources after de-redundancy. The server divides http://xxx.b.css and http://xxx.c.css into one group, divides http://xxx.d.css into another group, and aggregates CSS sub-resources in each group into a CSS sub-resource, and the URLs corresponding to the aggregated CSS sub-resources are http://xxx.b+c.composite.css and http://xxx.d.composite.css respectively. The server records the correspondence between http://www.a.com and http://xxx.b+c.composite.css and http://xxx.d.composite.css.

当客户端再次通过服务器访问http://www.a.com时,客户端向服务器发送网页访问请求。参见图7,示出了根据本发明一个实施例的客户端再次通过服务器访问网站时,服务器的操作流程图。When the client accesses http://www.a.com through the server again, the client sends a webpage access request to the server. Referring to FIG. 7 , it shows an operation flowchart of the server when the client accesses the website through the server again according to an embodiment of the present invention.

步骤S710,服务器接收客户端发送的网页访问请求,将网页访问请求转发给请求访问的网页所属网站,接收网站返回的响应信息,判断出该服务器中已缓存该网页的CSS子资源。Step S710, the server receives the webpage access request sent by the client, forwards the webpage access request to the website to which the requested webpage belongs, receives the response information returned by the website, and determines that the CSS sub-resource of the webpage has been cached in the server.

步骤S720,服务器根据记录访问的网页的URL与优化后的CSS子资源的URL的对应关系,对接收的网站返回的响应信息进行修改。In step S720, the server modifies the received response information returned by the website according to the recorded correspondence between the URL of the visited webpage and the URL of the optimized CSS sub-resource.

具体而言,服务器在记录的对应关系中查找http://www.a.com,将响应信息中包含的http://xxx.b.css和http://xxx.c.css修改为http://xxx.b+c.composite.css,将响应信息中包含的http://xxx.d.css修改为http://xxx.d.composite.css。Specifically, the server searches for http://www.a.com in the corresponding relationship of records, and modifies http://xxx.b.css and http://xxx.c.css included in the response information to http://xxx.c.css ://xxx.b+c.composite.css, modify http://xxx.d.css contained in the response information to http://xxx.d.composite.css.

步骤S730,服务器将修改后的响应信息发送给客户端。Step S730, the server sends the modified response information to the client.

客户端接收到服务器发送的响应信息,解析出外部CSS子资源对应的URL分别为http://xxx.b+c.composite.css和http://xxx.d.composite.cs,向服务器发送包括上述URL的CSS子资源请求。The client receives the response information sent by the server, parses out that the URLs corresponding to the external CSS sub-resources are http://xxx.b+c.composite.css and http://xxx.d.composite.cs, and sends them to the server A CSS subresource request including the above URL.

步骤S740,服务器接收到客户端发送的CSS子资源请求后,解析出优化后的CSS子资源的URL,根据该URL查找到优化后的CSS子资源,将该CSS子资源返回给客户端。Step S740: After receiving the CSS sub-resource request sent by the client, the server parses out the URL of the optimized CSS sub-resource, finds the optimized CSS sub-resource according to the URL, and returns the CSS sub-resource to the client.

具体而言,服务器接收到客户端发送的CSS子资源请求后,解析出http://xxx.b+c.composite.css和http://xxx.d.composite.css,查找http://xxx.b+c.composite.css和http://xxx.d.composite.css对应的聚合的CSS子资源,将查找到的聚合的CSS子资源返回给客户端。Specifically, after receiving the CSS subresource request sent by the client, the server parses out http://xxx.b+c.composite.css and http://xxx.d.composite.css, and searches for http:// The aggregated CSS sub-resource corresponding to xxx.b+c.composite.css and http://xxx.d.composite.css returns the found aggregated CSS sub-resource to the client.

参见图8,示出了根据本发明一个实施例的在客户端加载访问网页的风格样式表的方法的流程图。所述方法包括如下步骤。Referring to FIG. 8 , it shows a flow chart of a method for loading a style sheet of an accessed webpage on a client side according to an embodiment of the present invention. The method includes the following steps.

步骤S810,客户端向服务器发送网页访问请求。Step S810, the client sends a webpage access request to the server.

步骤S820,客户端接收服务器返回的响应信息,所述响应信息为所述网页所属的网站返回的响应信息或所述服务器对其修改后的响应信息。Step S820, the client receives the response information returned by the server, where the response information is the response information returned by the website to which the webpage belongs or the modified response information by the server.

步骤S830,客户端对响应信息进行解析,根据解析出的内容向服务器发送CSS子资源请求。Step S830, the client parses the response information, and sends a CSS sub-resource request to the server according to the parsed content.

步骤S840,客户端接收服务器返回的CSS子资源,加载该CSS子资源。Step S840, the client receives the CSS sub-resource returned by the server, and loads the CSS sub-resource.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings), as well as any method or method so disclosed, may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的处理风格样式表的服务器、客户端和系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all of the components in the server, client, and system for processing style sheets according to the embodiments of the present invention. Some or all functions. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

本发明实施例公开了A1、一种处理风格样式表的方法,所述方法包括:服务器将客户端的网页访问请求转发给请求访问的网页所属的网站,接收所述网站返回的响应信息,判断所述服务器中是否已缓存所述网页的风格样式表CSS子资源,如果所述服务器中未缓存所述网页的CSS子资源,则服务器将接收的响应信息转发给所述客户端,将所述客户端发送的CSS子资源请求转发给所述网站,接收到所述网站返回的CSS子资源后,将所述CSS子资源转发给所述客户端,将所述CSS子资源进行优化并缓存在所述服务器中;如果所述服务器中已缓存所述网页的CSS子资源,则服务器根据所述服务器中已缓存的内容对接收的响应信息进行修改,向所述客户端发送修改后的响应信息,接收到所述客户端发送的CSS子资源请求后,在所述服务器中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给所述客户端。A2、根据A1所述的方法,其中,将所述CSS子资源进行优化包括:去除各个CSS子资源中的冗余信息。A3、根据A1或A2所述的方法,其中,所述将所述CSS子资源进行优化包括:根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组;在每个分组中,将分组中的CSS子资源聚合为一个CSS子资源。A4、根据A1所述的方法,其中,将所述CSS子资源进行优化包括:为优化后的CSS子资源,生成对应的URL;记录访问的网页的URL与优化后的CSS子资源的URL的对应关系。A5、根据A4所述的方法,其中,所述服务器根据所述服务器中已缓存的内容对接收的响应信息进行修改包括:在记录的对应关系中查找访问的网页的URL,将响应信息中包含的CSS子资源的URL修改为对应的优化后的CSS子资源的URL。A6、根据A1至A5任一项所述的方法,其中,所述将查找到的优化后的CSS子资源返回给所述客户端包括:在封装优化后的CSS子资源的报文的报文头中添加CSS节省字节字段,该CSS节省字节字段中为优化后的CSS子资源与优化前的CSS子资源相比减少的字节数。The embodiment of the present invention discloses A1. A method for processing a style sheet. The method includes: the server forwards the client's webpage access request to the website to which the requested webpage belongs, receives the response information returned by the website, and determines the Whether the style sheet CSS sub-resource of the web page has been cached in the server, if the CSS sub-resource of the web page is not cached in the server, the server forwards the received response information to the client, and the client The CSS sub-resource request sent by the client is forwarded to the website, and after receiving the CSS sub-resource returned by the website, the CSS sub-resource is forwarded to the client, and the CSS sub-resource is optimized and cached in the In the server; if the CSS sub-resource of the web page has been cached in the server, the server modifies the received response information according to the cached content in the server, and sends the modified response information to the client, After receiving the CSS sub-resource request sent by the client, search for the corresponding optimized CSS sub-resource in the server, and return the found optimized CSS sub-resource to the client. A2. The method according to A1, wherein optimizing the CSS sub-resources includes: removing redundant information in each CSS sub-resource. A3. The method according to A1 or A2, wherein said optimizing the CSS sub-resources includes: grouping multiple CSS sub-resources according to the semantics and/or logic of the CSS sub-resources; in each group, Aggregate the CSS sub-resources in the group into one CSS sub-resource. A4. The method according to A1, wherein optimizing the CSS sub-resources includes: generating a corresponding URL for the optimized CSS sub-resources; recording the URL of the visited webpage and the URL of the optimized CSS sub-resources corresponding relationship. A5. The method according to A4, wherein the modifying the received response information by the server according to the content cached in the server includes: searching for the URL of the visited webpage in the corresponding relationship of records, and including the response information in the response information. The URL of the CSS sub-resource is changed to the URL of the corresponding optimized CSS sub-resource. A6. The method according to any one of A1 to A5, wherein the returning the found optimized CSS sub-resource to the client includes: encapsulating the message of the optimized CSS sub-resource A CSS saved bytes field is added to the header, and the CSS saved bytes field is the number of bytes reduced by the optimized CSS sub-resource compared with the unoptimized CSS sub-resource.

本发明实施例还公开了B7、一种在客户端加载访问网页的风格样式表的方法,所述方法包括:客户端向服务器发送网页访问请求,并接收服务器返回的响应信息,所述响应信息为所述网页所属的网站返回的响应信息或所述服务器对其修改后的响应信息;客户端对响应信息进行解析,根据解析出的内容向服务器发送CSS子资源请求,并接收服务器返回的CSS子资源,加载该CSS子资源。The embodiment of the present invention also discloses B7, a method for loading and accessing a web page style sheet on the client side, the method includes: the client sends a web page access request to the server, and receives the response information returned by the server, the response information The response information returned by the website to which the web page belongs or the modified response information of the server; the client parses the response information, sends a CSS subresource request to the server according to the parsed content, and receives the CSS returned by the server Subresource, load the CSS subresource.

本发明实施例还公开了C8、一种处理风格样式表的服务器,所述服务器包括:代理模块、缓存模块和风格样式表CSS资源优化模块,所述代理模块,适于将客户端的网页访问请求转发给请求访问的网页所属网站,接收所述网站返回的响应信息,判断所述缓存模块中是否已缓存所述网页的CSS子资源,将判断结果通知给所述CSS资源优化模块;所述代理模块,还适于在判断结果为所述缓存模块中未缓存所述网页的CSS子资源时,将接收的响应信息转发给所述客户端,接收所述客户端发送的CSS子资源请求,将所述CSS子资源请求转发给所述网站,接收所述网站返回的CSS子资源,并将所述CSS子资源转发给所述客户端;所述CSS资源优化模块具体包括:CSS优化子模块和CSS修改子模块;所述CSS优化子模块,适于在判断结果为所述缓存模块中未缓存所述网页的CSS子资源时,将从网站接收的CSS子资源进行优化,并缓存到所述缓存模块;所述CSS修改子模块,适于在判断结果为所述缓存模块中已缓存所述网页的CSS子资源时,根据所述缓存模块中已缓存的内容对接收的网站返回的响应信息进行修改;所述代理模块,还适于将所述修改后的响应信息发送给所述客户端,接收到所述客户端发送的CSS子资源请求后,在所述缓存模块中查找对应的优化后的CSS子资源,将查找到的优化后的CSS子资源返回给所述客户端。所述缓存模块,适于缓存优化后的CSS子资源。C9、根据C8所述的服务器,其中,所述CSS优化子模块,适于去除各个CSS子资源中的冗余信息。C10、根据C8或C9所述的服务器,其中,所述CSS优化子模块,适于根据CSS子资源的语义和/或逻辑,将多个CSS子资源分组,在每个分组中,将分组中的CSS子资源聚合为一个CSS子资源。C11、根据C8所述的服务器,其中,所述CSS优化子模块,适于为优化后的CSS子资源,生成对应的URL,记录访问的网页的URL与优化后的CSS子资源的URL的对应关系,将优化后的CSS子资源缓存到所述缓存模块。C12、根据C11所述的服务器,其中,所述CSS修改子模块,适于在记录的对应关系中查找访问的网页的URL,将响应信息中包含的CSS子资源的URL修改为对应的优化后的CSS子资源的URL。C13、根据C8至C12任一项所述的服务器,其中,所述代理模块,适于在封装优化后的CSS子资源的报文的报文头中添加CSS节省字节字段,该CSS节省字节字段中填写优化后的CSS子资源与优化前的CSS子资源相比减少的字节数。The embodiment of the present invention also discloses C8, a server for processing style sheets. The server includes: a proxy module, a caching module, and a style sheet CSS resource optimization module. Forwarding to the website to which the webpage that requests access belongs, receiving the response information returned by the website, judging whether the CSS sub-resource of the webpage has been cached in the caching module, and notifying the CSS resource optimization module of the judging result; The module is further adapted to forward the received response information to the client when the judgment result is that the CSS sub-resource of the web page is not cached in the caching module, receive the CSS sub-resource request sent by the client, and send The CSS sub-resource request is forwarded to the website, the CSS sub-resource returned by the website is received, and the CSS sub-resource is forwarded to the client; the CSS resource optimization module specifically includes: CSS optimization sub-module and CSS modification sub-module; the CSS optimization sub-module is adapted to optimize the CSS sub-resources received from the website and cache them in the Cache module: the CSS modification sub-module is adapted to respond to the received website according to the cached content in the cache module when the judgment result is that the CSS sub-resource of the web page has been cached in the cache module Modify; the proxy module is also adapted to send the modified response information to the client, and after receiving the CSS sub-resource request sent by the client, search for the corresponding optimization in the cache module The optimized CSS sub-resource is returned to the client after finding the optimized CSS sub-resource. The caching module is suitable for caching optimized CSS sub-resources. C9. The server according to C8, wherein the CSS optimization submodule is adapted to remove redundant information in each CSS sub-resource. C10. The server according to C8 or C9, wherein the CSS optimization submodule is adapted to group multiple CSS sub-resources according to the semantics and/or logic of CSS sub-resources, and in each group, group The CSS subresources are aggregated into one CSS subresource. C11. The server according to C8, wherein the CSS optimization submodule is adapted to generate a corresponding URL for the optimized CSS sub-resource, and record the correspondence between the URL of the visited webpage and the URL of the optimized CSS sub-resource Relationship, cache the optimized CSS sub-resources to the caching module. C12. The server according to C11, wherein the CSS modification submodule is adapted to search for the URL of the visited webpage in the corresponding relationship of the record, and modify the URL of the CSS sub-resource contained in the response information to the corresponding optimized URL. The URL of the CSS subresource. C13. The server according to any one of C8 to C12, wherein the proxy module is adapted to add a CSS saving byte field in the packet header of the packet that encapsulates the optimized CSS sub-resource, and the CSS saving byte In the section field, fill in the number of bytes reduced between the optimized CSS sub-resource and the un-optimized CSS sub-resource.

本发明实施例还公开了D14、一种加载访问网页的风格样式表的客户端,所述客户端包括:通信模块,适于向服务器发送网页访问请求,并接收服务器返回的响应信息,所述响应信息为所述网页所属的网站返回的响应信息或所述服务器对其修改后的响应信息;解析模块,适于对响应信息进行解析;所述通信模块,还适于根据解析出的内容向服务器发送CSS子资源请求,并接收服务器返回的CSS子资源;加载模块,适于加载接收到的服务器返回的CSS子资源。The embodiment of the present invention also discloses D14, a client that loads a style sheet for accessing webpages, the client includes: a communication module, adapted to send a webpage access request to the server, and receive response information returned by the server, the The response information is the response information returned by the website to which the webpage belongs or the response information modified by the server; the parsing module is adapted to parse the response information; the communication module is also adapted to submit the parsed content to The server sends a CSS sub-resource request, and receives the CSS sub-resource returned by the server; the loading module is suitable for loading the received CSS sub-resource returned by the server.

根据本发明的实施例公开了E15、一种加载访问网页的风格样式表的系统,所述系统包括:如C8至C13任一项所述的服务器,以及如权利要求D14所述的客户端。According to the embodiment of the present invention, E15 is disclosed, a system for loading style sheets of accessed webpages, said system comprising: the server described in any one of C8 to C13, and the client described in claim D14.

Claims (13)

1. the method processing style design table, described method includes:
Whether the web access requests of client is transmitted to the website belonging to webpage that request accesses by server, receives the response message that described website returns, it is judged that the style design table CSS child resource of webpage described in buffer memory in described server,
If the CSS child resource of uncached described webpage in described server, then the response message of reception is transmitted to described client by server, the CSS child resource request described client sent is transmitted to described website, after receiving the CSS child resource that described website returns, described CSS child resource is transmitted to described client, described CSS child resource is optimized and is buffered in described server;
If the CSS child resource of webpage described in buffer memory in described server, then server according in described server buffer memory content to receive response message modify, amended response message is sent to described client, after receiving the CSS child resource request that described client sends, described server is searched the CSS child resource after the optimization of correspondence, the CSS child resource after the optimization found is returned to described client;
Described CSS child resource after the optimization found returned to described client include:
Adding CSS in the heading of the message of the CSS child resource after encapsulation optimizes and save byte field, this CSS saves the byte number of minimizing compared with the CSS child resource before optimizing of the CSS child resource after filling in optimization in byte field.
2. method according to claim 1, wherein,
Described CSS child resource is optimized and includes:
Remove the redundancy in each CSS child resource.
3. method according to claim 1 and 2, wherein,
Described being optimized by described CSS child resource includes:
Multiple CSS child resources are grouped by semanteme according to CSS child resource and/or logic;
In each packet, the CSS child resource in packet is polymerized to a CSS child resource.
4. method according to claim 1, wherein,
Described CSS child resource is optimized and includes:
For the CSS child resource after optimizing, the URL that generation is corresponding;
The corresponding relation of the URL of the CSS child resource after the URL of the webpage of record access and optimization.
5. method according to claim 4, wherein,
Described server according in described server the content of buffer memory the response message received is modified and is included:
The corresponding relation of record is searched the URL of the webpage of access, the URL of the CSS child resource comprised in response message is revised as the URL of the CSS child resource after the optimization of correspondence.
6. the method loading, in client, the style design table accessing webpage, described method includes:
User end to server sends web access requests, and receives the response message that server returns, and described response message is that the response message that returns of website belonging to described webpage or described server are to its amended response message;
Response message is resolved by client, sends the request of CSS child resource according to the content parsed to server, and receives the CSS child resource that server returns, loads this CSS child resource;
Wherein, the CSS child resource receiving server return includes: receive the message encapsulating the CSS child resource after optimizing that server returns, being added with CSS in the heading of this message and save byte field, this CSS saves the byte number of minimizing compared with the CSS child resource before optimizing of the CSS child resource after filling in optimization in byte field.
7. processing a server for style design table, described server includes: proxy module, cache module and style design table CSS resource optimization module,
Described proxy module, be suitable to the web access requests of client is transmitted to the webpage affiliated web site that request accesses, receive the response message that described website returns, it is judged that the CSS child resource of whether webpage described in buffer memory in described cache module, will determine that result informs described CSS resource optimization module;
Described proxy module, it is further adapted for when the CSS child resource that judged result is uncached described webpage in described cache module, the response message of reception is transmitted to described client, receive the CSS child resource request that described client sends, the request of described CSS child resource is transmitted to described website, receive the CSS child resource that described website returns, and described CSS child resource is transmitted to described client;
Described CSS resource optimization module specifically includes: CSS optimizes submodule and CSS revises submodule;
Described CSS optimizes submodule, is suitable to, when the CSS child resource that judged result is uncached described webpage in described cache module, be optimized by the CSS child resource received from website, and be cached to described cache module;
Described CSS revises submodule, is suitable to, when the CSS child resource that judged result is webpage described in buffer memory in described cache module, modify according to the response message that in described cache module, the content of the buffer memory website to receiving has returned;
Described proxy module, it is further adapted for described amended response message is sent to described client, after receiving the CSS child resource request that described client sends, described cache module is searched the CSS child resource after the optimization of correspondence, the CSS child resource after the optimization found is returned to described client;
Described cache module, is suitable to the CSS child resource after cache optimization;
Described proxy module, is further adapted in the heading of the message of the CSS child resource encapsulated after optimizing and adds CSS saving byte field, and this CSS saves the byte number of minimizing compared with the CSS child resource before optimization of the CSS child resource after filling in optimization in byte field.
8. server according to claim 7, wherein,
Described CSS optimizes submodule, is suitable to remove the redundancy in each CSS child resource.
9. the server according to claim 7 or 8, wherein,
Described CSS optimizes submodule, is suitable to the semanteme according to CSS child resource and/or logic, is grouped by multiple CSS child resources, in each packet, the CSS child resource in packet is polymerized to a CSS child resource.
10. server according to claim 7, wherein,
Described CSS optimizes submodule, is suitable for the CSS child resource after optimization, the corresponding relation of the URL of the CSS child resource after generating corresponding URL, the URL of the webpage of record access and optimizing, and the CSS child resource after optimizing is cached to described cache module.
11. server according to claim 10, wherein,
Described CSS revises submodule, is suitable to search the URL of the webpage of access in the corresponding relation of record, and the URL of the CSS child resource comprised in response message is revised as the URL of the CSS child resource after the optimization of correspondence.
12. load a client for the style design table accessing webpage, described client includes:
Communication module, is suitable to send web access requests to server, and receives the response message that server returns, and described response message is that the response message that returns of website belonging to described webpage or described server are to its amended response message;
Parsing module, is suitable to response message is resolved;
Described communication module, is further adapted for sending the request of CSS child resource according to the content parsed to server, and receives the CSS child resource that server returns;
Load-on module, is suitable to load the CSS child resource that the server received returns;
Wherein, described communication module, being suitable to the message of the CSS child resource after receiving the encapsulation optimization that server returns, be added with CSS and save byte field in the heading of this message, this CSS saves the byte number of minimizing compared with the CSS child resource before optimizing of the CSS child resource after filling in optimization in byte field.
13. load a system for the style design table accessing webpage, described system includes:
Server as described in any one of claim 7 to 11, and
Client as claimed in claim 12.
CN201310215270.XA 2013-05-31 2013-05-31 Process the method for style design table, server, client and system Expired - Fee Related CN103258056B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310215270.XA CN103258056B (en) 2013-05-31 2013-05-31 Process the method for style design table, server, client and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310215270.XA CN103258056B (en) 2013-05-31 2013-05-31 Process the method for style design table, server, client and system

Publications (2)

Publication Number Publication Date
CN103258056A CN103258056A (en) 2013-08-21
CN103258056B true CN103258056B (en) 2016-06-29

Family

ID=48961973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310215270.XA Expired - Fee Related CN103258056B (en) 2013-05-31 2013-05-31 Process the method for style design table, server, client and system

Country Status (1)

Country Link
CN (1) CN103258056B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9477774B2 (en) * 2013-09-25 2016-10-25 Akamai Technologies, Inc. Key resource prefetching using front-end optimization (FEO) configuration
US9330074B2 (en) * 2013-10-31 2016-05-03 Google Inc. Style sheet speculative preloading
CN104750679B (en) * 2013-12-25 2020-01-24 明博教育科技有限公司 A resource loading method in a web document editor
CN105100099A (en) * 2015-07-29 2015-11-25 北京京东尚科信息技术有限公司 Intelligent watch and website access request processing method thereon
CN106484823A (en) * 2016-09-28 2017-03-08 山东浪潮商用系统有限公司 A kind of amending method of CSS file, device and computer-readable medium
CN107172447B (en) * 2017-05-31 2019-12-27 成都博视美达文化传播有限公司 Data loading method and device
CN107608745A (en) * 2017-09-07 2018-01-19 郑州云海信息技术有限公司 A kind of method and apparatus for accelerating page loading velocity

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539932A (en) * 2009-01-21 2009-09-23 北京跳网无限科技发展有限公司 Synchronization access technology of transforming web page
CN102456035A (en) * 2010-10-28 2012-05-16 金蝶软件(中国)有限公司 Webpage resource cache control method, device and system
CN102710748A (en) * 2012-05-02 2012-10-03 华为技术有限公司 Data acquisition method, system and equipment
CN102792292A (en) * 2009-12-07 2012-11-21 考持·维 System and method for site performance optimization and Internet traffic processing
CN102981705A (en) * 2012-11-09 2013-03-20 北京奇虎科技有限公司 Server-side browser implementing method and server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003026216A1 (en) * 2001-09-14 2003-03-27 Sony Corporation Network information processing system and network information processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539932A (en) * 2009-01-21 2009-09-23 北京跳网无限科技发展有限公司 Synchronization access technology of transforming web page
CN102792292A (en) * 2009-12-07 2012-11-21 考持·维 System and method for site performance optimization and Internet traffic processing
CN102456035A (en) * 2010-10-28 2012-05-16 金蝶软件(中国)有限公司 Webpage resource cache control method, device and system
CN102710748A (en) * 2012-05-02 2012-10-03 华为技术有限公司 Data acquisition method, system and equipment
CN102981705A (en) * 2012-11-09 2013-03-20 北京奇虎科技有限公司 Server-side browser implementing method and server

Also Published As

Publication number Publication date
CN103258056A (en) 2013-08-21

Similar Documents

Publication Publication Date Title
CN103258056B (en) Process the method for style design table, server, client and system
CN103269377B (en) Process the method for script file, server, client and system
CN103281387B (en) Method, server, client side and system for processing child resources in web page
CN103701714B (en) Page extraction, server and network system
CN102929984B (en) Inefficacy address searching method and apparatus
US20100146415A1 (en) Dns prefetch
US20150189036A1 (en) Offline caching method and apparatus
JP6328233B2 (en) Computer program product, system and method for optimizing web page loading
CN107025234A (en) A kind of information-pushing method and caching server
CN102438045A (en) Method and system for pre-fetching web page, and method for accessing web page
CN102970384B (en) Proxy server and communication system
CN103220371A (en) Method and system for conducting content adaptation
CN103678508A (en) Method and device for opening a webpage
CN102932473B (en) The method of cross operator access to netwoks Web content
Pande et al. Enhanced web application and browsing performance through service-worker infusion framework
CN103731493A (en) Page transmission method, device and system
CN112243013A (en) A method, system, server and storage medium for realizing cross-domain resource caching
CN105704171A (en) System and method for realizing content delivery network (CDN) access
CN103618799B (en) Browser rs cache processing method, system and proxy server
CN103067500B (en) Web browsing method based on cloud terminal
CN102368250B (en) Page downloading control method and system for IE (Internet Explore) kernel browser
CN104980464B (en) A kind of network request processing method, network server and network system
CN106911732A (en) A kind of website visiting accelerating method and device
CN106411978B (en) Resource caching method and device
CN104679688B (en) Data access method, apparatus 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
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220726

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160629