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

Extracting body from Hyper request as a string

I'm trying to create a simple web server in Rust using Hyper, and I'm getting stuck trying to convert the request.body() Stream to a String. I'm running rustc 1.21.0-nightly So far I have this: extern crate futures; extern crate hyper; extern crate…
chrxr
  • 1,374
  • 1
  • 10
  • 21
3
votes
1 answer

Hyper HTTP2 custom SSLContext Error

I am trying to make HTTP2 request to a server(virtual hosted) which gives SSL certificates based on host header value(SNI). # conn = hyper.HTTP20Connection('http2.akamai.com', port=443, ssl_context=context) # conn.request('GET', '/path',…
naren
  • 14,611
  • 5
  • 38
  • 45
3
votes
1 answer

How to make a request with client certificate in Rust

I have a project with microservices deployed in Bluemix with Docker containers. All microservices are written in Java and the communication is using JKS files. I also developed a microservice in Node.js with Express.js. To consume the other…
Deoxyseia
  • 1,359
  • 18
  • 29
3
votes
1 answer

How to correctly handle multiple Set-Cookie headers in Hyper?

I'm using Hyper to send HTTP requests, but when multiple cookies are included in the response, Hyper will combine them to one which then fails the parsing procedure. For example, here's a simple PHP script
Frederick Zhang
  • 3,593
  • 4
  • 32
  • 54
3
votes
2 answers

How do I set the User-Agent header when making a request with Hyper?

I'm trying to do a GET request to Github's API in Rust with the Hyper library, and with a user-agent string in the header. I haven't had luck compiling with .header(UserAgent("string")). Would anyone be willing to propose an idiomatic way to…
Meow
  • 1,610
  • 1
  • 14
  • 18
3
votes
1 answer

Unable to build Hyper - invalid character `-` in crate name

I am trying to run the hyper example listed on the Github readme. extern crate hyper; use std::io::Write; use hyper::Server; use hyper::server::Request; use hyper::server::Response; use hyper::net::Fresh; fn hello(_: Request, res:…
bipvanwinkle
  • 104
  • 1
  • 1
  • 6
2
votes
1 answer

How to convert an entire hyper Response, including the headers and all the parts, into bytes?

How to convert a hyper::Response object into the bytes that would be sent over the network for it, including all parts of the response (the status code, version, headers, and body)?
talz
  • 1,004
  • 9
  • 22
2
votes
1 answer

How to serialize/deserialize hyper::Request and hyper::Response?

Hyper provides API that abstracts you away from serialization/deserialization (they pretty much do it internally and send the result over the wire). In most cases, it's great. However, for my case, I need to be able to serialize/deserialize them…
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
2
votes
1 answer

How do I directly control the http body (big size) when using hyper?

Currently, we are switching the API gateway engine made in c to tokio, hyper, rustls of rust. While analyzing the echo server example provided by hyper_rustls (tokio_rustls), there is a part that I do not understand and ask for help. (I'm struggling…
yjlee
  • 363
  • 1
  • 14
2
votes
0 answers

Is there a way to read a .hyper file in R?

I've a lot of .hyper files to work with. Most of the time I work with them using Python (using tableauhyperio lib), but I need to read them in R and I could not find a way to do it. Does anyone know some way to read hyper files in R? Right now I'm…
2
votes
2 answers

Is there a way to bind a variable to a request in tower-http / hyper / axum?

I'm trying to add a request id to each tracing event. I can do it with tower_http::trace like this: #[derive(Clone)] pub struct RequestSpan; impl tower_http::trace::MakeSpan for RequestSpan { fn make_span(&mut self, request:…
imbolc
  • 1,620
  • 1
  • 19
  • 32
2
votes
2 answers

Minimal Docker for Networking Rust Binary

I have a Rust binary I want to put in a docker image. To minimize the image size, I used http://github.com/larsks/dockerize/ which adds libc and a few nss library files. However it's failing to resolve DNS and I want to know what's the hidden system…
mq7
  • 1,125
  • 2
  • 11
  • 21
2
votes
1 answer

How can I return an Arc> as a Hyper response?

I am writing a server that allocates some compressed data on startup. Now when I serve a hyper response I do not want to copy these bytes, but I cannot figure out a way to do this with hyper. I have tried implementing HttpBody for my own type, but…
Lanklaas
  • 2,870
  • 1
  • 15
  • 18
2
votes
1 answer

Use hyper crate Body as Future crate Stream parameter

Using the hyper crate, I'm making an HTTP request to an endpoint then subsequently attempting to pass the response Body to a third-party library that expects a parameter to be a Futures crate Stream. This results in a type…
webish
  • 701
  • 2
  • 9
  • 17
2
votes
2 answers

Deserialize map of remote structs using serde_json

I have a use case that requires deserializing JSON into a map of "remote" (defined in another crate) structs. I've had a laughably difficult time with this, so I must be missing something obvious. The following is essentially the desired end…
Mike Marcacci
  • 1,913
  • 1
  • 18
  • 24