iOS web browser with a focus on security and privacy
at remove_ckhttpconnection 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#define CONTENT_TYPE_JAVASCRIPT 2 19#define CONTENT_TYPE_IMAGE 3 20 21#define ENCODING_DEFLATE 1 22#define ENCODING_GZIP 2 23 24@interface URLInterceptor : NSURLProtocol <CKHTTPConnectionDelegate> { 25 NSMutableData *_data; 26 NSURLRequest *_request; 27 NSUInteger encoding; 28 NSUInteger contentType; 29 Boolean firstChunk; 30} 31 32@property (strong) NSURLRequest *actualRequest; 33@property (assign) BOOL isOrigin; 34@property (strong) NSString *evOrgName; 35@property (strong) NSURLConnection *connection; 36@property (strong) HostSettings *hostSettings; 37@property (strong) HostSettings *originHostSettings; 38@property (strong, nonatomic) NSString *cspNonce; 39 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