-
Notifications
You must be signed in to change notification settings - Fork 95
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
A handful of fc changes to support unix sockets for HTTP RPC #12
Conversation
When implementing unix socket HTTP support in websocketpp I tried to make as few changes to websocketpp as possible. Unfortuately still need to add a friend class in here it seems.
fc::mutable_url was never implemented; so remove the deceiving declaration of it. Add a way to piecemeal construct an fc::url by a long argument list in its place. I need to construct an fc::url with something that isn't quite a real URL so I need a way to set each piece manually.
Unix paths handed to the http_client contain the socket path and url path concatenated together. http_client needs to discover what portion is the socket path and what portion is the url path. This information is then cached for later usage.
src/network/http/http_client.cpp
Outdated
Unix URLs work a little special here. They'll originally be in the format of | ||
unix:///home/spoonincode/eosio-wallet/keosd.sock/v1/wallet/sign_digest | ||
for example. When the fc::url is given to http_client in post_sync(), this will | ||
have proto=unix and host=/home/spoonincode/eosio-wallet/keosd.sock/v1/wallet/sign_digest |
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.
Generic username path?
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.
I don't follow? obviously (or, at least I thought obviously) that comment is meant to be an example
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.
In the context of Github, it obviously is an example. In bare source code, I didn't think it was completely obvious that 'spoonincode' is someone's username.
host=/home/username/eosio-wallet/keosd.sock/v1/wallet/sign_digest
is more generic. Likewise for two lines above.
src/network/http/http_client.cpp
Outdated
At this point we still don't know what part of the above string is the unix socket path | ||
and which part is the path to access on the server. This function discovers that | ||
host=/home/spoonincode/eosio-wallet/keosd.sock and path=/v1/wallet/sign_digest | ||
and create another fc::url that will be used downstream of the http_client::post_sync() |
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.
s/create/creates/
This PR includes the handful of changes I made to fc to support unix socket endpoints for HTTP RPC between keosd & cleos/nodeos. Most of these are pretty straightforward so I'd recommend reading each commit piecemeal.