straight-shoota has quit [Ping timeout: 246 seconds]
jhass has quit [Ping timeout: 246 seconds]
straight-shoota has joined #crystal-lang
jhass has joined #crystal-lang
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp has joined #crystal-lang
brw has joined #crystal-lang
brw has joined #crystal-lang
brw has joined #crystal-lang
brw has joined #crystal-lang
_ht has joined #crystal-lang
brw has joined #crystal-lang
brw has joined #crystal-lang
jhass has quit [Ping timeout: 256 seconds]
straight-shoota has quit [Ping timeout: 256 seconds]
straight-shoota has joined #crystal-lang
jhass has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
Orestes74 has joined #crystal-lang
Orestes74 has quit [Quit: Client closed]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
hightower2 has joined #crystal-lang
hightower2 has quit [Ping timeout: 268 seconds]
hightower2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
hightower2 has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
_ht has joined #crystal-lang
jmdaemon has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
<
ober>
Body: #<HTTP::FixedLengthContent:0x7f08e6bb83f0> still not printing. and won't take .gets_to_end
<
Blacksmoke16Geor>
are you using the block version of one of the HTTP methods on HTTP::Client?
<
ober>
request.body
<
ober>
request = HTTP::Client.new(remote_host, remote_port, tls: true)
<
Blacksmoke16Geor>
assuming this is the same code from the gist yesterday, what you have should just work
<
Blacksmoke16Geor>
response is a HTTP::Client::Response and #body : String
<
Blacksmoke16Geor>
can you share the actual error you get?
<
ober>
it's not an error, it's just I get the type description instead of the content there in.
<
ober>
i.e. I'm trying to print the request body
<
Blacksmoke16Geor>
right, based on your code thats what you're doing
<
Blacksmoke16Geor>
you're writing the response body from the client request, to the server response obj
<
ober>
so what is the proper way to dereference the request.body for logging?
<
Blacksmoke16Geor>
oh so this is about logging the initial server request body?
<
ober>
right since this is a proxy.
<
Blacksmoke16Geor>
okay, that makes more sense. you mentioned HTTP::Client.new so was thinking you were talking about that
<
ober>
sorry, for the confusion
<
Blacksmoke16Geor>
and why doesn't gets_to_end work?
<
ober>
57 | "#{request.body.gets_to_end}"
<
ober>
Error: undefined method 'gets_to_end' for Nil (compile-time type is (IO | Nil))
Sankalp has quit [Ping timeout: 268 seconds]
<
Blacksmoke16Geor>
ah okay
<
Blacksmoke16Geor>
you just need to ensure there is a body in the first place
<
Blacksmoke16Geor>
```crystal
<
ober>
right it's in the `if request.body` stanza
<
Blacksmoke16Geor>
`request.body.try? &.gets_to_end`
<
Blacksmoke16Geor>
doesnt actually work like that
Sankalp has joined #crystal-lang
<
ober>
Content-Length header is 5764 but body had 0 bytes (ArgumentError). guess I need to validate the actual size of it.
<
Blacksmoke16Geor>
keep in mind if you already consumed the request body, idt you can rewind it
<
Blacksmoke16Geor>
i.e. cant do two .gets_to_end on request.body
<
ober>
oh so that could break the proxy then. can I copy it then gets_to_end on that?
<
ober>
hmm that does not work
<
Blacksmoke16Geor>
does not work in what regard?
<
ober>
body = request.body, then gets.to_end on body, results in request.body being zero length
<
Blacksmoke16Geor>
right
<
Blacksmoke16Geor>
its an IO, once you read it it's consumed and idt you can rewind it
<
ober>
is there a way to dup the value?
<
ober>
got it working. thank you for your help Blacksmoke16Geor
jmdaemon has quit [Ping timeout: 268 seconds]
_ht has quit [Quit: _ht]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp has joined #crystal-lang
ur5us has joined #crystal-lang
tprepper has joined #crystal-lang
dmgk_ has joined #crystal-lang
ur5us has quit [*.net *.split]
taupiqueur has quit [*.net *.split]
Vexatos has quit [*.net *.split]
Stephie has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
dmgk has quit [*.net *.split]
olbat has quit [*.net *.split]
dmgk_ is now known as dmgk
taupiqueur has joined #crystal-lang
olbat has joined #crystal-lang
dostoyevsky2 has joined #crystal-lang
ur5us has joined #crystal-lang
Stephie has joined #crystal-lang
Vexatos has joined #crystal-lang
taupiqueur has quit [Max SendQ exceeded]
taupiqueur has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang