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.

AppGameKit Classic Chat / GetHTTPFile() does not work correctly if file not found

Author
Message
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 22nd Feb 2013 14:23
I have used the following code to transfer a file from a web site to my AppGameKit device and this works fine if the file actually exists!

However, if the file requested is not at the location, the GetHTTPFile() does not return an integer of 0 but does create the 'save file' with the error text reported from the web page.

I have been using the same code to transfer a 'local' file and again if the file does not exit the 'save file' is still created but with 0 bytes? Is this a fault with the GetHTTP() command?

Using the code below the "FILE COULD NOT BE LOCATED" is never displayed as the GetHTTPFile() never returns a 0

Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 23rd Feb 2013 16:59
Does anyone have a comment or experienced the same?

Cheers
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Feb 2013 18:02 Edited at: 23rd Feb 2013 18:08
the webserver answers with status codes but they are invisible for you. i think they are named as http header.

-------------------------------------
this is ok , i read the index.html
-------------------------------------
HTTP/1.0 200 OK
Date: Sat, 23 Feb 2013 17:04:35 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: NID=67=Zm-HNe7XtiaSEJxw6Ys8hxGK_ClnaKWnM8Ab1OsBwUR8-Yd5jlWOJ8BIsM_y4_1vmaANkXXjJw-Gf37OOIHgRJxScNp66HIVOnrWqf6AIciJWWP_68cNll90f1PwAXEQ; expires=Sun, 25-Aug-2013 17:04:35 GMT; path=/; domain=.; HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN


<!doctype html><html itemscope="itemscope" itemtype="http://schema.org/WebPage"><head><meta itemprop="image" content="/images/google_favicon_128.png"><title>Google</title><script>(function(){
window.google={kEI:"o_YoUdb4BoXYtQacqYBQ",getEI:function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")))a=a.parentNode;return b||google.kEI},https:function(){return"https:"==window.location.protocol},kEXPI:"25657,39523,4000116,4001569,4001947,4001959,4001975,4002001,4002159,4002562,4002734,40...

-------------------------------------
this is file not found if ask for ...
-------------------------------------
HTTP/1.0 404 Not Found
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Date: Sat, 23 Feb 2013 17:01:20 GMT
Server: sffe
Content-Length: 947
X-XSS-Protection: 1; mode=block


<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}
</style>
<a href=//www.google.com/><img src=//www.google.com/images/errors/logo_sm.gif alt=Google></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/esistnichtda.png</code> was not found on this server. <ins>That’s all we know.</ins>
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Feb 2013 18:44
Giving proper responses in error situations is sort of a known issue for the AGK HTTP commands.

We hope this will be fixed soon.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-02 23:12:57
Your offset time is: 2024-05-02 23:12:57