Comments (6)
This might be caused by default configuration of RequestBuilder
in newest version of the crate. By default it doesn't include header Connection: Close
in request message. This means that connection will not be closed after completion of the response.
Please try adding header Connection: Close
by using header
method on created RequestBuilder
. (builder.header("Connection", "Close")
).
Please also check out full example.
from http_req.
@jayjamesjay also i am really confused why do we have to pass a TCP connection isn't the entire idea of a HTTP client to do things autonomously
from http_req.
@NikosEfthias I think I understand you point. This approach may seem strange. My intention is to give user of the library option to use any struct
which implements Read
and Write
as a stream. They might use TcpStream
from std
, define their own struct
, etc.
I realized that I should have mentioned all those things in the documentation.
I'm going to provide implementation of methods header
and headers
for Request
(which automatically creates TcpStream
/TlsStream
) with the next version of the crate.
from http_req.
@jayjamesjay would you accept a PR which adds a convenience method to construct the underlying TcpStream?
from http_req.
@brycefisher Please explain me your idea in more details. I didn't add any special function to help in creating a TcpStream for RequestBuilder, because I hadn't thought that it might be useful - in the current version of crate request can be created using Request
with default TcpStream or RequestBuilder
and then make use of any TcpStream (struct with implemented Write
and Read
). In both cases you can modify request parameters (headers, request method, body) with the nearly the same functions (except for http version
, which I haven't added yet).
from http_req.
@jayjamesjay -- ah! I misunderstood the API. I see now what you mean and that my offer doesn't really make sense.
from http_req.
Related Issues (20)
- Steam issue or how can i send special Request-Headers? HOT 2
- Uri::from_str(<ipv6>) fails HOT 3
- Relative paths aren't parsed HOT 3
- Documentation on connection timeout is misleading HOT 3
- No way to set timeout for the entire request, which allows DoS attacks HOT 7
- Panic in http_req::request::Request::send on fetching some websites HOT 3
- async support HOT 5
- Why is there wired prefix and suffix in https response? HOT 3
- Proxy support HOT 2
- The http2-based TLS doesn't work
- Cannot send http post request with body HOT 3
- Rewrite functions to make use of `const fn`
- Replace `FromStr` with equivalent `TryFrom` for both `Uri` and `Authority` HOT 1
- copy_with_timeout() may exceed its timeout HOT 1
- 0.8 fails to build with rusttls HOT 4
- Why add "Referer" header by default HOT 3
- Blocked when response state is 204 HOT 1
- Little Help
- Update rustls to 0.21.7 HOT 4
- Make stream public in Conn struct HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http_req.