gpt4 book ai didi

android - apache http 客户端 NafHttpAuthStrategyDefault

转载 作者:行者123 更新时间:2023-11-29 14:40:20 25 4
gpt4 key购买 nike

当我在 android 上使用 apache http 客户端时,我在 logcat 中收到一条可疑消息。

I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) NafHttpAuthStrategyDefault()
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) cached value : gbaSupportIsPossible=null
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) The current context is NOT a context of GBA service.
I/APACHE HTTP (thCr=2252) - GbaSupportPermissionRequestCheckerImpl(9949): (thUse=2252) isCurrentProcessRequestedGba()#finished result=false
I/APACHE HTTP (thCr=2252) - GbaSupportPermissionRequestCheckerImpl(9949): (thUse=2252) isCurrentProcessAllowedToUseGba()#started result=false
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) The GBA permission wasn't requested for this process.
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) It is impossible to support GBA now (many possible reasons: no Android Context, current client is GBA service, etc.), then it will be just usual HTTP.
I/APACHE HTTP (thCr=2252) - NafRequestExecutorWrapperRedirectionHandler(9949): (thUse=2252) It isn't GBA flow, redirection responses are not handled.

我只是像下面这样使用:

HttpClient httpClient = new DefaultHttpClient();
HttpContext httpContext = new BasicHttpContext();

HttpPost postRequest = new HttpPost(url);
postRequest.addHeader("User-Agent", String.format("%s %s %s %s %s", Build.MANUFACTURER, Build.MODEL, Build.PRODUCT, Build.CPU_ABI, Config.appStr));

MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

reqEntity.addPart("sessionId", new StringBody(sessionId));

ByteArrayBody bab = new ByteArrayBody(afp, "afp");
reqEntity.addPart("afp", bab);

if (pcm != null)
{
ByteArrayBody bab2 = new ByteArrayBody(pcm, "pcm");
reqEntity.addPart("pcm", bab2);
}

postRequest.setEntity(reqEntity);

HttpResponse response = httpClient.execute(postRequest, httpContext);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
String sResponse;
StringBuilder s = new StringBuilder();
while ((sResponse = reader.readLine()) != null) {
s = s.append(sResponse);
System.out.println(sResponse);
}

GBA服务是什么意思?我怎样才能获得GBA许可?收到消息后,发送此请求的线程看起来异常并被停止。我在 Galaxy Notes 上执行了代码。

最佳答案

GBA - 通用引导架构(由 3GPP 标准定义的身份验证机制)... http://en.wikipedia.org/wiki/Generic_Bootstrapping_Architecture获取更多信息。

在 Galaxy Note(我相信它是 T-mobile 版本)上,T-mobile 修改了 APACHE HTTP 客户端以包括用于通过 WiFi 进行身份验证的 GBA 客户端,尤其是用于通过 WiFi 进行 MMS 的身份验证。

问题是为什么要用GBA?它通常用于使用 ISIM key 进行身份验证,运营商将它们用于其服务。

如果您的应用是常规应用,最好的办法是坚持使用默认的 android HTTP 客户端,不要使用 Apache HTTP 客户端。

关于android - apache http 客户端 NafHttpAuthStrategyDefault,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11840937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com