|
@@ -77,6 +77,11 @@ exp.get_from_options = function(rid, url, options, callback) {
|
|
|
var logfunc = code && code < 405 ? logging.debug : logging.warn;
|
|
|
logfunc(rid, url, code || error && error.code, http_code[code]);
|
|
|
|
|
|
+ // not necessarily used
|
|
|
+ var e = new Error(code);
|
|
|
+ e.name = "HTTP";
|
|
|
+ e.code = "HTTPERROR";
|
|
|
+
|
|
|
switch (code) {
|
|
|
case 200:
|
|
|
case 301:
|
|
@@ -85,13 +90,17 @@ exp.get_from_options = function(rid, url, options, callback) {
|
|
|
case 308: // never seen, but mojang might use it in future
|
|
|
// these are okay
|
|
|
break;
|
|
|
+ case 204: // no content, used like 404 by mojang. making sure it really has no content
|
|
|
case 404:
|
|
|
- case 204:
|
|
|
+ // can be cached as null
|
|
|
+ body = null;
|
|
|
+ break;
|
|
|
case 429: // this shouldn't usually happen, but occasionally does
|
|
|
case 500:
|
|
|
case 503:
|
|
|
case 504:
|
|
|
// we don't want to cache this
|
|
|
+ error = error || e;
|
|
|
body = null;
|
|
|
break;
|
|
|
default:
|
|
@@ -99,6 +108,7 @@ exp.get_from_options = function(rid, url, options, callback) {
|
|
|
// Probably 500 or the likes
|
|
|
logging.error(rid, "Unexpected response:", code, body);
|
|
|
}
|
|
|
+ error = error || e;
|
|
|
body = null;
|
|
|
break;
|
|
|
}
|