Disable TLS support, add links to issues for TODOs (#573) r=grisha/self

Landing this now to unblock Android builds of mentat until the cross-compilation of dependencies is figured out.
This commit is contained in:
Grisha Kruglov 2018-02-28 15:54:46 -08:00 committed by GitHub
parent 5e50d2a9b4
commit 36d455150d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 12 deletions

View file

@ -7,7 +7,6 @@ authors = ["Grisha Kruglov <gkruglov@mozilla.com>"]
[dependencies] [dependencies]
futures = "0.1" futures = "0.1"
hyper = "0.11" hyper = "0.11"
hyper-tls = "0.1.2"
tokio-core = "0.1" tokio-core = "0.1"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"

View file

@ -21,7 +21,8 @@ extern crate lazy_static;
extern crate serde_derive; extern crate serde_derive;
extern crate hyper; extern crate hyper;
extern crate hyper_tls; // TODO https://github.com/mozilla/mentat/issues/569
// extern crate hyper_tls;
extern crate tokio_core; extern crate tokio_core;
extern crate futures; extern crate futures;
extern crate serde; extern crate serde;

View file

@ -13,11 +13,13 @@ use std::collections::HashMap;
use futures::{future, Future, Stream}; use futures::{future, Future, Stream};
use hyper; use hyper;
use hyper_tls; // TODO: enable TLS support; hurdle is cross-compiling openssl for Android.
// See https://github.com/mozilla/mentat/issues/569
// use hyper_tls;
use hyper::{Method, Request, StatusCode, Error as HyperError}; use hyper::{Method, Request, StatusCode, Error as HyperError};
use hyper::header::{ContentType}; use hyper::header::{ContentType};
use rusqlite; use rusqlite;
// TODO: // TODO: https://github.com/mozilla/mentat/issues/570
// use serde_cbor; // use serde_cbor;
use serde_json; use serde_json;
use tokio_core::reactor::Core; use tokio_core::reactor::Core;
@ -44,6 +46,7 @@ use tx_mapper::TxMapper;
// TODO it would be nice to be able to pass // TODO it would be nice to be able to pass
// in a logger into Syncer::flow; would allow for a "debug mode" // in a logger into Syncer::flow; would allow for a "debug mode"
// and getting useful logs out of clients. // and getting useful logs out of clients.
// See https://github.com/mozilla/mentat/issues/571
// Below is some debug Android-friendly logging: // Below is some debug Android-friendly logging:
// use std::os::raw::c_char; // use std::os::raw::c_char;
@ -66,6 +69,7 @@ pub struct Syncer {}
// TODO this is sub-optimal, we don't need to walk the table // TODO this is sub-optimal, we don't need to walk the table
// to query the last thing in it w/ an index on tx!! // to query the last thing in it w/ an index on tx!!
// but it's the hammer at hand! // but it's the hammer at hand!
// See https://github.com/mozilla/mentat/issues/572
struct InquiringTxReceiver { struct InquiringTxReceiver {
pub last_tx: Option<Entid>, pub last_tx: Option<Entid>,
pub is_done: bool, pub is_done: bool,
@ -135,6 +139,7 @@ impl<'c> TxReceiver for UploadingTxReceiver<'c> {
tx_chunks.push(datom_uuid); tx_chunks.push(datom_uuid);
d(&format!("putting chunk: {:?}, {:?}", &datom_uuid, &datom)); d(&format!("putting chunk: {:?}, {:?}", &datom_uuid, &datom));
// TODO switch over to CBOR once we're past debugging stuff. // TODO switch over to CBOR once we're past debugging stuff.
// See https://github.com/mozilla/mentat/issues/570
// let cbor_val = serde_cbor::to_value(&datom)?; // let cbor_val = serde_cbor::to_value(&datom)?;
// self.remote_client.put_chunk(&datom_uuid, &serde_cbor::ser::to_vec_sd(&cbor_val)?)?; // self.remote_client.put_chunk(&datom_uuid, &serde_cbor::ser::to_vec_sd(&cbor_val)?)?;
self.remote_client.put_chunk(&datom_uuid, &serde_json::to_string(&datom)?)?; self.remote_client.put_chunk(&datom_uuid, &serde_json::to_string(&datom)?)?;
@ -305,10 +310,11 @@ impl RemoteClient {
fn get_uuid(&self, uri: String) -> Result<Uuid> { fn get_uuid(&self, uri: String) -> Result<Uuid> {
let mut core = Core::new()?; let mut core = Core::new()?;
let client = hyper::Client::configure() // TODO enable TLS, see https://github.com/mozilla/mentat/issues/569
.connector(hyper_tls::HttpsConnector::new(4, &core.handle()).unwrap()) // let client = hyper::Client::configure()
.build(&core.handle()); // .connector(hyper_tls::HttpsConnector::new(4, &core.handle()).unwrap())
// let client = hyper::Client::new(&core.handle()); // .build(&core.handle());
let client = hyper::Client::new(&core.handle());
d(&format!("client")); d(&format!("client"));
@ -337,10 +343,11 @@ impl RemoteClient {
fn put<T>(&self, uri: String, payload: T, expected: StatusCode) -> Result<()> fn put<T>(&self, uri: String, payload: T, expected: StatusCode) -> Result<()>
where hyper::Body: std::convert::From<T>, { where hyper::Body: std::convert::From<T>, {
let mut core = Core::new()?; let mut core = Core::new()?;
let client = hyper::Client::configure() // TODO enable TLS, see https://github.com/mozilla/mentat/issues/569
.connector(hyper_tls::HttpsConnector::new(4, &core.handle()).unwrap()) // let client = hyper::Client::configure()
.build(&core.handle()); // .connector(hyper_tls::HttpsConnector::new(4, &core.handle()).unwrap())
// let client = hyper::Client::new(&core.handle()); // .build(&core.handle());
let client = hyper::Client::new(&core.handle());
let uri = uri.parse()?; let uri = uri.parse()?;