Merge remote-tracking branch 'origin/master'

This commit is contained in:
serega6531
2019-05-24 16:45:55 +03:00

View File

@@ -16,9 +16,7 @@ import ru.serega6531.packmate.repository.StreamRepository;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipException;
@@ -111,10 +109,12 @@ public class StreamService {
List<Packet> cut = packets.subList(gzipStartPacket, gzipEndPacket + 1);
Packet decompressed = decompressGzipPackets(cut);
if(decompressed != null) {
packets.removeAll(cut);
packets.add(gzipStartPacket, decompressed);
gzipStarted = false;
i = gzipStartPacket + 1;
}
} else if (!packet.isIncoming()) {
String content = new String(packet.getContent());
@@ -126,11 +126,13 @@ public class StreamService {
List<Packet> cut = packets.subList(gzipStartPacket, gzipEndPacket + 1);
Packet decompressed = decompressGzipPackets(cut);
if(decompressed != null) {
packets.removeAll(cut);
packets.add(gzipStartPacket, decompressed);
gzipStarted = false;
i = gzipStartPacket + 1;
}
}
if (contentPos != -1) { // начало body
String headers = content.substring(0, contentPos);
@@ -148,10 +150,12 @@ public class StreamService {
List<Packet> cut = packets.subList(gzipStartPacket, gzipEndPacket + 1);
Packet decompressed = decompressGzipPackets(cut);
if(decompressed != null) {
packets.removeAll(cut);
packets.add(gzipStartPacket, decompressed);
}
}
}
Stream savedStream = save(stream);