Skip to content

Commit

Permalink
Implementing the missing mainDocumentUrl property for NSMutableURL.
Browse files Browse the repository at this point in the history
  • Loading branch information
msft-Jeyaram committed Dec 8, 2015
1 parent a26ee43 commit ee9febc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
21 changes: 8 additions & 13 deletions Frameworks/Foundation/NSMutableURLRequest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@

@implementation NSMutableURLRequest

- (id)initWithURL:(id)url {
_url = [url absoluteURL];
_timeoutInterval = 30.0;
_headerFields = [NSMutableDictionary new];
_method = @"GET";
_shouldHandleCookies = true;

return self;
}

/**
@Status Interoperable
*/
Expand Down Expand Up @@ -130,17 +120,22 @@ - (void)setHTTPShouldUsePipelining:(BOOL)shouldPipeline {
}

- (id)copyWithZone:(NSZone*)zone {
NSURLRequest* ret = [[NSMutableURLRequest alloc] initWithURL:(id)_url
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0]; /* [BUG: Make it copy all properties] */
NSMutableURLRequest* ret = [[NSMutableURLRequest alloc] initWithURL:(id)_url
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0]; /* [BUG: Make it copy all properties] */
ret->_headerFields = [_headerFields mutableCopy];
ret->_method.attach([_method copy]);
ret->_body.attach([_body copy]);
ret->_shouldHandleCookies = _shouldHandleCookies;
ret->_cachePolicy = _cachePolicy;
ret->_bodyStream = _bodyStream;
ret.mainDocumentURL = _mainDocumentURL;

return ret;
}

- (void)dealloc {
[_mainDocumentURL release];
[super dealloc];
}
@end
36 changes: 20 additions & 16 deletions include/Foundation/NSMutableURLRequest.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

#import <Foundation/NSURLRequest.h>

FOUNDATION_EXPORT_CLASS
@interface NSMutableURLRequest : NSURLRequest

-(void)setURL:(NSURL *)value;
-(void)setCachePolicy:(NSURLRequestCachePolicy)value;
-(void)setTimeoutInterval:(NSTimeInterval)value;
@property (copy) NSURL* mainDocumentURL;

-(void)setHTTPMethod:(NSString *)value;
- (void)setURL:(NSURL*)value;
- (void)setCachePolicy:(NSURLRequestCachePolicy)value;
- (void)setTimeoutInterval:(NSTimeInterval)value;

-(void)setHTTPBody:(NSData *)value;
-(void)setHTTPBodyStream:(NSInputStream *)value;
- (void)setHTTPMethod:(NSString*)value;

-(void)setAllHTTPHeaderFields:(NSDictionary *)allValues;
-(void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field;
-(void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field;
- (void)setHTTPBody:(NSData*)value;
- (void)setHTTPBodyStream:(NSInputStream*)value;

-(void)setHTTPShouldHandleCookies:(BOOL)value;
- (void)setAllHTTPHeaderFields:(NSDictionary*)allValues;
- (void)setValue:(NSString*)value forHTTPHeaderField:(NSString*)field;
- (void)addValue:(NSString*)value forHTTPHeaderField:(NSString*)field;

-(void)setMainDocumentURL:(NSURL *)value;
-(void)setHTTPShouldUsePipelining:(BOOL)shouldUsePipelining;

-(void)setAllowsInvalidSSLCertificate:(BOOL)allowsInvalidCertificiate;
- (void)setHTTPShouldHandleCookies:(BOOL)value;
- (void)setHTTPShouldUsePipelining:(BOOL)shouldUsePipelining;
@end

0 comments on commit ee9febc

Please sign in to comment.