0

https://jmarshall.com/easy/http/#http1.1c4

We can add any header when sending a 100-continue intermediate response.

But we can see in Vert.x code that when he is going to call the continueHandler the response content is ignored, ripped off:

protected void doHandleResponse(HttpClientResponseImpl resp, long timeoutMs) {
  if (reset == null) {
    int statusCode = resp.statusCode();
    if (followRedirects > 0 && statusCode >= 300 && statusCode < 400) {
      Future<HttpClientRequest> next = client.redirectHandler().apply(resp);
      if (next != null) {
        next.setHandler(ar -> {
          if (ar.succeeded()) {
            handleNextRequest((HttpClientRequestImpl) ar.result(), timeoutMs);
          } else {
            handleException(ar.cause());
          }
        });
        return;
      }
    }
    if (statusCode == 100) {
      if (continueHandler != null) {
        continueHandler.handle(null);
      }
    } else {
      if (respHandler != null) {
        respHandler.handle(resp);
      }
      if (endHandler != null) {
        endHandler.handle(null);
      }
    }
  }
}

Obviously because the handler does not take any parameter.

The response is ripped of the call before:

private void checkHandleResponse() {
  HttpClientResponseImpl resp;
  synchronized (this) {
    if (response != null) {
      if (paused) {
        return;
      }
      resp = response;
      response = null;
    } else {
      return;
    }
  }
  doHandleResponse(resp);
}

The specification is not precise about this point though, I didn't find any precise details about the official content of the 100-continue response from the server.

I would like to fix this with a minimum of modifications, any clues ?

Gerard

tmarwen
  • 15,750
  • 5
  • 43
  • 62
igerard
  • 66
  • 5
  • Useful reading though, Section 6.1 of the specs : 1xx responses are terminated by the first empty line after the status-line (the empty line signaling the end of the header section) – igerard Oct 21 '19 at 07:58
  • And Code 101, 102 and 103 seems to be not handled at all by the HttpClient pattern – igerard Oct 21 '19 at 09:00

0 Answers0