Questions tagged [hyper]

A fast and correct HTTP implementation for Rust.

Hyper is a fast, safe HTTP implementation written in and for Rust.

  • A Client for talking to web services.
  • A Server for building those web services.
  • Blazing fast* thanks to Rust.
  • High concurrency with non-blocking sockets.
  • HTTP/1 and HTTP/2 support.

Github Repository

Guide

256 questions
3
votes
0 answers

How to allow both http1 and http2 requests in hyper?

I'm building a proxy service in rust with hyper and I want to support both HTTP1 and HTTP2 requests. If I send a request where request.version() == "HTTP/2.0".to_owned() I get the warning WARN hyper::client::client "Connection is HTTP/1, but…
cheezsteak
  • 2,731
  • 4
  • 26
  • 41
3
votes
1 answer

How to get raw HttpResponse using Hyper or Reqwest?

Is there a way to get the actual/original/raw http response after doing a reqwest::get("https://httpbin.org/ip").send().await? or from hyper : client.get("https://httpbin.org/ip".parse()?).await? I need a similar result to what postman…
Jitterbug
  • 302
  • 1
  • 11
3
votes
1 answer

How to deal with boxed and chained error on rust?

Il have many proxies uri (http and socks5) and i'm using reqwest for sending some http request throught theses proxies and i wanna drop a proxy if he didn't work. for proxy in proxies { let proxy = match Proxy::all(proxy_url) { Ok(proxy)…
aret
  • 126
  • 2
  • 6
3
votes
0 answers

Pass Arc into async handler

I have a global state which can be used down the code. For my hyper request handling, I generate a local state to group the data for easier access. I decided against a global static variable to use Arc> for thread-safe access. Now I have…
fragsalat
  • 500
  • 4
  • 14
3
votes
1 answer

Hyper 0.12.x : Implementing Service for a struct

In hyper 0.12.33, how do I implement hyper::service::Service for a struct ? I have tried the following but it is not sufficient as it seems that in 0.12 the Future trait is not provided automatically anymore for a struct that implements Service: use…
Nicolas Marshall
  • 4,186
  • 9
  • 36
  • 54
3
votes
0 answers

How to store multiple hyper servers in a single vector?

I'm trying to write a simple application to read a config file then spin up a hyper reverse proxy for each entry in that file I'm parsing the config in a loop and want to be able to keep track of every server I have created, probably in a Vec. I…
user2327063
  • 126
  • 5
3
votes
2 answers

Example usage of hyper with bb8 and postgres

I want to use hyper with bb8 and tokio-postgres. In every request I want to acquire a new connection from the pool. Can anybody provide me some example for this scenario? Currently I do it like this: fn main() { let addr =…
sivakov512
  • 415
  • 5
  • 14
3
votes
1 answer

I am unable to update Flow control window in HTTP2 implementation, so the client is unable to send the rest of the data

I am implementing simple asyncio HTTP2 server and client in Python 3.6. It requires to implement Flow control. I have set the flow control window to 2048 bytes on client side with function self.outbound_flow_control_window=2048, after the clients…
abbas
  • 35
  • 3
3
votes
1 answer

Writing a chunk stream to a file asynchronously using hyper

I am trying to create a simple function that downloads a remote file to a local filepath using hyper. I need the file write to be asynchronous as well (in my case I am using tokio_fs for that). Here is the code: View in the playground // Parts of…
lhahn
  • 1,241
  • 2
  • 14
  • 40
3
votes
2 answers

How do I configure a hyper 0.11.x client variable that is polymorphic over the connector?

I can't seem to figure out how to get Rust to accept a client and proxied client in the same variable. While I am still new to Rust, I have a basic understanding of programming. So far I have tried structs (but no impl's though), type casting,…
chuck
  • 33
  • 5
3
votes
1 answer

How to write an Electron app with Hyper?

I was wondering, how can I start to write an Electron app using the Hyper.js sources? I am new to both Electron and Hyper, and watched a few videos on building an Electron app. But I can't quite figure out how to start the Hyper app. For instance,…
Adrian
  • 744
  • 7
  • 17
3
votes
1 answer

Copy body and headers from hyper HTTP request to a new request while inspecting the body

I would like to create a small Rust HTTP proxy using hyper which accepts requests, forwards them and dumps the request + body. Based on this example, the proxy part works fine. However, I can't simply copy & print the request body. My main problem…
Philipp Ludwig
  • 3,758
  • 3
  • 30
  • 48
3
votes
1 answer

Getting multiple URLs concurrently with Hyper

I am trying to adapt the Hyper basic client example to get multiple URLs concurrently. This is the code I currently have: extern crate futures; extern crate hyper; extern crate tokio_core; use std::io::{self, Write}; use std::iter; use…
user964375
  • 2,201
  • 3
  • 26
  • 27
3
votes
2 answers

How can I implement a custom typed header for use with Hyper?

I'd prefer to take advantage of the type safety of Hyper's hyper::header::Headers#get method instead of using get_raw with a &str. What is the best way to accomplish this?
Colin Dean
  • 1,429
  • 1
  • 15
  • 26
3
votes
1 answer

expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`

I want use Hyper to implement a web service. I copied code from the hello world example and it succeeded. When I try to to add a data access object to the HelloWorld struct, I get an error, and I don't know how to fix it. How do add a trait member…
llxxbb
  • 1,241
  • 1
  • 10
  • 16