-
Notifications
You must be signed in to change notification settings - Fork 389
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
feat: support follow_redirects, tls #1896
base: main
Are you sure you want to change the base?
Conversation
if (httpsFlag) { | ||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); | ||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); | ||
} | ||
|
||
if (tls != nullptr) { | ||
if (!tls->mCaFile.empty()) { | ||
curl_easy_setopt(curl, CURLOPT_CAINFO, tls->mCaFile.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tls配置了值,但是不合法。会是什么影响?这里需要有容错能力
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl 会执行失败报错 failed to send http request:retry immediately request address:0x60d000000c70 try cnt:2 errMsg:Problem with the local SSL certificate,在重试后返回给调用方。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加了一个保证不会出现 core dump 的不合法验证 tls 的 ut
core/common/http/HttpResponse.h
Outdated
struct CurlTLS { | ||
std::string mCaFile; | ||
std::string mCertFile; | ||
std::string mKeyFile; | ||
bool mInsecureSkipVerify = true; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个放到HttpRequest文件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个放到 HttpRequest 会和 HttpResponse 出现相互引用
core/common/http/HttpRequest.h
Outdated
@@ -43,6 +43,8 @@ struct HttpRequest { | |||
int32_t mPort; | |||
uint32_t mTimeout = static_cast<uint32_t>(INT32_FLAG(default_http_request_timeout_secs)); | |||
uint32_t mMaxTryCnt = static_cast<uint32_t>(INT32_FLAG(default_http_request_max_try_cnt)); | |||
bool mFollowRedirects = false; | |||
CurlTLS* mTls = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这边能保证指针是有效的吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
由 Prom 传入的 mTls 生命周期可以保证有效,在 Job 取消时,会首先通过锁把每个采集通过 PromFuture 关闭,然后再是 Job shared_ptr 析构。
No description provided.