upgrade actix-web to v3

This commit is contained in:
Rob Ede 2020-09-12 03:29:17 +01:00
parent 4acaecd921
commit ba0f44e361
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
16 changed files with 649 additions and 444 deletions

View File

@ -1,3 +1,7 @@
## Unreleased
- Update actix-web dependency to 3.0.0 (#963)
## v0.14.1 ## v0.14.1
- Fix version mismatch in snapshot importation (#959) - Fix version mismatch in snapshot importation (#959)

1050
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,4 +5,4 @@ authors = ["marin <postma.marin@protonmail.com>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
actix-http = "1.0.1" actix-http = "2"

View File

@ -17,12 +17,11 @@ path = "src/main.rs"
default = ["sentry"] default = ["sentry"]
[dependencies] [dependencies]
actix-cors = "0.2.0" actix-cors = "0.3"
actix-http = "1" actix-http = "2"
actix-rt = "1" actix-rt = "1"
actix-service = "1.0.5" actix-service = "1.0.6"
actix-web = { version = "2.0.0", features = ["rustls"] } actix-web = { version = "3", features = ["rustls"] }
actix-web-macros = "0.1.0"
bytes = "0.5.4" bytes = "0.5.4"
chrono = { version = "0.4.11", features = ["serde"] } chrono = { version = "0.4.11", features = ["serde"] }
crossbeam-channel = "0.4.2" crossbeam-channel = "0.4.2"
@ -40,7 +39,7 @@ meilisearch-tokenizer = {path = "../meilisearch-tokenizer", version = "0.14.1"}
mime = "0.3.16" mime = "0.3.16"
rand = "0.7.3" rand = "0.7.3"
regex = "1.3.6" regex = "1.3.6"
rustls = "0.16.0" rustls = "0.18"
serde = { version = "1.0.105", features = ["derive"] } serde = { version = "1.0.105", features = ["derive"] }
serde_json = { version = "1.0.50", features = ["preserve_order"] } serde_json = { version = "1.0.50", features = ["preserve_order"] }
serde_qs = "0.5.2" serde_qs = "0.5.2"

View File

@ -4,7 +4,7 @@ use std::rc::Rc;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use actix_service::{Service, Transform}; use actix_service::{Service, Transform};
use actix_web::{dev::ServiceRequest, dev::ServiceResponse}; use actix_web::{dev::ServiceRequest, dev::ServiceResponse, web};
use futures::future::{err, ok, Future, Ready}; use futures::future::{err, ok, Future, Ready};
use crate::error::{Error, ResponseError}; use crate::error::{Error, ResponseError};
@ -63,7 +63,7 @@ where
let mut svc = self.service.clone(); let mut svc = self.service.clone();
// This unwrap is left because this error should never appear. If that's the case, then // This unwrap is left because this error should never appear. If that's the case, then
// it means that actix-web has an issue or someone changes the type `Data`. // it means that actix-web has an issue or someone changes the type `Data`.
let data = req.app_data::<Data>().unwrap(); let data = req.app_data::<web::Data<Data>>().unwrap();
if data.api_keys.master.is_none() { if data.api_keys.master.is_none() {
return Box::pin(svc.call(req)); return Box::pin(svc.call(req));

View File

@ -34,7 +34,7 @@ pub fn create_app(
actix_http::body::Body, actix_http::body::Body,
> { > {
App::new() App::new()
.app_data(web::Data::new(data.clone())) .data(data.clone())
.app_data( .app_data(
web::JsonConfig::default() web::JsonConfig::default()
.limit(data.http_payload_size_limit) .limit(data.http_payload_size_limit)

View File

@ -14,7 +14,7 @@ mod analytics;
#[global_allocator] #[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[actix_rt::main] #[actix_web::main]
async fn main() -> Result<(), MainError> { async fn main() -> Result<(), MainError> {
let opt = Opt::from_args(); let opt = Opt::from_args();

View File

@ -1,7 +1,7 @@
use std::collections::{BTreeSet, HashSet}; use std::collections::{BTreeSet, HashSet};
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post, put}; use actix_web::{delete, get, post, put};
use indexmap::IndexMap; use indexmap::IndexMap;
use meilisearch_core::update; use meilisearch_core::update;
use serde::Deserialize; use serde::Deserialize;

View File

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use actix_web_macros::{get, put}; use actix_web::{get, put};
use serde::Deserialize; use serde::Deserialize;
use crate::error::{Error, ResponseError}; use crate::error::{Error, ResponseError};

View File

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post, put}; use actix_web::{delete, get, post, put};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use log::error; use log::error;
use rand::seq::SliceRandom; use rand::seq::SliceRandom;

View File

@ -1,6 +1,6 @@
use actix_web::web; use actix_web::web;
use actix_web::HttpResponse; use actix_web::HttpResponse;
use actix_web_macros::get; use actix_web::get;
use serde::Serialize; use serde::Serialize;
use crate::helpers::Authentication; use crate::helpers::Authentication;

View File

@ -3,7 +3,7 @@ use std::collections::{HashSet, HashMap};
use log::warn; use log::warn;
use actix_web::web; use actix_web::web;
use actix_web::HttpResponse; use actix_web::HttpResponse;
use actix_web_macros::{get, post}; use actix_web::{get, post};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;

View File

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post}; use actix_web::{delete, get, post};
use meilisearch_core::settings::{Settings, SettingsUpdate, UpdateState, DEFAULT_RANKING_RULES}; use meilisearch_core::settings::{Settings, SettingsUpdate, UpdateState, DEFAULT_RANKING_RULES};
use meilisearch_schema::Schema; use meilisearch_schema::Schema;
use std::collections::{BTreeMap, BTreeSet, HashSet}; use std::collections::{BTreeMap, BTreeSet, HashSet};

View File

@ -2,7 +2,7 @@ use std::collections::HashMap;
use actix_web::web; use actix_web::web;
use actix_web::HttpResponse; use actix_web::HttpResponse;
use actix_web_macros::get; use actix_web::get;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use log::error; use log::error;
use serde::Serialize; use serde::Serialize;

View File

@ -1,5 +1,5 @@
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post}; use actix_web::{delete, get, post};
use meilisearch_core::settings::{SettingsUpdate, UpdateState}; use meilisearch_core::settings::{SettingsUpdate, UpdateState};
use std::collections::BTreeSet; use std::collections::BTreeSet;

View File

@ -1,7 +1,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use actix_web_macros::{delete, get, post}; use actix_web::{delete, get, post};
use indexmap::IndexMap; use indexmap::IndexMap;
use meilisearch_core::settings::{SettingsUpdate, UpdateState}; use meilisearch_core::settings::{SettingsUpdate, UpdateState};