{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/5677","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/5677/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/5677/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/5677/events","html_url":"https://github.com/bitcoin/bitcoin/pull/5677","id":54701083,"number":5677,"title":"[PoC] libevent-based http server","user":{"login":"laanwj","id":126646,"avatar_url":"https://avatars.githubusercontent.com/u/126646?v=3","gravatar_id":"","url":"https://api.github.com/users/laanwj","html_url":"https://github.com/laanwj","followers_url":"https://api.github.com/users/laanwj/followers","following_url":"https://api.github.com/users/laanwj/following{/other_user}","gists_url":"https://api.github.com/users/laanwj/gists{/gist_id}","starred_url":"https://api.github.com/users/laanwj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laanwj/subscriptions","organizations_url":"https://api.github.com/users/laanwj/orgs","repos_url":"https://api.github.com/users/laanwj/repos","events_url":"https://api.github.com/users/laanwj/events{/privacy}","received_events_url":"https://api.github.com/users/laanwj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bitcoin/bitcoin/labels/REST","name":"REST","color":"006b75"},{"url":"https://api.github.com/repos/bitcoin/bitcoin/labels/RPC","name":"RPC","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/bitcoin/bitcoin/milestones/19","html_url":"https://github.com/bitcoin/bitcoin/milestones/0.12.0","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/milestones/19/labels","id":1092458,"number":19,"title":"0.12.0","description":"","creator":{"login":"laanwj","id":126646,"avatar_url":"https://avatars.githubusercontent.com/u/126646?v=3","gravatar_id":"","url":"https://api.github.com/users/laanwj","html_url":"https://github.com/laanwj","followers_url":"https://api.github.com/users/laanwj/followers","following_url":"https://api.github.com/users/laanwj/following{/other_user}","gists_url":"https://api.github.com/users/laanwj/gists{/gist_id}","starred_url":"https://api.github.com/users/laanwj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laanwj/subscriptions","organizations_url":"https://api.github.com/users/laanwj/orgs","repos_url":"https://api.github.com/users/laanwj/repos","events_url":"https://api.github.com/users/laanwj/events{/privacy}","received_events_url":"https://api.github.com/users/laanwj/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":0,"state":"open","created_at":"2015-05-01T12:31:35Z","updated_at":"2015-05-01T14:14:53Z","due_on":null,"closed_at":null},"comments":26,"created_at":"2015-01-18T16:15:02Z","updated_at":"2015-05-02T19:17:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/5677","html_url":"https://github.com/bitcoin/bitcoin/pull/5677","diff_url":"https://github.com/bitcoin/bitcoin/pull/5677.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/5677.patch"},"body":"This is a work in progress, but I'm PR'ing this in case anyone wants to run benchmarks (@gmaxwell, @jgarzik).\r\n\r\n- *Replace usage of boost::asio with [libevent2](http://libevent.org/)*. boost::asio is not part of C++11, so unlike other boost there is no forwards-compatibility reason to stick with it. Together with #4738 (convert json_spirit to UniValue), this rids Bitcoin Core of the worst offenders with regard to compile-time slowness.\r\n- *Replace spit-and-duct-tape http server with evhttp*. Front-end http handling is handled by libevent, a work queue (with configurable depth and parallelism) is used to handle application requests.\r\n- *Wrap HTTP request in C++ class*; this makes the application code mostly HTTP-server-neutral\r\n- *Refactor RPC to move all http-specific code to a separate file*. Theoreticaly this can allow building without HTTP server but with another RPC backend, e.g. Qt's debug console (currently not implemented) or future RPC mechanisms people may want to use.\r\n- *HTTP dispatch mechanism*; services (e.g., RPC, REST) register which URL paths they want to handle.\r\n\r\nBy using a proven, high-performance asynchronous networking library (also used by Tor) and HTTP server, problems such as #5674, #5655, #344 should be avoided.\r\n\r\nWhat works? bitcoind, bitcoin-cli, bitcoin-qt. Unit tests and RPC/REST tests pass. The aim for now is everything but SSL support.\r\n\r\nConfiguration options:\r\n\r\n- `-rpcthreads`: repurposed as \"number of  work handler threads\". Still defaults to 4.\r\n- `-rpcworkqueue`: maximum depth of work queue. When this is reached, new requests will return a 500 Internal Error.\r\n- `-rpctimeout`: inactivity time, in seconds, after which to disconnect a client.\r\n- `-debug=http`: low-level http activity logging\r\n\r\n(due to the separation of RPC and HTTP server, renaming this options may make sense)\r\n\r\nTODO:\r\n\r\n- ~~Build system (currently hardcodes libraries, so this will definitely not pass Travis)~~ (thanks @theuni)\r\n- ~~REST and RPC register their own request handlers respectively~~\r\n- Qt debug console must register a RPCTimerInterface (to make timeouts in the debug console work with -server=0)\r\n- Interrupt/Shutdown flow needs to be cleaned up, I added some hardcoded uglyness. To do this, modules must be able to register their own 'interrupt me' function without relying on boost thread interrupt functionality.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/98389333","html_url":"https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-98389333","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/5677","id":98389333,"user":{"login":"jgarzik","id":494411,"avatar_url":"https://avatars.githubusercontent.com/u/494411?v=3","gravatar_id":"","url":"https://api.github.com/users/jgarzik","html_url":"https://github.com/jgarzik","followers_url":"https://api.github.com/users/jgarzik/followers","following_url":"https://api.github.com/users/jgarzik/following{/other_user}","gists_url":"https://api.github.com/users/jgarzik/gists{/gist_id}","starred_url":"https://api.github.com/users/jgarzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgarzik/subscriptions","organizations_url":"https://api.github.com/users/jgarzik/orgs","repos_url":"https://api.github.com/users/jgarzik/repos","events_url":"https://api.github.com/users/jgarzik/events{/privacy}","received_events_url":"https://api.github.com/users/jgarzik/received_events","type":"User","site_admin":false},"created_at":"2015-05-02T19:17:56Z","updated_at":"2015-05-02T19:17:56Z","body":"Continued +1 on this.\r\n"}}