Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44094659 authored by vince-bourgmayer's avatar vince-bourgmayer
Browse files

update GzipedPropfind

parent 556c48fc
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -51,11 +51,12 @@ public class GzipedPropfind extends PropFindMethod {
    public Document getResponseBodyAsDocument() throws IOException {
        Header contentEncodingHeader= getResponseHeader("Content-Encoding");

        if(contentEncodingHeader != null && contentEncodingHeader.getValue() != "gzip") {
        if(contentEncodingHeader != null && contentEncodingHeader.getValue().indexOf("gzip") != -1 ) {
            return super.getResponseBodyAsDocument();
        }
        //@TOdo: look for potential optimisation like pipe gzipInputStream directly in InputStream in

        try{
            GZIPInputStream gzipis = new GZIPInputStream(getResponseBodyAsStream());
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gzipis));
            StringBuilder s = new StringBuilder();
@@ -63,6 +64,12 @@ public class GzipedPropfind extends PropFindMethod {
            while ((line = bufferedReader.readLine()) != null) {
                s.append(line);
            }
            bufferedReader.close();

        }catch(IOException e){
            throw e;
        }


        InputStream in = new ByteArrayInputStream(s.toString().getBytes());
        if (in != null) {