ASIHTTPRequest: (potentially) carrier related issue while loading data / server gets empty POST

A very strange (for me) problem when uploading files to the server using ASIFormDataRequest.

When downloading via Wi-Fi there is no problem, I can download only fine. There is also no problem downloading via 3G using O2 UK as a carrier. When I download using the same code of the same server using Vodafone UK, the HTTP request arrives at the server with the POST content disabled. If I try the same request, but without loading the image (just add test => yes as some POST data), then this will work, but if I have test => yes and attach the file, it will arrive on the server with POST data deleted.

NB I use the latest version of ASIHTTPRequest on iPhone 4S and it plays on several other phones using Vodafone UK and O2 UK differently.

So, I point my objc code to the following PHP script, which simply prints what it got:

<?php
error_reporting(E_ALL);
ini_set("display_startup_errors","1");
ini_set("display_errors","1");

echo "FILES: ".print_r($_FILES,true);
echo "POST: ".print_r($_POST,true);
echo "GET: ".print_r($_GET,true);

die('done.');

The obj-c code I'm using is:

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSURL *url = [NSURL URLWithString: @"http://myserver.com/debugger.php"];
    ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];

    [request setDelegate:self];
    [request setDidFinishSelector:@selector(networkRequestSuccess:)];
    [request setDidFailSelector:@selector(networkRequestFailure:)];
    [request setTimeOutSeconds:120];

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"smalltestimage" ofType:@"png"];  
    NSData *myData = [NSData dataWithContentsOfFile:filePath];  
    if (myData) {  
        [request addPostValue:@"Yes" forKey:@"Test"];
        [request addData:myData withFileName:@"smalltestimage.png" andContentType:@"image/png" forKey:@"photos"];
        [request startSynchronous];
    } 
    else{
        NSLog(@"File not found..");
    }

    [request autorelease];
}

- (void)networkRequestSuccess:(ASIHTTPRequest *)request{

    NSLog(@"Success Response: %@", [request responseString]);

}

- (void)networkRequestFailure:(ASIHTTPRequest *)request{
    NSLog(@"Fail Response: %@", [request responseString]);
}

If I run the application with WiFi on or in O2 UK, I get the following answer:

Success Response: FILES: Array
(
    [photos] => Array
        (
            [name] => smalltestimage.png
            [type] => image/png
            [tmp_name] => /tmp/phpYTdw4g
            [error] => 0
            [size] => 13211
        )

)
POST: Array
(
    [Test] => Yes
)
GET: Array
(
)
done.

So far so good!

If I try again with WiFi turned off, but with an almost complete 3G signal on Vodafone UK:

Success Response: FILES: Array
(
)
POST: Array
(
)
GET: Array
(
)
done.

Very strange: not only is the file missing, but the value of "test" POST is missing. However, no errors from PHP or ASIHTTPRequest.

- ? Vodafone , ? , , .

[request addData], :

Success Response: FILES: Array
(
)
POST: Array
(
    [Test] => Yes
)
GET: Array
(
)
done.

. , . , - , .

+5
2

. . HTTP- . HTTPS, - ?

DEBUG_REQUEST_STATUS ( ASIHTTPRequest.m), , , , POST - .

+6

, -, .

(, 2002 ) -, , javascript/html/css - , - GPRS. HTTP-.

vodafone UK ( , , ), APN, , , . Vodafone , "wap" VPN , "" , , , /, , . - 3G GPRS.

, , , , GPRS/3G. , - . png , , , , - , 99,9% - jpegs.

https, , . , - , , /png , , .

+2

All Articles