[ruby-core:115836] [Ruby master Bug#20077] modern http client

Issue #20077 has been reported by pynix (Pynix wang). ---------------------------------------- Bug #20077: modern http client https://bugs.ruby-lang.org/issues/20077 * Author: pynix (Pynix wang) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- net/http is very very old and hard to use. we need a well designed http client in stdlib. -- https://bugs.ruby-lang.org/

Issue #20077 has been updated by kjtsanaktsidis (KJ Tsanaktsidis). Status changed from Open to Feedback It would be good if you could outline in more detail: * What, exactly, about net/http you find hard to use? * Some use-cases where net/http causes problems which could be improved with a different client interface * Why this use-case can't be solved by using one of the many popular Rubygems for this, like Faraday, HTTParty, etc? * What you feel the relationship between stdlib & these gems should be? * Since you mentioned that it's "very very old", whether there is something specific about its age which is a problem? (e.g. are there design assumptions it makes which no longer stack up today?) Without a more specific use-case beyond "net/http is hard to use" it's hard to have a meaningful discussion. ---------------------------------------- Bug #20077: modern http client https://bugs.ruby-lang.org/issues/20077#change-105791 * Author: pynix (Pynix wang) * Status: Feedback * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- net/http is very very old and hard to use. we need a well designed http client in stdlib. -- https://bugs.ruby-lang.org/

Issue #20077 has been updated by k0kubun (Takashi Kokubun). For GET and POST, modern Ruby does have APIs that aren't hard to use. I wonder if you have used them. * `Net::HTTP.get(uri, headers = {})`: Ruby 3.0+ https://bugs.ruby-lang.org/issues/16686 * `Net::HTTP.post(uri, body, headers = {})`: Ruby 2.4+ https://bugs.ruby-lang.org/issues/12375 ---------------------------------------- Bug #20077: modern http client https://bugs.ruby-lang.org/issues/20077#change-105796 * Author: pynix (Pynix wang) * Status: Feedback * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- net/http is very very old and hard to use. we need a well designed http client in stdlib. -- https://bugs.ruby-lang.org/

Issue #20077 has been updated by pynix (Pynix wang). HTTP.get return body as string, other http method return response there is get_print, maybe for scripting. HTTP:Client api is also hard to use. can we deprecate net/* and get an modern http client (or server) in std. http.rb is great. ---------------------------------------- Bug #20077: modern http client https://bugs.ruby-lang.org/issues/20077#change-105797 * Author: pynix (Pynix wang) * Status: Feedback * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- net/http is very very old and hard to use. we need a well designed http client in stdlib. -- https://bugs.ruby-lang.org/

Issue #20077 has been updated by k0kubun (Takashi Kokubun).
HTTP.get return body as string, other http method return response there is get_print, maybe for scripting.
If you look at what `HTTP.get` does, it's just `HTTP.get_response(...).body`. You may use `HTTP.get_response` for that purpose. ---------------------------------------- Bug #20077: modern http client https://bugs.ruby-lang.org/issues/20077#change-105798 * Author: pynix (Pynix wang) * Status: Feedback * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- net/http is very very old and hard to use. we need a well designed http client in stdlib. -- https://bugs.ruby-lang.org/

Issue #20077 has been updated by pynix (Pynix wang). I know,but this is the bad part,they are http verb,but some return response,some return body string. all verb method should return response object, modify net/http will break compatibility. so I suggest opt out net/http and webrick, introduce new http/client and http/server based on llhttp that nodejs used. ---------------------------------------- Bug #20077: modern http client https://bugs.ruby-lang.org/issues/20077#change-105810 * Author: pynix (Pynix wang) * Status: Feedback * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- net/http is very very old and hard to use. we need a well designed http client in stdlib. -- https://bugs.ruby-lang.org/
participants (3)
-
k0kubun (Takashi Kokubun)
-
kjtsanaktsidis (KJ Tsanaktsidis)
-
pynix (Pynix wang)