Siddharth Tiwari commited on
Commit
5b48644
1 Parent(s): ddb10f6

:zap: perf: Compression for the page responses of the search engine (#472)

Browse files
Files changed (2) hide show
  1. Cargo.toml +1 -1
  2. src/lib.rs +8 -1
Cargo.toml CHANGED
@@ -19,7 +19,7 @@ serde = {version="1.0.190", default-features=false, features=["derive"]}
19
  serde_json = {version="1.0.108", default-features=false}
20
  maud = {version="0.25.0", default-features=false, features=["actix-web"]}
21
  scraper = {version="0.18.1", default-features = false}
22
- actix-web = {version="4.4.0", features = ["cookies", "macros"], default-features=false}
23
  actix-files = {version="0.6.2", default-features=false}
24
  actix-cors = {version="0.6.4", default-features=false}
25
  fake-useragent = {version="0.1.3", default-features=false}
 
19
  serde_json = {version="1.0.108", default-features=false}
20
  maud = {version="0.25.0", default-features=false, features=["actix-web"]}
21
  scraper = {version="0.18.1", default-features = false}
22
+ actix-web = {version="4.4.0", features = ["cookies", "macros", "compress-brotli"], default-features=false}
23
  actix-files = {version="0.6.2", default-features=false}
24
  actix-cors = {version="0.6.4", default-features=false}
25
  fake-useragent = {version="0.1.3", default-features=false}
src/lib.rs CHANGED
@@ -21,7 +21,12 @@ use crate::server::router;
21
  use actix_cors::Cors;
22
  use actix_files as fs;
23
  use actix_governor::{Governor, GovernorConfigBuilder};
24
- use actix_web::{dev::Server, http::header, middleware::Logger, web, App, HttpServer};
 
 
 
 
 
25
  use cache::cacher::{Cacher, SharedCache};
26
  use config::parser::Config;
27
  use handler::{file_path, FileType};
@@ -73,6 +78,8 @@ pub fn run(
73
  ]);
74
 
75
  App::new()
 
 
76
  .wrap(Logger::default()) // added logging middleware for logging.
77
  .app_data(web::Data::new(config.clone()))
78
  .app_data(cache.clone())
 
21
  use actix_cors::Cors;
22
  use actix_files as fs;
23
  use actix_governor::{Governor, GovernorConfigBuilder};
24
+ use actix_web::{
25
+ dev::Server,
26
+ http::header,
27
+ middleware::{Compress, Logger},
28
+ web, App, HttpServer,
29
+ };
30
  use cache::cacher::{Cacher, SharedCache};
31
  use config::parser::Config;
32
  use handler::{file_path, FileType};
 
78
  ]);
79
 
80
  App::new()
81
+ // Compress the responses provided by the server for the client requests.
82
+ .wrap(Compress::default())
83
  .wrap(Logger::default()) // added logging middleware for logging.
84
  .app_data(web::Data::new(config.clone()))
85
  .app_data(cache.clone())