| Index: components/cronet/ios/Cronet.h
|
| diff --git a/components/cronet/ios/Cronet.h b/components/cronet/ios/Cronet.h
|
| index fc7b9c2486aa0573c1e3ce33264b8a67646e7390..d87f4a6848881c0311a9fc252ebfe086babea851 100644
|
| --- a/components/cronet/ios/Cronet.h
|
| +++ b/components/cronet/ios/Cronet.h
|
| @@ -6,6 +6,10 @@
|
|
|
| #include "cronet_c_for_grpc.h"
|
|
|
| +// A block, that takes a request, and returns YES if the request should
|
| +// be handled.
|
| +typedef BOOL (^RequestFilterBlock)(NSURLRequest* request);
|
| +
|
| // Interface for installing Cronet.
|
| CRONET_EXPORT
|
| @interface Cronet : NSObject
|
| @@ -22,16 +26,28 @@ CRONET_EXPORT
|
| // before |start| is called.
|
| + (void)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort;
|
|
|
| -// |userAgent| is expected to be of the form Product/Version.
|
| -// Example: Foo/3.0.0.0
|
| +// Sets the User-Agent request header string to be sent with all requests.
|
| +// If |partial| is set to YES, then actual user agent value is based on device
|
| +// model, OS version, and |userAgent| argument. For example "Foo/3.0.0.0" is
|
| +// sent as "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X)
|
| +// AppleWebKit/601.1 (KHTML, like Gecko) Foo/3.0.0.0 Mobile/15G31
|
| +// Safari/601.1.46".
|
| +// If |partial| is set to NO, then |userAgent| value is complete value sent to
|
| +// the remote. For Example: "Foo/3.0.0.0" is sent as "Foo/3.0.0.0".
|
| //
|
| // This method only has any effect before |start| is called.
|
| -+ (void)setPartialUserAgent:(NSString*)userAgent;
|
| ++ (void)setUserAgent:(NSString*)userAgent partial:(BOOL)partial;
|
|
|
| // Sets SSLKEYLogFileName to export SSL key for Wireshark decryption of packet
|
| // captures. This method only has any effect before |start| is called.
|
| + (void)setSslKeyLogFileName:(NSString*)sslKeyLogFileName;
|
|
|
| +// Sets the block used to determine whether or not Cronet should handle the
|
| +// request. If the block is not set, Cronet will handle all requests. Cronet
|
| +// retains strong reference to the block, which can be released by calling this
|
| +// method with nil block.
|
| ++ (void)setRequestFilterBlock:(RequestFilterBlock)block;
|
| +
|
| // Starts CronetEngine. It is recommended to call this method on the application
|
| // main thread. If the method is called on any thread other than the main one,
|
| // the method will internally try to execute synchronously using the main GCD
|
| @@ -39,6 +55,24 @@ CRONET_EXPORT
|
| // that calls this method; otherwise, a deadlock can occur.
|
| + (void)start;
|
|
|
| +// Registers Cronet as HttpProtocol Handler. Once registered, Cronet intercepts
|
| +// and handles all requests made through NSURLConnection and shared
|
| +// NSURLSession.
|
| +// This method must be called after |start|.
|
| ++ (void)registerHttpProtocolHandler;
|
| +
|
| +// Unregister Cronet as HttpProtocol Handler. This means that Cronet will stop
|
| +// intercepting requests, however, it won't tear down the Cronet environment.
|
| +// This method must be called after |start|.
|
| ++ (void)unregisterHttpProtocolHandler;
|
| +
|
| +// Installs Cronet into NSURLSessionConfiguration so that all
|
| +// NSURLSessions created with this configuration will use the Cronet stack.
|
| +// Note that all Cronet settings are global and are shared between
|
| +// all NSURLSessions & NSURLConnections that use the Cronet stack.
|
| +// This method must be called after |start|.
|
| ++ (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config;
|
| +
|
| // Starts net-internals logging to a file named |fileName| in the application
|
| // temporary directory. |fileName| must not be empty. Log level is determined
|
| // by |logBytes| - if YES then LOG_ALL otherwise LOG_ALL_BUT_BYTES. If the file
|
| @@ -57,4 +91,21 @@ CRONET_EXPORT
|
| // Get a pointer to global instance of cronet_engine for GRPC C API.
|
| + (cronet_engine*)getGlobalEngine;
|
|
|
| +// Returns differences in metrics collected by Cronet since the last call to
|
| +// getGlobalMetricsDeltas, serialized as a [protobuf]
|
| +// (https://developers.google.com/protocol-buffers).
|
| +//
|
| +// Cronet starts collecting these metrics after the first call to
|
| +// getGlobalMetricsDeltras, so the first call returns no
|
| +// useful data as no metrics have yet been collected.
|
| ++ (NSData*)getGlobalMetricsDeltas;
|
| +
|
| +// Sets Host Resolver Rules for testing.
|
| +// This method only has any effect before |start| is called.
|
| ++ (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting;
|
| +
|
| +// Enables TestCertVerifier which accepts all certificates for testing.
|
| +// This method only has any effect before |start| is called.
|
| ++ (void)enableTestCertVerifierForTesting;
|
| +
|
| @end
|
|
|