2017-10-18 172 views
7

在正在工作的应用程序中突然出现协议异常,导致网络调用失败。 该应用程序工作到昨天和今天所有的网络通话失败。这些调用对HTTP正常工作,但使用HTTPS失败。ProtocolException:预期':状态'标题不存在

这里是日志,

java.net.ProtocolException: Expected ':status' header not present 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.Http2xStream.readHttp2HeadersList(Http2xStream.java:262) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:145) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at codmob.com.campuswallet.app.ApiClient$1.intercept(ApiClient.java:66) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 
10-18 14:59:01.103 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at okhttp3.RealCall.access$100(RealCall.java:33) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
10-18 14:59:01.104 30746-30746/? W/System.err:  at java.lang.Thread.run(Thread.java:761) 

回答

2

今天所面临的同样的问题。原因在于将服务器上的nginx更新到最新版本(1.13.6)。询问你的后端团队是否没有更新服务器上的nginx。

nginx的更新日志 - http://nginx.org/en/CHANGES

+0

在答案中发布链接页面的相关部分,以便即使页面发生变化,答案仍然有用。 https://stackoverflow.com/help/how-to-answer –

+0

更新到最新版本的okhttp3(3.9.0)和retrofit2(2.3,0)为我做了诀窍。 –

3

后乱小时,终于得到了解决。更新Retrofit和Okhttp3库到最新版本为我做了诀窍。

compile 'com.squareup.okhttp3:okhttp:3.9.0' 

compile 'com.squareup.retrofit2:retrofit:2.3.0' 
+0

通过使用此修复程序,我的问题仍然存在。 –

+0

如果您的应用程序处于生产状态,则无法修复 - 用户在更新之前仍会遇到问题。 @aradon答案解释了原因,更合适的将是降级nginx和更新oktthp。 – IlyaEremin