Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 85352DC7F for ; Tue, 9 Oct 2012 17:17:41 +0000 (UTC) Received: (qmail 84707 invoked by uid 500); 9 Oct 2012 17:17:41 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 84639 invoked by uid 500); 9 Oct 2012 17:17:41 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 84630 invoked by uid 99); 9 Oct 2012 17:17:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2012 17:17:41 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of pmuellr@gmail.com designates 209.85.220.175 as permitted sender) Received: from [209.85.220.175] (HELO mail-vc0-f175.google.com) (209.85.220.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2012 17:17:35 +0000 Received: by mail-vc0-f175.google.com with SMTP id p1so6998843vcq.6 for ; Tue, 09 Oct 2012 10:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=qqN+Oii/K5gUUz/jo9zM92RUvCscyhqhGeSfCsyXG/0=; b=giDElQ26Ngm5UMXenwLfEN7PCSnB30CjcBvQY6bCASZYQdW9zb1vjNboN8A/Osm9io t6Qb1x3fNZESex2hknK2FzXGi8KII7W7feZ6riyorbRF1AyKgq61K8ULwxqKDw3Tlhw9 5kmRMULV54sFV2XDnljOO2Nu2yqBkmzR3AElUiw90F1QdwHCYmfEeFSI0efmosut4Wy1 QYYXe3MQcpvPPAsoCgve6TN6itP4bfzGeDR8Qp+dLDQy9IWmr/QrDwhYTRAYxox0SFOJ cdhyB6B8rj4etIvONHwWuP2rjXVEogRyxDDwwI6tJy2ZtJ1yTgMpPhzkxHNpNkToWFoI GbHw== MIME-Version: 1.0 Received: by 10.52.97.130 with SMTP id ea2mr9895565vdb.109.1349803034188; Tue, 09 Oct 2012 10:17:14 -0700 (PDT) Received: by 10.58.125.39 with HTTP; Tue, 9 Oct 2012 10:17:14 -0700 (PDT) Date: Tue, 9 Oct 2012 13:17:14 -0400 Message-ID: Subject: white-listing File Transfer on iOS and bug CB-1600 From: Patrick Mueller To: callback-dev Content-Type: multipart/alternative; boundary=20cf307cfc785e9b3104cba3828f --20cf307cfc785e9b3104cba3828f Content-Type: text/plain; charset=ISO-8859-1 I'm looking at https://issues.apache.org/jira/browse/CB-1600 I'm getting a crash running Mobile Spec on iOS 4.3 on iOS Simulator (Xcode 4.5.1 on Lion). Coupla different things going on here. One is that the crash occurs when you try to download a file from a host not in the white-list. There's some interesting code and comments here: https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVURLProtocol.m#L105 Note the comment a few lines down: // if it FAILS the whitelist, we return TRUE, so we can fail the connection later Um, WHO fails the connection later? Can't quite figure out that puzzle. As the comments before it indicate, I'm getting [canInitWithRequest] invoked 3 times per failed whitelist request, and then the code blindly continues processing the file download. At some point, it fails, as [CDVFileTransfer connection:didReceiveResponse:] is getting sent an NSURLResponse and not a NSHTTPURLResponse, and the trap involves an invalid casting of the NSURLResponse to a NSHTTPURLResponse. (as a general cleanliness measure, perhaps we should always do isKindOf: or whatever tests before casting?) === questions === - can we just do the white-list check FIRST, before even starting the file transfer? That way we never get into this mess. - maybe that doesn't work - do these NSURLConnections silently handle redirects, and then end up potentially failing in the white-list there? - I think we can check for white-list failure in the [CDVFileTransfer connection:didReceiveResponse:] method with an isKindOf: or whatever check, but I'm not sure if there's any other cleanup that needs to take place here. -- Patrick Mueller http://muellerware.org --20cf307cfc785e9b3104cba3828f--