Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / iPhone 4s and SendHTTPFile possible issue?

Author
Message
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Nov 2013 21:29 Edited at: 25th Nov 2013 21:34
I'm wondering if anyone out there has tried sending a file using SendHTTPFIle that calls a PHP script which is located in a password protected directory?
We've been able to use this method fine on Android devices and iPhone 5s, but for some reason it is failing on 4s and it appears that the 4s is never even calling the server script.
Just wondering if anyone with a 4s has done this successfully.
We don't have SSL set up, but just a password protected directory.
Again this works 100% OK with Android, Windows, and iPhone 5s.
Just not the 4s...

Thanks!

EDIT: Actually the server seems to be giving a 401 access denied to these folks. However, they're not having any problem with SendHTTPRequestASync using the same credentials to the same protected directory, just SendHTTPFile... annoying!

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2013 21:48
Are you sure that you are setting up the user name and password before you make the SendHTTPFile request?

And, what does your SentHTTPFile command look like?

Finally, apparently when you do a file upload, it always goes to the <documentroot>/upload directory. And your php script (which is in the password protected directory) then uses standard PHP commands to move the file where it wants. The <documentroot>/upload directory pretty much needs universal write permission (a danger in upload directories). Does it have the correct write permissions? That also might generate a denial.

If you look at the access logs (both the domain access log and the Apache error log), it might show what the server is getting as a request. Then you can compare what is being sent from the devices that work and the one that doesn't.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Nov 2013 21:50
OK so I've found the issue, but no way to work around it. It is similar to an issue I had before when I was using a password on the directory with a non-alphanumeric character and SendHTTPResponseAsync was not working. I had fixed that by using only alpha numeric characters.

If I remove the password protection from the directory the SendHTTPFile command works fine.

If I have the protection up I get this message in xcode:
2013-11-25 15:43:28.367 Wordspionage[18016:a0b] Connection to http://<username>:<password>@www.wordspionagedb.com/ws/910_senderrorreport.php closed unexpectedly

Where <username> and <password> are actually the correct credentials for accessing the directory.

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2013 22:00
I just noticed that the demo code for the SentHTTPFile command is from you.

Instead of using file_exists, you should use the command "is_uploaded[$_FILES['myfile']['tmp_name'])". This helps get around some permission issues because it is letting Apache and PHP work out where the upload file is. Not all server configurations actually use 'upload' in the root. That is something selectable in the PHP initialisation (and/or Apache).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2013 22:03
The same app and PHP script fine in all other devices except the iPhone 4s, right?

Are you 100% certain that the iPhone 4s is running the same version as that which works on the other devices? (Probably 'yes', but it needs to be asked.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Nov 2013 22:25
OK so it's not the app version or the PHP script.
All of my scripts for the game are in the same protected directory and iOS can access all of them except for the error report uploader.
The file_exists command is only in that example, my actual script just checks the file's extension. And then tries to move the file with move_uploaded_file.

I added logging commands to my PHP script to see if it was indeed an issue with the script and it never even gets called from the iOS device.

It appears that this method is not working in the iOS simulator for xcode even, so I can test stuff out. I'm not 100% confident that it works with iPhone 5s at this point as I can't get that tester to try it out at the moment. It did work before though...

So the AppGameKit code works since it works in Windows and Android. The script also works for the same reason. Password protection of the directory is where the issue lies.
Looking at the password I see it is using upper case and lower case. Maybe that is the problem, but if it is then it is something in AppGameKit or iOS that is not handling it properly.

I'm going to test that hypothesis and then test a shorter password.
Seems like the password should work though because it is the same for all of the scripts that the game is calling and there's no issue with them. The only difference is that they're using SendHTTPRequestAsync().

I'll report back in a bit after some more tests.

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2013 22:47
Good luck. I suspect it isn't the scripts on your server.

If they work with other devices, then the issue is on the device, IMHO.

Did you check the server logs to see what is happening? That might give a good clue.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Nov 2013 23:02
OK so...
I changed the password to use only lowercase letters. No difference.
I shortened the password to 10 characters and numbers all lower case characters. No difference.

All scripts work on Android and Windows. All but the error log upload script works on iOS.
I'm not sure how the iPhone 5s user got it to work and the 4s folks are having an issue.
The AppGameKit code works fine. The script works fine.
If I take off password protection then the error log uploader works fine in the iOS simulator.

Server logs don't seem to help, just show a 401 access denied to the script.

It's definitely some where between iOS and the password protection.
This will make testing a little more annoying, but I can set it up so that there is a script for iOS testers that calls to a non protected directory for sending the error logs. I do not want that to stay that way for production though, so I might have to shut off the feature for iOS until a fix is done by the folks at AGK.

Would you mind testing this out on your server with iOS?
You should be able to see the async requests working just fine, but the send file requests not working.
What's also interesting is if I take the output from xcode the:
http://<username>:<password>@www.wordspionagedb.com/ws/910_senderrorreport.php

and I just plug it in to a browser then I connect to the file just fine, the script fails appropriately, but I connect.
So what is iOS doing to that URL that is preventing the transfer?

I know that when I call OpenBrowser with "mailto:support@wordspionage.com" that I had to change it for iOS to "mailto://support@wordspionage.com" otherwise it would open the mail setup and not a new mail message.
So I wonder if iOS is stripping everything after the colon sometimes...Or before it? Or encoding the colon , but we don't see that happening in xcode's output window?
I've no clue, but it might be a good guess...

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2013 23:53
I don't have any iPhones. I do have an iPod Touch 4th Gen, an iPad 2 and an iPad 3 (iOS 5/6 respectively).

I don't really have time to test anything right now. We are heading out for Thanksgiving tomorrow afternoon and I am trying to get stuff ready and my WIP levels done so that I can user test while with family (a nice age range).

In order to test in AppGameKit, I would need the same code that you are using to send (not the whole app, but the part that is failing). I really won't be able to do it in a timely fashion.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 26th Nov 2013 04:22
That's right. No worries. I'm just going to shut off the feature when we release the game on iOS and replace it with taking users to our support URL. As soon as I get a chance I'll write up a test case that you can confirm the issue with. Might not be for a bit.
Thanks for helping me work through it.

easter bunny
9
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 2nd Dec 2013 10:38 Edited at: 2nd Dec 2013 10:39
[off topic]
You might want to fix this


Firefox: 1366x768 screen res

Attachments

Login to view attachments
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 2nd Dec 2013 14:25
Thanks for the note. GoDaddy's website builder has certainly made me think it would have been much easier making my own webpages!

Login to post a reply

Server time is: 2022-09-29 13:01:47
Your offset time is: 2022-09-29 13:01:47