Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何处理选择证书弹窗? #977

Closed
zobx opened this issue Nov 20, 2023 · 5 comments
Closed

如何处理选择证书弹窗? #977

zobx opened this issue Nov 20, 2023 · 5 comments
Labels
upstream Upstream issue that can't solved by Rod

Comments

@zobx
Copy link

zobx commented Nov 20, 2023

Rod Version: v0.114.5

微信截图_20231120141617

@zobx zobx added the question Questions related to rod label Nov 20, 2023
@zobx
Copy link
Author

zobx commented Nov 20, 2023

或者怎么默认加载.pfx的证书文件,默认选择确认

@ysmood ysmood added upstream Upstream issue that can't solved by Rod and removed question Questions related to rod labels Nov 20, 2023
@ysmood
Copy link
Member

ysmood commented Nov 20, 2023

这应该是一个 upstream 问题,chromium 不支持这个 api,你可以看看 puppeteer 的一些解决方案,rod 同样适用:

puppeteer/puppeteer#540

@ysmood ysmood closed this as completed Nov 20, 2023
@kvii
Copy link
Contributor

kvii commented Nov 21, 2023

#367 应该是一个问题。
可不可以直接在 rod 启动时将证书导入到 rod 中,除了 hijack 外有其他方案吗?


It looks like as same as #367.
Can we add certication file (eg: .pfx, .crt) to rod at start. Is there has some solution rather than hijack?

@ysmood
Copy link
Member

ysmood commented Nov 21, 2023

可能有 cli 启动 flag 可以这么干,可能需要开发者自己去查下。

@kvii
Copy link
Contributor

kvii commented Nov 21, 2023

没找到 go 或者 chrome 能导入证书的 api。而且在这个情况中也不能给什么 ignore 或 insecure 之类的 flag。

最后还是用 hijack 解决了问题,关键部分伪代码如下:

client := &http.Client{
	Transport: &http.Transport{
		TLSClientConfig: ...,
	},
}
...

hr := browser.HijackRequests()
hr.Add("*", "", func(h *rod.Hijack) {
	err := h.LoadResponse(client, true)
	if err != nil {
		h.ContinueRequest(&proto.FetchContinueRequest{})
	}
})
go hr.Run()
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Upstream issue that can't solved by Rod
Projects
None yet
Development

No branches or pull requests

3 participants