-
Notifications
You must be signed in to change notification settings - Fork 120
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
Conversation
net/http/client.cpp
Outdated
|
||
ClientImpl(ICookieJar *cookie_jar, TLSContext *tls_ctx) : | ||
m_cookie_jar(cookie_jar), | ||
m_dialer(new PooledDialer(tls_ctx)) { |
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.
m_dialer(tls_ctx)?
So there will be no need to change m_dialer to a pointer.
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.
done
9c07a1d
to
86bee16
Compare
net/http/client.h
Outdated
@@ -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> |
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.
no need to include the header file. just make a forward declaration.
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.
done
@@ -47,6 +47,13 @@ class PooledDialer { | |||
resolver(new_default_resolver(kDNSCacheLife)) { | |||
} | |||
|
|||
PooledDialer(TLSContext *_tls_ctx) : |
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.
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) : |
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.
It is also possible to reuse the above constructor.
86bee16
to
ab9622c
Compare
m_cookie_jar(cookie_jar) {} | ||
ClientImpl(ICookieJar *cookie_jar, TLSContext *tls_ctx) : | ||
m_cookie_jar(cookie_jar), | ||
m_dialer(tls_ctx) { |
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.
It might be necessary to consider ownership of tls_ctx?
Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
ab9622c
to
e85f575
Compare
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.
LGTM
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.