Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/2: empty data-frame without Content-Length generated for requests without request body #2892

Closed
rfc2822 opened this issue Oct 4, 2016 · 1 comment
Labels
bug Bug in existing code
Milestone

Comments

@rfc2822
Copy link
Contributor

rfc2822 commented Oct 4, 2016

Let's assume this code for generating an OPTIONS request:

Response response = httpClient.newCall(new Request.Builder()
                .method("OPTIONS", null)
                .url(location)
                .build()).execute();

With HTTP/1.1, it just generates a request without body, which will be accepted and processed by the server.

However, when HTTP/2 is active, okhttp 3.4.1 generates an empty DATA frame without Content-Length:

davdroid.DavResourceFinder: [HttpClient$1] --> OPTIONS https://yourserver/katana/public/server.php/principals/bitfire/ http/1.1
davdroid.DavResourceFinder: [HttpClient$1] --> END OPTIONS
davdroid.dav4android: [dav4android.BasicDigestAuthHandler] Adding Basic authorization header for https://yourserver/katana/public/server.php/principals/bitfire/
okhttp3.internal.framed.Http2$FrameLogger: [okhttp3.internal.framed.Http2$Writer] >> 0x0000001f   218 HEADERS       END_HEADERS
[!!!] okhttp3.internal.framed.Http2$FrameLogger: [okhttp3.internal.framed.Http2$Writer] >> 0x0000001f     0 DATA          END_STREAM
okhttp3.internal.framed.Http2$FrameLogger: [okhttp3.internal.framed.Http2$Reader] << 0x0000001f     7 HEADERS       END_HEADERS

Servers like Apache 2.4 reject this request because the OPTIONS request should either have

  1. no body – and thus no data frame, or
  2. a body, and thus Content-Length.

Because null is specified as the request body, okhttp shouldn't send a data frame.

For further information, see https://forums.bitfire.at/topic/1124/411-length-error-davdroid-1-0-9-2-owncloud/10. If I can provide more information, please let me know.

@swankjesse
Copy link
Member

Can fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

2 participants