diff --git a/bubble-server/src/main/java/bubble/service/stream/ActiveStreamState.java b/bubble-server/src/main/java/bubble/service/stream/ActiveStreamState.java index 5762e026..17d1234b 100644 --- a/bubble-server/src/main/java/bubble/service/stream/ActiveStreamState.java +++ b/bubble-server/src/main/java/bubble/service/stream/ActiveStreamState.java @@ -17,7 +17,6 @@ import org.cobbzilla.util.http.HttpContentEncodingType; import org.cobbzilla.util.io.FilterInputStreamViaOutputStream; import org.cobbzilla.util.io.FixedByteArrayInputStream; import org.cobbzilla.util.io.multi.MultiStream; -import org.cobbzilla.util.io.multi.MultiUnderflowHandlerMonitor; import org.cobbzilla.util.system.Bytes; import java.io.ByteArrayInputStream; @@ -28,6 +27,7 @@ import java.nio.charset.Charset; import java.util.List; import java.util.Map; +import static bubble.service.stream.StreamConstants.MIN_BYTES_BEFORE_WRAP; import static bubble.service.stream.charset.CharsetDetector.charSetDetectorForContentType; import static java.util.concurrent.TimeUnit.DAYS; import static java.util.concurrent.TimeUnit.SECONDS; @@ -35,6 +35,7 @@ import static org.apache.commons.lang3.ArrayUtils.EMPTY_BYTE_ARRAY; import static org.cobbzilla.util.daemon.ZillaRuntime.empty; import static org.cobbzilla.util.daemon.ZillaRuntime.shortError; import static org.cobbzilla.util.io.NullInputStream.NULL_STREAM; +import static org.cobbzilla.util.io.multi.MultiUnderflowHandlerMonitor.DEFAULT_UNDERFLOW_MONITOR; @Slf4j public class ActiveStreamState { @@ -45,15 +46,17 @@ public class ActiveStreamState { // If no data is readable for this long, shut down the underlying MultiStream public static final long UNDERFLOW_TIMEOUT = SECONDS.toMillis(60); + public static final String GRIZZLY_WORKER_STACK_LINE + = "org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run"; static { // do not terminate threads that are idling just fine // only terminate threads with abnormally long or short stacks - MultiUnderflowHandlerMonitor.DEFAULT_UNDERFLOW_MONITOR.setTerminateThreadFunc(t -> { + DEFAULT_UNDERFLOW_MONITOR.setTerminateThreadFunc(t -> { final StackTraceElement[] stack = t.getStackTrace(); if (stack.length < 5) return false; if (stack.length > 15) return true; for (int i=0; i<5; i++) { - if (stack[i].toString().contains("org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run")) { + if (stack[i].toString().contains(GRIZZLY_WORKER_STACK_LINE)) { return false; } } @@ -70,7 +73,7 @@ public class ActiveStreamState { private InputStream output = null; private long totalBytesWritten = 0; private long totalBytesRead = 0; - private CharsetDetector charsetDetector; + private final CharsetDetector charsetDetector; public ActiveStreamState(FilterHttpRequest request, List rules) { @@ -133,7 +136,7 @@ public class ActiveStreamState { } // do not wrap input with encoding stream until we have received at least MIN_BYTES_BEFORE_WRAP bytes // this avoids errors when creating a GZIPInputStream when only one or a few bytes are available - if (output == null && totalBytesWritten > StreamConstants.MIN_BYTES_BEFORE_WRAP) { + if (output == null && totalBytesWritten > MIN_BYTES_BEFORE_WRAP) { log.info("addChunk: detecting charset using "+charsetDetector.getClass().getSimpleName()); final BubbleCharSet cs = getCharSet(false); log.info("addChunk: detected charset: "+cs); @@ -233,7 +236,7 @@ public class ActiveStreamState { final String prefix = prefix("inputStream"); final String url = request.getUrl(); if (encoding == null) { - if (log.isDebugEnabled()) log.debug(prefix + "no encoding, returning baseStream unmodified"); + if (log.isDebugEnabled()) log.debug(prefix+"no encoding, returning baseStream unmodified"); return baseStream; } else if (encoding == HttpContentEncodingType.identity) { if (log.isDebugEnabled()) log.debug(prefix+"identity encoding, returning baseStream unmodified"); @@ -249,7 +252,7 @@ public class ActiveStreamState { if (log.isDebugEnabled()) log.debug(prefix+"returning baseStream wrapped in " + wrapped.getClass().getSimpleName()); return wrapped; } catch (IOException e) { - if (log.isWarnEnabled()) log.warn(prefix+"error wrapping with "+encoding+", sending as-is (perhaps missing a byte or two): "+shortError(e), e); + if (log.isWarnEnabled()) log.warn(prefix+"error wrapping with "+encoding+", sending as-is (perhaps missing a byte or two) url: "+url+" error:"+shortError(e), e); doNotWrap.put(url, url); return baseStream; } diff --git a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties index 5712c888..fe7a4be3 100644 --- a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties +++ b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties @@ -1 +1 @@ -bubble.version=Adventure 1.4.27 +bubble.version=Adventure 1.4.28 diff --git a/bubble-server/src/main/resources/ansible/bubble_scripts.txt b/bubble-server/src/main/resources/ansible/bubble_scripts.txt index 297a78ac..588c68a5 100644 --- a/bubble-server/src/main/resources/ansible/bubble_scripts.txt +++ b/bubble-server/src/main/resources/ansible/bubble_scripts.txt @@ -22,4 +22,7 @@ rdelkeys mitm_pid reset_bubble_logs pack_bubble -pack_status \ No newline at end of file +pack_status +bssh +bscp +brsync \ No newline at end of file diff --git a/bubble-server/src/main/resources/ansible/roles/mitmproxy/templates/bubble_config.py.j2 b/bubble-server/src/main/resources/ansible/roles/mitmproxy/templates/bubble_config.py.j2 index 325831e0..1a1c62b8 100644 --- a/bubble-server/src/main/resources/ansible/roles/mitmproxy/templates/bubble_config.py.j2 +++ b/bubble-server/src/main/resources/ansible/roles/mitmproxy/templates/bubble_config.py.j2 @@ -10,3 +10,5 @@ cert_validation_host = '{{ cert_validation_host }}' debug_capture_fqdn = None debug_stream_fqdn = None debug_stream_uri = None +bubble_log_request = False +bubble_log_response = False diff --git a/utils/cobbzilla-utils b/utils/cobbzilla-utils index d3b5e525..ebc8d91c 160000 --- a/utils/cobbzilla-utils +++ b/utils/cobbzilla-utils @@ -1 +1 @@ -Subproject commit d3b5e5254c2eca16290dc5746d0ab489160a8ff1 +Subproject commit ebc8d91c68a509633e53870ae62a07084392adbd