OkHttp 3.3.4-RC1 strange headers behavior with HTTP2 enabled
See original GitHub issueI have updated from OkHttp 3.3.1 to 3.3.4-RC1 and then have faced strange issue: When I change request header value became merged with value from previous request (we have saw it on server side). It looks like this SESSION: <oldValue>, <newValue> instead of SESSION: <newValue>
This is exactly what we saw on server side - header has 2 different sessions in it 0ed91** and dc35275*:
'api-session': '0ed91033efc8950f18c85afa4e6537a3; 7RCbXBqq#zK=Tmfk03hsR7vaRra7jka8S8bMZh0fd1VJkq7?Ydtp=Y&uNNguGvoI; active; 1467802743964; 900000, dc352754a1606f641acac300a9d81adb; 7kch9FjctfxHSQb29NGytrQe7XICtn9WyPtmT2yKJ@s4ou0#Gikg&bvYfY@XxHN6; not-active; 1467802755394; 900000',
This happens only if Http2 enabled and client use OkHttp3 ver 3.3.4-RC1.
Server: Nginx 1.11.1 (Http2 Enabled) Client: Nexus 5 (Android 6.0.1) Connection: HTTPS (TLS1.2)
This is my interceptor used to add session header to each request and get new session header from each response.
Interceptor apiInterceptor = new Interceptor() {
@Override
public okhttp3.Response intercept(Chain chain) throws IOException {
Request original = chain.request();
Request.Builder builder = original.newBuilder()
.method(original.method(), original.body());
if (model.getSession() != null) {
builder.addHeader(SESSION_HEADER, model.getSession().getHeader());
}
Request request = builder.build();
okhttp3.Response response = chain.proceed(request);
if (response.isSuccessful()) {
extractSession(response.headers());
}
return response;
}
};
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@dave-r12 @swankjesse with 3.4.1 version this problem disappeared. Everything works as expected.
This was likely caused by the bug fixed in #2715. @DASAR can you try version 3.4.1?
This test fails on 3.4.0: