Common development issues with WebKit browsers

Source: Internet
Author: User
Tags ranges

Some time ago someone asked me a simple question, how does HTML create parsing?

I told a whole bunch of what passed Documentloader, Cachedresourceloader,

Cacheresource, Resourceloaderscheduler, resourcehandle these classes.

A step-by-step cache lookup is then requested for download and so on.

Until I debug my XML parsing, I find that a lot of problems are inconsistent with understanding,

In the analysis of the source of the time only to understand the overall steps. Do you really know the details?

First, HTTP header Web header request

Requests Part (list several important ones)

Accept

Specify what types of content clients can receive

Accept:text/plain, text/html

Accept-charset

The set of character encodings that the browser can accept.

Accept-charset:iso-8859-5

Accept-encoding

Specifies that the Web server that the browser can support returns the content compression encoding type.

Accept-encoding:compress, gzip

Accept-language

Browser-acceptable language

Accept-language:en,zh

Connection

Indicates whether a persistent connection is required. (HTTP 1.1 defaults to persistent connection)

Connection:close

Cookies

When an HTTP request is sent, all cookie values stored under that request domain are sent to the Web server.

Cookie: $Version = 1; Skin=new;

Content-length

The requested content length

content-length:537

Content-type

The requested MIME information corresponding to the entity

content-type:application/x-www-form-urlencoded

Date

Date and time the request was sent

Date:tue, 15:12:31 GMT

User-agent

The content of the user-agent contains the user information that made the request

user-agent:mozilla/5.0 (Linux; X11)

Responses part

Accept-ranges

Indicates whether the server supports the specified range request and what kind of staging request

Accept-ranges:bytes

Age

Estimated time (in seconds, non-negative) from the original server to the proxy cache

Age:12

Allow

A valid request behavior for a network resource is not allowed to return 405

Allow:get, HEAD

Cache-control

Tell if all caching mechanisms can be cached and which type

Cache-control:no-cache

Content-encoding

The type of return content compression encoding supported by the Web server.

Content-encoding:gzip

Content-language

The language of the response body

Content-language:en,zh

Content-length

The length of the response body

content-length:348

Content-location

Alternate alternative address to request resource substitution

Content-location:/index.htm

Content-md5

Returns the MD5 checksum value of a resource

content-md5:q2hly2sgsw50zwdyaxr5iq==

Content-range

The byte position of this section in the entire return body

Content-range:bytes 21010-47021/47022

Content-type

Returns the MIME type of the content

content-type:text/html; Charset=utf-8

Date

Time the original server message was issued

Date:tue, 15:12:31 GMT

Location

Used to redirect the receiver to the location of the non-request URL to complete the request or identify the new resource

Location:http://www.oschina.net/u/2335812/admin


User-agent This field user information, indicating that your browser supports the standard, the server resolves the field to return different requests

(a Web page that is compatible with multiple terminals will be treated with compatibility) This is especially important in IPTV,

Many times some front-end Web page is to add some special fields to normal operation is very depressed.

The HTTP request header can convey more information.

Second, WebKit How to distinguish the creation of html,xml and other analysis

It is determined by the Content-type field in the $ OK returned by the HTTP request,

content-type:text/html; Charset=utf-8,

Describes the text type HTML, character encoding utf-8.

Determines whether the type is html,xml when CreateDocument () is created in DOMImplementation.cpp.

This type, such as video, is parsed by Content-type in the request return OK field.

Third, request redirection

Redirect is the URL returned in the Location field of the 302 found returned by the HTTP request determines the new address of the jump

Iv. Setting the load cache size

In the Loader/cache/memorycache.cpp file, the Setcapacities () function can set the cache size,

Find a balance point where a resource is loaded at a speed of memory usage

There are a lot of small details like that, and you can tell us about your problems.

Thank you for your reading and look forward to seeing you next time:

If you have any questions about this technology and want to get the tools for the technology that this article is talking about, get the article updated the first time, publish an original article of the technology Daniel Daily, and share more technical information .

Welcome to the personal public platform : Programmer Interaction Alliance, sweep the QR code or search number below Coder_online can follow , Online to help you solve technical difficulties, to Daniel directly spot.

Common development issues with WebKit browsers

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.