public void setReceive(long receive) { setReceive(receive, TimeUnit.MILLISECONDS); }
@Override public void serverToProxyResponseReceived() { long responseReceivedNanos = System.nanoTime(); // like the wait time, the receive time requires that the serverToProxyResponseReceiving() method be called before this method is invoked. // typically that should happen, but it has been reported (https://github.com/lightbody/browsermob-proxy/issues/288) that it // sometimes does not. therefore, to be safe, make sure responseReceiveStartedNanos is populated before setting the receive time. if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(responseReceivedNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } else { harEntry.getTimings().setReceive(0L, TimeUnit.NANOSECONDS); } } }
@Override public void serverToProxyResponseTimedOut() { HarEntry harEntry = createHarEntryForFailedCONNECT(HarCaptureUtil.getResponseTimedOutErrorMessage()); har.getLog().addEntry(harEntry); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
@Override public void serverToProxyResponseTimedOut() { // replace any existing HarResponse that was created if the server sent a partial response HarResponse response = HarCaptureUtil.createHarResponseForFailure(); harEntry.setResponse(response); response.setError(HarCaptureUtil.getResponseTimedOutErrorMessage()); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
public void setReceive(long receive) { setReceive(receive, TimeUnit.MILLISECONDS); }
public void setReceive(long receive) { setReceive(receive, TimeUnit.MILLISECONDS); }
@Override public void serverToProxyResponseReceived() { long responseReceivedNanos = System.nanoTime(); // like the wait time, the receive time requires that the serverToProxyResponseReceiving() method be called before this method is invoked. // typically that should happen, but it has been reported (https://github.com/lightbody/browsermob-proxy/issues/288) that it // sometimes does not. therefore, to be safe, make sure responseReceiveStartedNanos is populated before setting the receive time. if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(responseReceivedNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } else { harEntry.getTimings().setReceive(0L, TimeUnit.NANOSECONDS); } } }
@Override public void serverToProxyResponseReceived() { long responseReceivedNanos = System.nanoTime(); // like the wait time, the receive time requires that the serverToProxyResponseReceiving() method be called before this method is invoked. // typically that should happen, but it has been reported (https://github.com/lightbody/browsermob-proxy/issues/288) that it // sometimes does not. therefore, to be safe, make sure responseReceiveStartedNanos is populated before setting the receive time. if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(responseReceivedNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } else { harEntry.getTimings().setReceive(0L, TimeUnit.NANOSECONDS); } } }
@Override public void serverToProxyResponseReceived() { Log.e("Capture", "serverToProxyResponseReceived " + harEntry.getId()); long responseReceivedNanos = System.nanoTime(); // like the wait time, the receive time requires that the serverToProxyResponseReceiving() method be called before this method is invoked. // typically that should happen, but it has been reported (https://github.com/lightbody/browsermob-proxy/issues/288) that it // sometimes does not. therefore, to be safe, make sure responseReceiveStartedNanos is populated before setting the receive time. if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(responseReceivedNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } else { harEntry.getTimings().setReceive(0L, TimeUnit.NANOSECONDS); } proxyManager.interpretResponseStream(harResponse); }
@Override public void serverToProxyResponseTimedOut() { HarEntry harEntry = createHarEntryForFailedCONNECT(HarCaptureUtil.getResponseTimedOutErrorMessage()); har.getLog().addEntry(harEntry); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
@Override public void serverToProxyResponseTimedOut() { HarEntry harEntry = createHarEntryForFailedCONNECT(HarCaptureUtil.getResponseTimedOutErrorMessage()); har.getLog().addEntry(harEntry); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
@Override public void serverToProxyResponseTimedOut() { HarEntry harEntry = createHarEntryForFailedCONNECT(HarCaptureUtil.getResponseTimedOutErrorMessage()); har.getLog().addEntry(harEntry); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
@Override public void serverToProxyResponseTimedOut() { // replace any existing DCResponse that was created if the server sent a partial response Log.e("Capture", "serverToProxyResponseTimedOut " + harEntry.getId()); HarResponse response = HarCaptureUtil.createHarResponseForFailure(); harEntry.setResponse(response); response.setError(HarCaptureUtil.getResponseTimedOutErrorMessage()); proxyManager.httpExchangeFailed(response.getError()); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
@Override public void serverToProxyResponseTimedOut() { // replace any existing HarResponse that was created if the server sent a partial response HarResponse response = HarCaptureUtil.createHarResponseForFailure(); harEntry.setResponse(response); response.setError(HarCaptureUtil.getResponseTimedOutErrorMessage()); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }
@Override public void serverToProxyResponseTimedOut() { // replace any existing HarResponse that was created if the server sent a partial response HarResponse response = HarCaptureUtil.createHarResponseForFailure(); harEntry.setResponse(response); response.setError(HarCaptureUtil.getResponseTimedOutErrorMessage()); // include this timeout time in the HarTimings object long timeoutTimestampNanos = System.nanoTime(); // if the proxy started to send the request but has not yet finished, we are currently "sending" if (sendStartedNanos > 0L && sendFinishedNanos == 0L) { harEntry.getTimings().setSend(timeoutTimestampNanos - sendStartedNanos, TimeUnit.NANOSECONDS); } // if the entire request was sent but the proxy has not begun receiving the response, we are currently "waiting" else if (sendFinishedNanos > 0L && responseReceiveStartedNanos == 0L) { harEntry.getTimings().setWait(timeoutTimestampNanos - sendFinishedNanos, TimeUnit.NANOSECONDS); } // if the proxy has already begun to receive the response, we are currenting "receiving" else if (responseReceiveStartedNanos > 0L) { harEntry.getTimings().setReceive(timeoutTimestampNanos - responseReceiveStartedNanos, TimeUnit.NANOSECONDS); } }