runtime/runtime_impl_jetty9/src/main/java/com/google/apphosting/runtime/http/JdkHttpApiHostClient.java [93:134]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doSend(
      byte[] requestBytes,
      HttpApiHostClient.Context context,
      AnyRpcCallback<APIResponse> callback) {
    try {
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      connection.setDoOutput(true);
      HEADERS.forEach(connection::addRequestProperty);
      connection.addRequestProperty("Content-Type", "application/octet-stream");
      if (context.getDeadlineNanos().isPresent()) {
        double deadlineSeconds = context.getDeadlineNanos().get() / 1e9;
        connection.addRequestProperty(DEADLINE_HEADER, Double.toString(deadlineSeconds));
        int deadlineMillis =
            Ints.saturatedCast(max(1, context.getDeadlineNanos().get() / 1_000_000));
        connection.setReadTimeout(deadlineMillis);
      }
      connection.setFixedLengthStreamingMode(requestBytes.length);
      connection.setRequestMethod("POST");
      try (OutputStream out = connection.getOutputStream()) {
        out.write(requestBytes);
      }
      if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
        int length = connection.getContentLength();
        if (length > MAX_LENGTH) {
          connection.getInputStream().close();
          responseTooBig(callback);
        } else {
          byte[] buffer = new byte[length];
          try (InputStream in = connection.getInputStream()) {
            ByteStreams.readFully(in, buffer); // EOFException (an IOException) if too few bytes
            receivedResponse(buffer, length, context, callback);
          }
        }
      }
    } catch (SocketTimeoutException e) {
      logger.atWarning().withCause(e).log("SocketTimeoutException");
      timeout(callback);
    } catch (IOException e) {
      logger.atWarning().withCause(e).log("IOException");
      communicationFailure(context, e.toString(), callback, e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



runtime/runtime_impl_jetty12/src/main/java/com/google/apphosting/runtime/http/JdkHttpApiHostClient.java [93:134]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void doSend(
      byte[] requestBytes,
      HttpApiHostClient.Context context,
      AnyRpcCallback<APIResponse> callback) {
    try {
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      connection.setDoOutput(true);
      HEADERS.forEach(connection::addRequestProperty);
      connection.addRequestProperty("Content-Type", "application/octet-stream");
      if (context.getDeadlineNanos().isPresent()) {
        double deadlineSeconds = context.getDeadlineNanos().get() / 1e9;
        connection.addRequestProperty(DEADLINE_HEADER, Double.toString(deadlineSeconds));
        int deadlineMillis =
            Ints.saturatedCast(max(1, context.getDeadlineNanos().get() / 1_000_000));
        connection.setReadTimeout(deadlineMillis);
      }
      connection.setFixedLengthStreamingMode(requestBytes.length);
      connection.setRequestMethod("POST");
      try (OutputStream out = connection.getOutputStream()) {
        out.write(requestBytes);
      }
      if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
        int length = connection.getContentLength();
        if (length > MAX_LENGTH) {
          connection.getInputStream().close();
          responseTooBig(callback);
        } else {
          byte[] buffer = new byte[length];
          try (InputStream in = connection.getInputStream()) {
            ByteStreams.readFully(in, buffer); // EOFException (an IOException) if too few bytes
            receivedResponse(buffer, length, context, callback);
          }
        }
      }
    } catch (SocketTimeoutException e) {
      logger.atWarning().withCause(e).log("SocketTimeoutException");
      timeout(callback);
    } catch (IOException e) {
      logger.atWarning().withCause(e).log("IOException");
      communicationFailure(context, e.toString(), callback, e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



