Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3627 from ethcore/rpc-middleware
Browse files Browse the repository at this point in the history
Dapps-specific accounts
  • Loading branch information
gavofyork authored Dec 4, 2016
2 parents a9424bd + 1dd1337 commit 0c7b7fc
Show file tree
Hide file tree
Showing 39 changed files with 685 additions and 247 deletions.
129 changes: 69 additions & 60 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ serde = "0.8.0"
serde_json = "0.8.0"
hyper = { version = "0.9", default-features = false }
ctrlc = { git = "https://github.com/ethcore/rust-ctrlc.git" }
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
fdlimit = { path = "util/fdlimit" }
ethcore = { path = "ethcore" }
ethcore-util = { path = "util" }
Expand Down
4 changes: 2 additions & 2 deletions dapps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ build = "build.rs"
rand = "0.3.14"
log = "0.3"
env_logger = "0.3"
jsonrpc-core = "3.0"
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc-http-server.git" }
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" }
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git" }
hyper = { default-features = false, git = "https://github.com/ethcore/hyper" }
unicase = "1.3"
url = "1.0"
Expand Down
1 change: 0 additions & 1 deletion dapps/src/handlers/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

//! Simple Content Handler
use std::io::Write;
use hyper::{header, server, Decoder, Encoder, Next};
use hyper::net::HttpStream;
use hyper::mime::Mime;
Expand Down
2 changes: 1 addition & 1 deletion dapps/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn extract_url(req: &server::Request<net::HttpStream>) -> Option<Url> {
_ => None,
}
},
uri::RequestUri::AbsolutePath(ref path) => {
uri::RequestUri::AbsolutePath { ref path, .. } => {
// Attempt to prepend the Host header (mandatory in HTTP/1.1)
let url_string = match req.headers().get::<header::Host>() {
Some(ref host) => {
Expand Down
6 changes: 5 additions & 1 deletion dapps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ impl Server {
#[cfg(test)]
/// Returns address that this server is bound to.
pub fn addr(&self) -> &SocketAddr {
self.server.as_ref().expect("server is always Some at the start; it's consumed only when object is dropped; qed").addr()
self.server.as_ref()
.expect("server is always Some at the start; it's consumed only when object is dropped; qed")
.addrs()
.first()
.expect("You cannot start the server without binding to at least one address; qed")
}
}

Expand Down
3 changes: 1 addition & 2 deletions dapps/src/page/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::io::Write;
use time::{self, Duration};

use hyper::header;
Expand Down Expand Up @@ -126,7 +125,7 @@ impl<T: Dapp> PageHandler<T> {
impl<T: Dapp> server::Handler<HttpStream> for PageHandler<T> {
fn on_request(&mut self, req: server::Request<HttpStream>) -> Next {
self.file = match *req.uri() {
RequestUri::AbsolutePath(ref path) => {
RequestUri::AbsolutePath { ref path, .. } => {
self.app.file(&self.extract_path(path))
},
RequestUri::AbsoluteUri(ref url) => {
Expand Down
Loading

0 comments on commit 0c7b7fc

Please sign in to comment.