OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 | 6 |
7 // A block, that takes a request, and returns YES if the request should | 7 // A block, that takes a request, and returns YES if the request should |
8 // be handled. | 8 // be handled. |
9 typedef BOOL(^RequestFilterBlock)(NSURLRequest *request); | 9 typedef BOOL(^RequestFilterBlock)(NSURLRequest *request); |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // effect before |install| is called. | 28 // effect before |install| is called. |
29 + (void)setQuicEnabled:(BOOL)quicEnabled; | 29 + (void)setQuicEnabled:(BOOL)quicEnabled; |
30 | 30 |
31 // Sets whether SDCH should be supported by CrNet. This method only has any | 31 // Sets whether SDCH should be supported by CrNet. This method only has any |
32 // effect before |install| is called. The |filename| argument is used to specify | 32 // effect before |install| is called. The |filename| argument is used to specify |
33 // which file should be used for SDCH persistence metadata. If |filename| is | 33 // which file should be used for SDCH persistence metadata. If |filename| is |
34 // nil, persistence is not enabled. The default is for SDCH to be disabled. | 34 // nil, persistence is not enabled. The default is for SDCH to be disabled. |
35 + (void)setSDCHEnabled:(BOOL)sdchEnabled | 35 + (void)setSDCHEnabled:(BOOL)sdchEnabled |
36 withPrefStore:(NSString*)filename; | 36 withPrefStore:(NSString*)filename; |
37 | 37 |
| 38 // Set the alternate protocol threshold. Servers announce alternate protocols |
| 39 // with a probability value; any alternate protocol whose probability value is |
| 40 // greater than this value will be used, so |alternateProtocolThreshold| == 0 |
| 41 // implies any announced alternate protocol will be used, and |
| 42 // |alternateProtocolThreshold| == 1 implies no alternate protocol will ever be |
| 43 // used. Note that individual alternate protocols must also be individually |
| 44 // enabled to be considered; currently the only alternate protocol is QUIC (SPDY |
| 45 // is not controlled by this mechanism). |
| 46 // |
| 47 // For example, imagine your service has two frontends a.service.com and |
| 48 // b.service.com, and you would like to divide your users into three classes: |
| 49 // Users who use QUIC for both a and b |
| 50 // Users who use QUIC for a but not b |
| 51 // Users who use QUIC for neither a nor b |
| 52 // You can achieve that effect with: |
| 53 // a.service.com advertises QUIC with p=0.67 |
| 54 // b.service.com advertises QUIC with p=0.33 |
| 55 // alternateProtocolThreshold set to a uniform random number in [0,1] |
| 56 // Now equal proportions of users will fall into the three experimental groups. |
| 57 // |
| 58 // The default for this value is 1.0, i.e. all alternate protocols disabled. |
| 59 + (void)setAlternateProtocolThreshold:(double)alternateProtocolThreshold; |
| 60 |
38 // |userAgent| is expected to be of the form Product/Version. | 61 // |userAgent| is expected to be of the form Product/Version. |
39 // Example: Foo/3.0.0.0 | 62 // Example: Foo/3.0.0.0 |
40 // | 63 // |
41 // This method only has any effect before |install| is called. | 64 // This method only has any effect before |install| is called. |
42 + (void)setPartialUserAgent:(NSString *)userAgent; | 65 + (void)setPartialUserAgent:(NSString *)userAgent; |
43 | 66 |
44 // Set the block used to determine whether or not CrNet should handle the | 67 // Set the block used to determine whether or not CrNet should handle the |
45 // request. If this is not set, CrNet will handle all requests. | 68 // request. If this is not set, CrNet will handle all requests. |
46 // Must not be called while requests are in progress. This method can be called | 69 // Must not be called while requests are in progress. This method can be called |
47 // either before or after |install|. | 70 // either before or after |install|. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 130 |
108 // Returns the full user-agent that the stack uses. | 131 // Returns the full user-agent that the stack uses. |
109 // This is the exact string servers will see. | 132 // This is the exact string servers will see. |
110 + (NSString *)userAgent; | 133 + (NSString *)userAgent; |
111 | 134 |
112 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an | 135 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an |
113 // unspecified thread. | 136 // unspecified thread. |
114 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; | 137 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; |
115 | 138 |
116 @end | 139 @end |
OLD | NEW |