WebKit Network Module

Source: Internet
Author: User

Based on project requirements:

This section describes the loader and network modules:

The loader module is a customer of the network module. The network module provides the function of obtaining and uploading resources. The obtained resources may come from the network, local files, or cache.
The resourcehandleclient class under the network directory is the customer of the resourcehandle class. It defines virtual functions of some columns. These virtual functions are the callback of resourcehandle, and the inheritance class implements these interfaces. The resourcehandleclient class is an interface provided by the network module to other modules. Other modules can inherit this class, implement virtual functions in it, and then interact with the network module.
The resourcehandleclient interface is closely related to the network transmission process. Generally, it is the callback corresponding to a network event. The following are some of the interfaces:
Void willsendrequest (resourcehandle *, resourcerequest &, const resourceresponse &/* redirectresponse */)
// Generally, you can set a specific HTTP header, such as the user agent, to be called before initiating a network request. It is also automatically called during redirect requests.

Void didsenddata (resourcehandle *, unsigned long/* bytessent */, unsigned lOng/* totalbytestobesent */)
// When uploading data, it is called when the TCP write event sends data to the other party. loader can display the upload progress based on this callback.

Void didreceiveresponse (resourcehandle *, const resourceresponse &)
// After receiving the first response packet, at least the HTTP header has been parsed, And the loader determines whether the request is successful based on the response header information.

Void didreceivedata (resourcehandle *, const char *, Int, INT/* encodeddatalength */)
// Receives the HTTP Response Data, similar to the TCP read event, to respond to HTTP data. The network is designed to upload a piece of data.

Void didfinishloading (resourcehandle *, double/* finishtime */)
// The load is complete and the data has been fully received.

Void didfail (resourcehandle *, const resourceerror &)
// Loading failed

Void didreceiveauthenticationchallenge (resourcehandle *, const authenticationchallenge &)
// Requires user authentication

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.