@@ -17,6 +17,7 @@ - (instancetype)initWithHTTPRequest:(NSMutableURLRequest *)httpRequest
1717 quicHost : (NSString *)quicHost
1818 quicIp : (NSString *)quicIp
1919 body : (id )body
20+ headers : (nonnull NSDictionary *)headers
2021 quicSession : (QCloudQuicSession *)quicSession {
2122 if (self = [super init ]) {
2223 id bodyData = nil ;
@@ -30,7 +31,7 @@ - (instancetype)initWithHTTPRequest:(NSMutableURLRequest *)httpRequest
3031 httpMethod: httpRequest.HTTPMethod
3132 ip: quicIp
3233 body: bodyData
33- headerFileds: httpRequest.allHTTPHeaderFields ];
34+ headerFileds: headers ];
3435 _manager = [TquicConnection new ];
3536 __weak typeof (self) weakSelf = self;
3637 [_manager tquicConnectWithQuicRequest: req
@@ -40,20 +41,20 @@ - (instancetype)initWithHTTPRequest:(NSMutableURLRequest *)httpRequest
4041 statusCode: response.statusCode
4142 HTTPVersion: response.httpVersion
4243 headerFields: [response.allHeaderFields copy ]];
43- if ([strngSelf.delegate respondsToSelector: @selector (URLSession:dataTask:didReceiveResponse:completionHandler: )]) {
44- [strngSelf.delegate URLSession: quicSession dataTask: strngSelf didReceiveResponse: strngSelf.response completionHandler: nil ];
44+ if ([strngSelf.quicDelegate respondsToSelector: @selector (URLSession:dataTask:didReceiveResponse:completionHandler: )]) {
45+ [strngSelf.quicDelegate URLSession: quicSession dataTask: strngSelf didReceiveResponse: strngSelf.response completionHandler: nil ];
4546 }
4647 }
4748 didReceiveData: ^(NSData *_Nonnull data) {
4849 __strong typeof (weakSelf) strngSelf = weakSelf;
49- if ([strngSelf.delegate respondsToSelector: @selector (URLSession:dataTask:didReceiveData: )]) {
50- [strngSelf.delegate URLSession: quicSession dataTask: strngSelf didReceiveData: data];
50+ if ([strngSelf.quicDelegate respondsToSelector: @selector (URLSession:dataTask:didReceiveData: )]) {
51+ [strngSelf.quicDelegate URLSession: quicSession dataTask: strngSelf didReceiveData: data];
5152 }
5253 }
5354 didSendBodyData: ^(int64_t bytesSent, int64_t totolSentBytes, int64_t totalBytesExpectedToSend) {
5455 __strong typeof (weakSelf) strngSelf = weakSelf;
55- if ([strngSelf.delegate respondsToSelector: @selector (URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend: )]) {
56- [strngSelf.delegate URLSession: quicSession
56+ if ([strngSelf.quicDelegate respondsToSelector: @selector (URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend: )]) {
57+ [strngSelf.quicDelegate URLSession: quicSession
5758 task: strngSelf
5859 didSendBodyData: bytesSent
5960 totalBytesSent: totolSentBytes
@@ -63,8 +64,8 @@ - (instancetype)initWithHTTPRequest:(NSMutableURLRequest *)httpRequest
6364 RequestDidCompleteWithError: ^(NSError *_Nonnull error) {
6465 __strong typeof (weakSelf) strngSelf = weakSelf;
6566 strngSelf.originalRequest = [[NSURLRequest alloc ] initWithURL: httpRequest.URL];
66- if ([strngSelf.delegate respondsToSelector: @selector (URLSession:task:didCompleteWithError: )]) {
67- [strngSelf.delegate URLSession: quicSession task: strngSelf didCompleteWithError: error];
67+ if ([strngSelf.quicDelegate respondsToSelector: @selector (URLSession:task:didCompleteWithError: )]) {
68+ [strngSelf.quicDelegate URLSession: quicSession task: strngSelf didCompleteWithError: error];
6869 }
6970 }];
7071 }
0 commit comments