DC. Web. HttpCompress compression module source code analysis (1)

Source: Internet
Author: User

From today on, I will take a look at the source code of the DC. Web. HttpCompress compression module. I also hope you can discuss it together ~

1. First, let's talk about the entire process. We all know that the following things will happen after you click the URL on the page in the browser:

 

 

The browser sends an http request to the server. The server finds the page and returns it to the browser. After the browser downloads the file, it starts to load and render the Html file. If it encounters css, The js reference will send a request again to download the css and js files, we just need to make some "Hands and feet" when requesting pages and css and js files ".

2. Since we are doing something when processing requests, we must be familiar with the processing process of asp.net and demonstrate this process well.

 

 

When we request an aspxpage from the server, the HTTP request will be captured by the inetinfo.exe process and handed over to your own registered ISAPI. By default, aspx processes the ISAPI aspnet_isapi.dll. Aspnet_isapi.dll sends the request to the ASPNET_WP.EXE process through an Http PipeLine (PipeLine). Then, the framework processes the request through HttpRuntime and returns the result to the client after processing.

When an http request is sent to HttpRuntime, the request continues to be sent to the HttpApplication Factory Container, which provides an HttpApplication instance to process the request, go to HttpModule> HttpHandler Factory> HttpHandler.

After the process of the ProcessRequest method in HttpHandler is complete, the entire HttpRequest process is complete ~~

3. How should we design the process to implement the compression module?

I would like to raise two points for you to think about first, and the next article begins to enter the source code stage.

A) each request is sent to an HttpHandler, which is also the best place to process the request.

B) You can register every event in the lifecycle in HttpModule. Similar

    

Public void Init (HttpApplication app) {app. BeginRequest + = new EventHandler (app_BeginRequest);} copy the code
4. Think about time ..........................

From → technical life tips

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.