Skip to content

Instantly share code, notes, and snippets.

View ClementDreptin's full-sized avatar

Clément Dreptin ClementDreptin

View GitHub Profile
use axum::{body::Body, http::StatusCode, response::IntoResponse, routing::get, Router};
use futures::Stream;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncBufReadExt, AsyncRead, AsyncReadExt, BufReader, ReadBuf};
use tokio::net::{TcpListener, TcpStream};
use tower_http::cors::CorsLayer;
// This struct represent a stream and an amount of bytes to read from it
struct LimitedStream {