diff --git a/Common/source/customskinloader/utils/HttpRequestUtil.java b/Common/source/customskinloader/utils/HttpRequestUtil.java index 8a9a8d6..ffcada5 100644 --- a/Common/source/customskinloader/utils/HttpRequestUtil.java +++ b/Common/source/customskinloader/utils/HttpRequestUtil.java @@ -138,6 +138,8 @@ public class HttpRequestUtil { CustomSkinLoader.logger.debug("Successfully request (Response Code: "+c.getResponseCode()+" , Content Length: "+c.getContentLength()+")"); if(responce.responceCode==HttpURLConnection.HTTP_NOT_MODIFIED) return loadFromCache(request,responce); + if (responce.responceCode == HttpURLConnection.HTTP_NO_CONTENT) + request.cacheTime = 3600; //Load Content InputStream is="gzip".equals(c.getContentEncoding())?new GZIPInputStream(c.getInputStream()):c.getInputStream(); diff --git a/Common/source/customskinloader/utils/MinecraftUtil.java b/Common/source/customskinloader/utils/MinecraftUtil.java index 5768693..b5c8f0b 100644 --- a/Common/source/customskinloader/utils/MinecraftUtil.java +++ b/Common/source/customskinloader/utils/MinecraftUtil.java @@ -99,23 +99,19 @@ public class MinecraftUtil { } } - public static boolean isCoreFile(URL url){ - Matcher m; - try{ - m=MINECRAFT_CORE_FILE_PATTERN.matcher(URLDecoder.decode(url.getPath(),"UTF-8")); - }catch(Exception e){ - e.printStackTrace(); - return false; - } - return m.matches(); + public static boolean isCoreFile(URL url) { + return regexMatch(url, MINECRAFT_CORE_FILE_PATTERN); } private final static Pattern LIBRARY_FILE_PATTERN = Pattern.compile("^(.*?)/libraries/(.*?)/([^\\/\\\\]*?).jar$"); - public static boolean isLibraryFile(URL url){ + public static boolean isLibraryFile(URL url) { + return regexMatch(url, LIBRARY_FILE_PATTERN); + } + private static boolean regexMatch(URL url, Pattern p) { Matcher m; - try{ - m=LIBRARY_FILE_PATTERN.matcher(URLDecoder.decode(url.getPath(),"UTF-8")); - }catch(Exception e){ + try { + m=p.matcher(URLDecoder.decode(url.getPath(), "UTF-8")); + } catch (Exception e) { e.printStackTrace(); return false; }