incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From IonuČ› G. Stan (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CB-765) Header support for PhoneGap's FileTransfer (Upload)
Date Thu, 12 Jul 2012 16:29:34 GMT

    [ https://issues.apache.org/jira/browse/CB-765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13412908#comment-13412908
] 

IonuČ› G. Stan commented on CB-765:
----------------------------------

I know you didn't ask me, but I think it's ok to remove it completely instead of deprecating
them for a very simple reason. Cordova 1.9 broke FileUploadOptions so badly that no one that
used it could upgrade to 1.9 (basically, no HTTP params get sent with the request). It's been
fixed in this commit: https://github.com/apache/incubator-cordova-ios/commit/95cfc5121120840764537a069b8f93851e2b7aab

So, if you intend to perform the new changes until 1.10 gets released, then I think it's ok
to remove the special "headers" param. Otherwise, I think you should keep it, but issue some
deprecation warnings.
                
> Header support for PhoneGap's FileTransfer (Upload)
> ---------------------------------------------------
>
>                 Key: CB-765
>                 URL: https://issues.apache.org/jira/browse/CB-765
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: iOS
>    Affects Versions: 1.7.0
>            Reporter: Aurelien MERCIER
>            Assignee: Herm Wong
>             Fix For: 1.9.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> It would be great to support headers for FileTransfer's iOS version (as done in Android:
CB-78).
> Right now, I had redefined CDVFileTranfer for our needs and added just after userAgent
definition:
> if(userAgent) {
> 		[req setValue: userAgent forHTTPHeaderField:@"User-Agent"];
> 	} 
>     
>     NSMutableDictionary* headers = [params objectForKey:@"headers"];
>     NSEnumerator *enumerator = [headers keyEnumerator];
> 	id key;
> 	id val;
>     NSString *nkey;
> 	
> 	while (nkey = [enumerator nextObject]) {
> 		val = [headers objectForKey:nkey];
> 		if(!val || val == [NSNull null]) {
> 			continue;	
> 		}
> 		// if it responds to stringValue selector (eg NSNumber) get the NSString
> 		if ([val respondsToSelector:@selector(stringValue)]) {
> 			val = [val stringValue];
> 		}
> 		// finally, check whether it is a NSString (for dataUsingEncoding selector below)
> 		if (![val isKindOfClass:[NSString class]]) {
> 			continue;
> 		}
>         
>         //if ([key respondsToSelector:@selector(stringValue)]) {
>         [req setValue:val forHTTPHeaderField:nkey];
>         //}	
>     }
> If you can include this code or similar one into future version of Cordova it will be
awesome.
> Thanks,

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message