2013-11-10 14 views
0

在我的Android應用程序,POST請求後,我得到的cookie接收cookie是不完全正確

​​

當我打印在logcat的cookie的值它的值是PHPSESSID=150edfn1mmr4grmip6pd4h5pv6; path=/

然而,當我通過工具或在線網站(如hurl.it)發送郵寄請求時,返回的Cookie爲PHPSESSID=150edfn1mmr4grmip6pd4h5pv6; path=/, abtesting=0

爲什麼httpResponse.getFirstHeader(「Set-Cookie」).getValue()返回缺少數據?在此先感謝

回答

0

像許多其他基於Java HttpClient的實現。這可能是由於處理標題,因爲基於Set-Cookie的規格abtesting=0是無效的屬性。

雖然WikiPedia狀態The value of a cookie may consist of any printable ascii character (! through ~, unicode \u0021 through \u007E) excluding , and ; and excluding whitespace. The name of the cookie also excludes = as that is the delimiter between the name and value. The cookie standard RFC2965 is more limiting but not implemented by browsers.關鍵是RFC2965。

請參閱與HttpCookie相關的文檔,它鏈接到具有必須遵循的特定語法/值的RFC文檔。