Project

General

Profile

Actions

Bug #20077

closed

modern http client

Added by pynix (Pynix wang) 6 months ago. Updated 6 months ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:115836]

Description

net/http is very very old and hard to use.

we need a well designed http client in stdlib.

Updated by kjtsanaktsidis (KJ Tsanaktsidis) 6 months ago

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

Updated by k0kubun (Takashi Kokubun) 6 months ago

For GET and POST, modern Ruby does have APIs that aren't hard to use. I wonder if you have used them.

Updated by pynix (Pynix wang) 6 months ago

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.

Updated by k0kubun (Takashi Kokubun) 6 months ago

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.

Updated by pynix (Pynix wang) 6 months ago

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0