【问题标题】:how to find out whether nsurclconnection's encoding is gzip'ed or not如何找出 nsurclconnection 的编码是否经过 gzip 压缩
【发布时间】:2014-06-21 01:32:56
【问题描述】:

有没有办法确定您的 nsurlconnection 现在是否实际上是 gzip 而不是典型的,因为我想比较时间差异。谢谢,

【问题讨论】:

    标签: ios http gzip nsurlconnection


    【解决方案1】:

    NSURLConnectionDataDelegate 方法-connection:didReveiveResponse: 中,您可以检查Content-Encoding 的标头字段,例如:

    - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
        NSLog(@"%@", (NSHTTPURLResponse *)response allHeaderFields]);
    }
    

    【讨论】:

    • sendAsynchronousRequest 相同 - 查看 NSURLResponse。
    猜你喜欢
    • 2011-08-28
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 2016-12-26
    • 2015-07-21
    • 1970-01-01
    • 2012-12-02
    • 2022-12-06
    相关资源
    最近更新 更多