rxhttp icon indicating copy to clipboard operation
rxhttp copied to clipboard

请求接口和下载文件不同域名,接口需要证书,下载不需要,如何处理

Open linmomo opened this issue 6 years ago • 6 comments

image 项目接口使用预埋证书,校验服务端证书(自签名证书),可以正常请求接口,但是项目的下载的文件地址是亚马逊的服务器,会报证书路径找不到,这样如何处理

linmomo avatar Apr 29 '20 02:04 linmomo

排场了下,好像也不是证书问题,请求使用postFrom image image image 是下载一个zip包,不懂为何会这样,也是按照demo的操作

linmomo avatar Apr 29 '20 03:04 linmomo

检测是没问题了,需要使用get方式,不过还是一个问题就是使用自签名预埋证书会报证书效验问题,但是使用demo中不验证,直接跳过才行 image image

linmomo avatar Apr 29 '20 03:04 linmomo

下载要使用get请求;目前你遇到的问题是什么,我不是很清楚

liujingxing avatar Apr 29 '20 04:04 liujingxing

感谢作者的回复,下载用get可以了,但是现在依旧有个问题: 1、项目接口使用了服务器自签名证书进行了https加密,项目接口域名请求正常 2、项目需要下载资源文件,文件地址为上传到亚马逊服务器给的一个下载地址,与项目接口不是一个域名,这样请求下载的时候因为配置了自签名https证书的问题,会导致下载的时候报证书错误

linmomo avatar Apr 30 '20 14:04 linmomo

对于这种情况,可能需要两个OkHttpClient对象,但目前RxHttp仅支持设置全局的OkHttpClient对象。我会尝试下有没有其它办法,方便的话,加下我QQ:327744707,需要你配合调试下。

liujingxing avatar May 01 '20 14:05 liujingxing

v2.2.5版本已支持配置多个OkHttpClient对象,且方便切换,详情查看https://github.com/liujingxing/okhttp-RxHttp/wiki/%E6%B3%A8%E8%A7%A3%E4%BD%BF%E7%94%A8#okclient

liujingxing avatar May 31 '20 15:05 liujingxing