From c1b3ff207bdedea57ec2292f5df3cb3abe723fe0 Mon Sep 17 00:00:00 2001 From: Yelyzaveta Dymchenko Date: Fri, 13 Sep 2024 06:20:20 +0000 Subject: [PATCH] feat: increase actix-web JsonConfig limit --- rollup-http/rollup-http-server/Cargo.lock | 44 +++++++++++++++++-- .../rollup-http-server/src/http_service.rs | 4 +- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/rollup-http/rollup-http-server/Cargo.lock b/rollup-http/rollup-http-server/Cargo.lock index b412406..a9c31a9 100644 --- a/rollup-http/rollup-http-server/Cargo.lock +++ b/rollup-http/rollup-http-server/Cargo.lock @@ -136,6 +136,43 @@ name = "actix-web" version = "4.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9180d76e5cc7ccbc4d60a506f2c727730b154010262df5b910eb17dbe4b8cb38" +dependencies = [ + "actix-codec", + "actix-http", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-utils", + "ahash", + "bytes", + "bytestring", + "cfg-if", + "derive_more", + "encoding_rs", + "futures-core", + "futures-util", + "impl-more", + "itoa", + "language-tags", + "log", + "mime", + "once_cell", + "pin-project-lite", + "regex-lite", + "serde", + "serde_json", + "serde_urlencoded", + "smallvec", + "socket2", + "time", + "url", +] + +[[package]] +name = "actix-web" +version = "4.9.0" +source = "git+https://github.com/actix/actix-web?tag=web-v4.9.0#e0918fb1795c899ac38fb903694ca1aa3b58d46d" dependencies = [ "actix-codec", "actix-http", @@ -193,7 +230,7 @@ checksum = "0f65804955af25ad36225100983ec8d92f14795e7f8080073f8147d0b768c78e" dependencies = [ "actix-http", "actix-router", - "actix-web", + "actix-web 4.9.0 (git+https://github.com/actix/actix-web?tag=web-v4.9.0#e0918fb1795c899ac38fb903694ca1aa3b58d46d)", "bytes", "futures", "futures-util", @@ -1563,10 +1600,11 @@ name = "rollup-http-server" version = "0.2.0" dependencies = [ "actix-server", - "actix-web", + "actix-web 4.9.0 (git+https://github.com/actix/actix-web?tag=web-v4.9.0)", "actix-web-validator", "async-mutex", "bindgen", + "derive_more", "env_logger 0.11.5", "ethabi", "getopts", @@ -1698,7 +1736,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd34f36fe4c5ba9654417139a9b3a20d2e1de6012ee678ad14d240c22c78d8d6" dependencies = [ - "actix-web", + "actix-web 4.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures", "percent-encoding", "serde", diff --git a/rollup-http/rollup-http-server/src/http_service.rs b/rollup-http/rollup-http-server/src/http_service.rs index 00292b1..e846dca 100644 --- a/rollup-http/rollup-http-server/src/http_service.rs +++ b/rollup-http/rollup-http-server/src/http_service.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use actix_web::{middleware::Logger, web::Data, App, HttpResponse, HttpServer, http::header::CONTENT_TYPE}; -use actix_web_validator::Json; +use actix_web_validator::{Json, JsonConfig}; use async_mutex::Mutex; use serde::{Deserialize, Serialize}; use serde_json::json; @@ -48,8 +48,10 @@ pub fn create_server( let data = Data::new(Mutex::new(Context { rollup_fd: rollup_fd.clone(), })); + let json_cfg = JsonConfig::default().limit(5 << 20); App::new() .app_data(data) + .app_data(json_cfg) .wrap(Logger::default()) .service(voucher) .service(notice)