Git Product home page Git Product logo

Comments (6)

jayjamesjay avatar jayjamesjay commented on August 28, 2024

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.

ta3pks avatar ta3pks commented on August 28, 2024

@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.

jayjamesjay avatar jayjamesjay commented on August 28, 2024

@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.

brycefisher avatar brycefisher commented on August 28, 2024

@jayjamesjay would you accept a PR which adds a convenience method to construct the underlying TcpStream?

from http_req.

jayjamesjay avatar jayjamesjay commented on August 28, 2024

@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.

brycefisher avatar brycefisher commented on August 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.