Hi,
If I call network.download to “GET” a file, I can’t seem to determine if it works or fails … at least in one important case.
Here are two examples, showing (much of) the event structure I get back. In the first case, I asked
for foo.fum.com/mobile_data.csv (which exists);
in the second case, I asked for foo.badname.com/mobile_data.csv (which does *NOT* exist, and the domain does not exist).
The fields in ‘event’ (with some fields with matching data deleted for space):
The fields in ‘event’ (with some fields with matching data deleted for space):
Good:
__unnamed__ = {
[“responseHeaders”] = {
[“Connection”] = “Keep-Alive”;
[“Content-Type”] = “text/csv”;
[“Etag”] = "“4f8ed-577bf29922da6"”;
[“Last-Modified”] = “Mon, 08 Oct 2018 22:30:03 GMT”;
[“Accept-Ranges”] = “bytes”;
[“Keep-Alive”] = “timeout=120, max=100”;
[“Content-Length”] = “325869”;
[“Server”] = “Apache/2.4.34 (Amazon)”;
};
[“bytesEstimated”] = 325869;
[“name”] = “networkRequest”;
[“bytesTransferred”] = 325869;
[“status”] = 200;
[“url”] = "http://foo.fum.com/mobile_data.csv";
[“isError”] = false;
[“requestId”] = “userdata: 0x600000e5d338”;
};
Bad:
__unnamed__ = {
[“responseHeaders”] = {
[“Connection”] = “close”;
[“Content-Type”] = “text/html”;
[“Expires”] = “Tue, 09 Oct 2018 00:13:45 GMT”;
[“Cache-Control”] = “no-cache”;
[“Vary”] = “Accept-Encoding”;
[“Transfer-Encoding”] = “Identity”;
[“Content-Encoding”] = “gzip”;
[“Server”] = “nginx”;
};
[“bytesEstimated”] = 322;
[“name”] = “networkRequest”;
[“bytesTransferred”] = 322;
[“status”] = 200;
[“url”] = "http://foo.badname.com/mobile_data.csv";
[“isError”] = false;
[“requestId”] = “userdata: 0x618000e42578”;
};
A file *is* downloaded in both cases. The bad file has:
<html><head><meta http-equiv=“refresh”
content="0;url=http://dnserrorassist.att.net/search/?q=http://foo.badname.com/mobile_data.csv&t=0"/>
</head><body><script>window.location="http://dnserrorassist.att.net/search/?q="+
escape(window.location)+"&r="+escape(document.referrer)+"&t=0";</script></body></html>
The good file has several thousand lines of .csv data.
Obviously, the http status can’t be used to differentiate: they both got back 200.
I had expected to get status 404 for the bad case
(Yes, I could check the resulting file for size, or to see if it has “dnserrorassist” in it, but those are both kludges.)
thanks,
Stan