//
//  SHHttpClientWithUrlConnection.h
//  test
//
//  Created by 蒋 卫滨 on 13-3-22.
//  Copyright (c) 2013年 蒋 卫滨. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SHHttpClientProtocol.h"

@interface SHHttpClientWithUrlConnection : NSObject<SHHttpClientProtocol>
{
    id                   _delegate;
    id                   _context;
    NSMutableData*       _recvData;
    NSDictionary*        _recvHeaders;
    NSError*             _error;
    long                 _statusCode;
    BOOL                 _onlyNotifyWhenEnd;
    BOOL                 _canRedirect;
    BOOL                 _isStop;
    NSURLRequest*        _request;
    NSURLConnection*     _urlConnection;
}
//
-(id)initWithDelegate:(id<SHHttpClientDelegateProtocol>)delegate onlyNotifyWhenEnd:(BOOL)onlyNotifyWhenEnd;
-(id)initWithDelegate:(id<SHHttpClientDelegateProtocol>)delegate onlyNotifyWhenEnd:(BOOL)onlyNotifyWhenEnd canRedirect:(BOOL)canRedirect;
-(void)startWithRequst:(NSURLRequest*)request  context:(id)context;
-(void)startWithUrl:(NSString *)url postData:(NSString*)postData context:(id)conText;
-(void)startWithUrl:(NSString *)url  context:(id)context;
-(void)stop;
-(long)statusCode;
-(NSError* )error;
-(NSData*)rspData;
-(NSDictionary*)rspHeaders;
-(NSString*)rspHeaderForKey:(NSString*)key;
-(NSURLRequest*)request;
-(id<SHHttpClientDelegateProtocol>)delegate;
-(id)context;
-(BOOL)onlyNotifyWhenEnd;
@end
