AndroidHttpClient and DefaultHttpClient

前端 未结 3 1986
遥遥无期
遥遥无期 2021-01-31 19:16

Is there much difference between those two and which one is preferably to use?

3条回答
  •  清酒与你
    2021-01-31 20:00

    Based on the Android source code:

    https://github.com/CyanogenMod/android_frameworks_base/blob/gingerbread/core/java/android/net/http/AndroidHttpClient.java#L106

    AndroidHttpClient is set to do the following extra settings:

    1. Turn off stale checking, since the connections can break all the time.
    2. Set ConnectionTimeout and SoTimeout (20 or 60 seconds)
    3. Turn off redirecting.
    4. Use a session cache for SSL sockets.
    5. Use gzip compressed traffic between client and server if it's possible.
    6. Doesn't retain cookies by default.

提交回复
热议问题