[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #35673] Add new NSHTTPURLResponse initializer method
From: |
Jens Alfke |
Subject: |
[bug #35673] Add new NSHTTPURLResponse initializer method |
Date: |
Wed, 29 Feb 2012 20:30:51 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.22 (KHTML, like Gecko) Chrome/19.0.1049.3 Safari/535.22 |
URL:
<http://savannah.gnu.org/bugs/?35673>
Summary: Add new NSHTTPURLResponse initializer method
Project: GNUstep
Submitted by: snej
Submitted on: Wed 29 Feb 2012 08:30:50 PM GMT
Category: Base/Foundation
Severity: 3 - Normal
Item Group: Change Request
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
OS X 10.7 and iOS 5 add a public initializer method for NSHTTPURLResponse.
Without this method it's not feasible for application code to create an
instance of this class, since its properties aren't settable. This becomes a
blocker for implementations of NSURLProtocol that want to implement HTTP-like
protocols that return responses with headers and status codes.
Index: Headers/Foundation/NSURLResponse.h
===================================================================
--- Headers/Foundation/NSURLResponse.h (revision 34837)
+++ Headers/Foundation/NSURLResponse.h (working copy)
@@ -106,6 +106,11 @@
@interface NSHTTPURLResponse : NSURLResponse
/**
+ * Initializes the receiver.
+ */
+- (id) initWithURL: (NSURL*) url statusCode: (NSInteger) statusCode
HTTPVersion: (NSString*) HTTPVersion headerFields: (NSDictionary*)
headerFields;
+
+/**
* Returns a string representation of a status code.
*/
+ (NSString *) localizedStringForStatusCode: (NSInteger)statusCode;
Index: Source/NSURLResponse.m
===================================================================
--- Source/NSURLResponse.m (revision 34837)
+++ Source/NSURLResponse.m (working copy)
@@ -324,6 +324,16 @@
@implementation NSHTTPURLResponse
+-(id)initWithURL:(NSURL*) url statusCode:(NSInteger) statusCode
+ HTTPVersion:(NSString*) HTTPVersion headerFields:(NSDictionary*)
headerFields {
+ self = [super initWithURL: url MIMEType: nil expectedContentLength:
NSURLResponseUnknownLength textEncodingName: nil];
+ if (self) {
+ this->statusCode = statusCode;
+ this->headers = [headerFields copy];
+ }
+ return self;
+}
+
+ (NSString *) localizedStringForStatusCode: (NSInteger)statusCode
{
// FIXME ... put real responses in here
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?35673>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #35673] Add new NSHTTPURLResponse initializer method,
Jens Alfke <=