2017-10-18 196 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

相關問題