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

[feat] http client with cert #302

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

WaberZhuang
Copy link
Contributor

Support HTTP client to use specified certificates. It's necessary when two-way authentication is enabled (the server will verify the client's identity) on the HTTP server.

@CLAassistant
Copy link

CLAassistant commented Dec 14, 2023

CLA assistant check
All committers have signed the CLA.


ClientImpl(ICookieJar *cookie_jar, TLSContext *tls_ctx) :
m_cookie_jar(cookie_jar),
m_dialer(new PooledDialer(tls_ctx)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_dialer(tls_ctx)?

So there will be no need to change m_dialer to a pointer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -25,6 +25,7 @@ limitations under the License.
#include <photon/common/stream.h>
#include <photon/common/timeout.h>
#include <photon/net/socket.h>
#include <photon/net/security-context/tls-stream.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to include the header file. just make a forward declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -47,6 +47,13 @@ class PooledDialer {
resolver(new_default_resolver(kDNSCacheLife)) {
}

PooledDialer(TLSContext *_tls_ctx) :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add a new constructor; simply add a default parameter to the existing constructor. The constructor is involved in the initialization of multiple members, and it is not advisable to maintain multiple versions.

@@ -110,6 +117,11 @@ class ClientImpl : public Client {
ClientImpl(ICookieJar *cookie_jar) :
m_cookie_jar(cookie_jar) {}

ClientImpl(ICookieJar *cookie_jar, TLSContext *tls_ctx) :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also possible to reuse the above constructor.

m_cookie_jar(cookie_jar) {}
ClientImpl(ICookieJar *cookie_jar, TLSContext *tls_ctx) :
m_cookie_jar(cookie_jar),
m_dialer(tls_ctx) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be necessary to consider ownership of tls_ctx?

Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
Copy link
Collaborator

@liulanzheng liulanzheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liulanzheng liulanzheng merged commit 1df8b3e into alibaba:release/0.6 Dec 15, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants