iOS web browser with a focus on security and privacy
at master 54 lines 1.4 kB view raw
1/* 2 * Endless 3 * Copyright (c) 2014-2015 joshua stein <jcs@jcs.org> 4 * 5 * See LICENSE file for redistribution terms. 6 */ 7 8#import <Foundation/Foundation.h> 9#import "CKHTTPConnection.h" 10#import "HostSettings.h" 11 12#define REWRITTEN_KEY @"_rewritten" 13#define ORIGIN_KEY @"_origin" 14#define WVT_KEY @"_wvt" 15 16#define CONTENT_TYPE_OTHER 0 17#define CONTENT_TYPE_HTML 1 18 19#define ENCODING_DEFLATE 1 20#define ENCODING_GZIP 2 21 22@interface URLInterceptor : NSURLProtocol <CKHTTPConnectionDelegate> { 23 NSMutableData *_data; 24 NSURLRequest *_request; 25 NSUInteger encoding; 26 NSUInteger contentType; 27 Boolean firstChunk; 28} 29 30@property (strong) NSURLRequest *actualRequest; 31@property (assign) BOOL isOrigin; 32@property (strong) NSString *evOrgName; 33@property (strong) CKHTTPConnection *connection; 34@property (strong) HostSettings *hostSettings; 35@property (strong) HostSettings *originHostSettings; 36@property (strong, nonatomic) NSString *cspNonce; 37 38+ (void)setup; 39+ (void)clearInjectCache; 40+ (NSString *)javascriptToInject; 41+ (void)setSendDNT:(BOOL)val; 42+ (void)temporarilyAllow:(NSURL *)url; 43+ (NSString *)prependDirectivesIfExisting:(NSDictionary *)directives inCSPHeader:(NSString *)header; 44 45- (NSMutableData *)data; 46 47@end 48 49#ifdef USE_DUMMY_URLINTERCEPTOR 50@interface DummyURLInterceptor : NSURLProtocol 51@property (nonatomic, strong) NSURLConnection *connection; 52@property (assign) BOOL isOrigin; 53@end 54#endif