Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:23
    caspiano edited #10531
  • Dec 08 23:04
    HertzDevil edited #12623
  • Dec 08 22:57
    Blacksmoke16 edited #9745
  • Dec 08 22:57
    Blacksmoke16 labeled #9745
  • Dec 08 22:57
    Blacksmoke16 labeled #9745
  • Dec 08 22:54
    HertzDevil labeled #12828
  • Dec 08 22:54
    HertzDevil labeled #12828
  • Dec 08 22:54
    HertzDevil opened #12828
  • Dec 08 22:34
    straight-shoota edited #12827
  • Dec 08 22:32
    straight-shoota edited #12827
  • Dec 08 22:29
    straight-shoota labeled #12827
  • Dec 08 22:29
    straight-shoota labeled #12827
  • Dec 08 22:29
    straight-shoota opened #12827
  • Dec 08 22:15
    straight-shoota closed #12814
  • Dec 08 17:12
    straight-shoota assigned #12814
  • Dec 08 17:12
    straight-shoota assigned #12813
  • Dec 08 17:12
    straight-shoota assigned #12809
  • Dec 08 17:12
    straight-shoota assigned #12802
  • Dec 08 17:12
    straight-shoota assigned #12797
  • Dec 08 17:12
    straight-shoota assigned #12664
ddd
@Dan-Do
(un)comment the line that works your you
From IRC (bridge bot)
@FromIRC
<SamantazFox> haaaaaaa flails
<SamantazFox> thanks!
<SamantazFox> whyyyy
<SamantazFox> why is the body_io niled?
<yxhuvud> Why does it matter to you?
From IRC (bridge bot)
@FromIRC
<SamantazFox> yxhuvud: because of a bug in the stdlib, a response's body is not always decompressed, and rather than checking if it was properly done, I've made a patch in my code to send the Content-Encoding header, which disables auto decompression, and do that by myself.
<SamantazFox> but, Compress::Gzip::Reader and Compress::Deflate::Reader both takes IOs, not Strings
<yxhuvud> if gets to end has been called, it will be nothing more to decompress anyhow, so it wouldn't matter
<SamantazFox> my problem is that response.body is a String, and I have to feed it to Compress::Gzip::Reader
George Dietrich
@Blacksmoke16
body_io is only set if you're using the block version of one of the request methods
From IRC (bridge bot)
@FromIRC
<SamantazFox> So I though: let's use response.body_io instead, to directly have an IO
George Dietrich
@Blacksmoke16
From IRC (bridge bot)
@FromIRC
<straight-shoota> There is no way to access either body or body_io. They're mutually exclusive
<SamantazFox> That's something I'd expect, yeah, but why body is always the full body, as a String and body_io is that same body as IO, but Nil on Docker?
<straight-shoota> Sorry what has Docker to do with this?
<SamantazFox> I'm trying to figure that out, actually.
<SamantazFox> For context, I've made this code, to prevent an issue from happenning: https://github.com/iv-org/invidious/pull/2623/files
<SamantazFox> Said issue is: "body is sometimes decompressed, sometimes not"
From IRC (bridge bot)
@FromIRC
<SamantazFox> So, I've set "Content-Encoding" to "gzip, deflate" to disable HTTP::Client's auto-decompression, and added the required logic to decompress the body by myself
<SamantazFox> problem is that when deployed on bare-metal, it works fine, and on Docker, we're getting this: iv-org/invidious#2632
George Dietrich
@Blacksmoke16
i mean is it not possible you're doing like HTTP::Client.get "..." then trying to access body_io on it?
From IRC (bridge bot)
@FromIRC
<SamantazFox> response.body_io, yes.
George Dietrich
@Blacksmoke16
response = HTTP::Client.get("...")
response.body # okay
response.body_io # not okay

HTTP::Client.get("...") do |response|
  response.body # not okay
  response.body_io # okay
end
From IRC (bridge bot)
@FromIRC
<SamantazFox> Why is it "not okay"?
<SamantazFox> oops, wrong link
<SamantazFox> better
George Dietrich
@Blacksmoke16
because body_io is only set in the context of using the block overload, so body wouldnt be set
while if you used the non block overload body is set and body_io is not
by "not okay" meaning it'll raise saying it shouldn't be nil
if you try to use it in not the right context
From IRC (bridge bot)
@FromIRC
<SamantazFox> Oh, I misunderstood the code snippet you provided
<SamantazFox> Ok, I get it now.
<SamantazFox> Why isn't that mentionned in the API doc?!
George Dietrich
@Blacksmoke16
From IRC (bridge bot)
@FromIRC
<SamantazFox> Ok, thanks y'all
<SamantazFox> Now, I'm wondering why it works sometimes, and not others.
<SamantazFox> And of course impàlement that properly
From IRC (bridge bot)
@FromIRC
<SamantazFox> What's the most recommended? Foo::Bar.echo or Toto::Foo::Bar.echo
George Dietrich
@Blacksmoke16
probably doesnt really matter, could argue the former since its shorter, or the latter because its more clear what specific type it points to
j8r
@jrei:matrix.org
[m]
In rare cases you have no choice of the latter if the stdlib uses the same name
From IRC (bridge bot)
@FromIRC
<SamantazFox> mmmh, okay, thanks :⁠)
Paulo Coghi
@paulocoghi
@naqvis Wow!
Ali Naqvi
@naqvis
:+1:
From IRC (bridge bot)
@FromIRC
<spuun> I have a MetaVar (from @type.instance_vars) which i know is a Hash, but i want to get the key and value types. How? I want to go from the MetaVar to a HashLiteral, I think?
From IRC (bridge bot)
@FromIRC
<spuun> type.type_vars is enough