WebKit FAQ Summary

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

Specifies the content type that the client 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 the The server 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 persistent connection by default)

connection:close

cookie

http When a request is sent, all the cookie value sent to web server.

cookie: $Version = 1; skin=new;

content-length

content length of the request

content-length:537

content-type

mime information

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

date

The date and time the request was sent

date:tue, April 15:12:31 GMT

user-agent  

user-agent  

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

Responses Part  

accept-ranges

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

accept-ranges:bytes

age

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

age:12

allow

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 of

cache-control: No-cache

content-encoding

web The server supports the return content compression encoding type.

content-encoding: Gzip

content-language

The response body language

content-language: En,zh

content-length

The length of the response body

content-length: 348

content-location

alternate address to request a resource alternative

content-location:/ index.htm

CONTENT-MD5

Returns the md5 checksum value

CONTENT-MD5: q2hly2sgsw50zwdyaxr5iq==

content-range

content-range: Bytes 21010-47021/47022

content-type

mime type

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

date

The original server message was issued at the time

date:tue, Span style= "Font-size:9pt;font-family:verdana;color: #232323;" >  15 Mar 15:12:31   gmt

location

used to redirect the receiver to the non-request url location 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 that is compatible with multiple terminals will do compatibility processing) this point in the IPTV to pay special attention to, 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, describes 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 FAQ Summary

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.