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 spoke a great heap of what passed Documentloader, Cachedresourceloader, Cacheresource, Resourceloaderscheduler, Resourcehandle These classes step-by-step through the cache lookup and then request a download and so on.

Gushing, until I debug XML parsing, I found that a lot of problems are inconsistent with understanding, in the analysis of the source code only to understand the general steps. Do you really know the details?

First, HTTP header Web header request

List a few important

Requests part

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 will resolve the field to return different requests (a Web page suitable for multi-terminal will be compatible processing) this point in the IPTV to pay special attention, many times some front-end Web page is to add some special fields to normal operation is very depressed. More information can be sent inside the HTTP request header

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, explains the text

Type HTML, character encoding utf-8.

In DOMImplementation.cpp createdocument () is created to determine whether the type is html,xml,video, etc. this type is the request returned in the OK field content-type resolved.

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 to find a balance between the load speed of the resource and the memory usage.

There's a lot more to this, and you can tell us about the problems you're having.

If you have questions about this article, you can directly in the public message, small series the first time to contact the original author to help you patiently answer.

Technicians have their own feelings, deep in which they are not understood, welcome to the personal public platform: the Programmer Interaction Alliance (Coder_online), a developer's home, to tell their story.

WebKit Browser Common development issues

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.