大佬教程收集整理的这篇文章主要介绍了ios – 在Objective-C中发送分块的HTTP 1.1请求,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道Android上的类似功能使用Apache Foundations http库进行Java工作 – 有了这些,任何预先未指定长度的http请求都会作为http 1.1 Chunked request传输 – 我可以看到这些请求到达了服务器作为单独的块…我想模仿它.
(更新:似乎我AFNetworking可能有功能,但我没有找到任何关于如何使用它的例子.)
这是我的代码,或多或少:
NSString *soapBody = ....; //some correctly formed SOAP request XML here NSURL *url = [NSURL URLWithString:...]; NSMutableURLrequest* request = [NSMutableURLrequest requestWithURL:url]; [request addValue: ... forhttpHeaderField:@"SOAPAction"]; [request sethttpR_214_11845@ethod:@"POST"]; [request addValue:@"text/xml" forhttpHeaderField:@"Content-Type"]; [request sethttpBody:[soapBody dataUsingEncoding:NSUTF8StringEncoding]]; ChunkedTransferConnection* connection = [ChunkedTransferConnection alloc]; [connection establishConnectionWithrequest:request];
ChunkedTransferConnection的实现如下
@implementation ChunkedTransferConnection @synthesize p_connection; @synthesize p_responseData; - (void)establishConnectionWithrequest:(NSMutableURLrequest *)request { self.p_responseData = [[NSMutableData alloc] initWithLength:0] ; self.p_connection = [[NSURLConnection alloc] initWithrequest:request delegate:self startImmediately:YES]; } ... @end
以上是大佬教程为你收集整理的ios – 在Objective-C中发送分块的HTTP 1.1请求全部内容,希望文章能够帮你解决ios – 在Objective-C中发送分块的HTTP 1.1请求所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。