<splud>
I'm using TCPServer class for an extremely minimalistic http transaction. client is POSTing a file. I'm parsing the headers, all this is good, stuff works. However, I want to deal with error conditions in advance of suffering the whole transfer.
<splud>
namely, I have content size - if this is too much (either in excess of the agreed upon max size, or for some reason, available device space is less than this), I'd like to NOT accept the content and be able to return an HTTP error 9what that is is a different matter. But the client won't get anything I send until they're done sending, right?
<splud>
in the typical http POST.
<splud>
how can I return an error before accepting everything?
<splud>
notet that multipart means that the content-size as given in the HTTP header may not be any ONE file. Also, there may be errors thrown for proffered filenames irrespective of size, and those are not known until the mime chunks are being parsed.
ur5us_ has joined #ruby
jacktar has quit [Ping timeout: 244 seconds]
jacktar has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
ollysmith has quit [Ping timeout: 240 seconds]
ollysmith has joined #ruby
caleb_ has joined #ruby
caleb_ has quit [Quit: leaving]
skali has joined #ruby
<splud>
So, I'm guessing nobody handles POST method with web services in ruby, or just trusts some framework to handle stuff?
<splud>
My problem is that if someone posts several hundred MB of content, that balloons the memory used by the ruby process long before my own code sees it, so I've had to implement my own TCPServer...
mrkz_c has quit [Quit: Connection closed for inactivity]
viole has joined #ruby
<viole>
anyone has experience with ROM?
<viole>
I'm really frustrated trying to get started. Tthere's not a single working simple example
<adam12>
easbarbosa: You need to have bundler setup somehow. This can happen two ways: `bundle exec <your ruby command` or by `require "bundler/setup"`.
<adam12>
easbarbosa: It sounds like that's not happening.
wasamasa has left #ruby [Bye]
<easbarbosa>
adam12: haha, thanks!
Qchmqs has quit [Ping timeout: 252 seconds]
<adam12>
easbarbosa: yw!
goldfish has quit [Remote host closed the connection]
ox is now known as oz
goldfish has joined #ruby
Garb00 has quit [Quit: Garb00]
Qchmqs has joined #ruby
Qchmqs has quit [Changing host]
Qchmqs has joined #ruby
bandithijo has quit [Quit: WeeChat 3.2-rc1]
bandithijo has joined #ruby
bandithijo has quit [Quit: WeeChat 3.2-rc1]
<nakilon>
imagine {1 => 1, 2 => 123, 3 => 0} and that I want to chose random key proportinal to value
<nakilon>
so I do h.flat_map{ |k,v| [k]*v }.sample
<nakilon>
but how do I do the same if values are floats?
<EdwardIII>
nakilon: using something like gtk/dragonruby?
<nakilon>
nope, ruby-vips and ffmpeg
<EdwardIII>
neat
Garb0 has quit [Ping timeout: 252 seconds]
TomyWork has quit [Quit: Leaving]
Nyeogmi has joined #ruby
Nyeogmi has quit [Changing host]
Nyeogmi has joined #ruby
Garb0 has joined #ruby
easbarbosa has quit [Ping timeout: 252 seconds]
Garb0 has quit [Quit: Garb0]
diophantoz has left #ruby [#ruby]
menace has joined #ruby
reset has joined #ruby
<leftylink>
weighted random... interesting. I guess you'd sum them up and divide each by the sum to map each to a range of values between 0 and 1, and then just rand
gcd has quit [*.net *.split]
legahc has quit [*.net *.split]
kenichi has quit [*.net *.split]
peder has quit [*.net *.split]
riceandbeans has quit [*.net *.split]
lipoqil has quit [*.net *.split]
_axx has quit [*.net *.split]
gfawcett has quit [*.net *.split]
EdwardIII has quit [*.net *.split]
eam has quit [*.net *.split]
cnsvc has quit [*.net *.split]
rodd has quit [*.net *.split]
kinduff has quit [*.net *.split]
splud has quit [*.net *.split]
aesthetikx has quit [*.net *.split]
forvelin has quit [*.net *.split]
kenichi has joined #ruby
eam has joined #ruby
kinduff has joined #ruby
peder has joined #ruby
riceandbeans has joined #ruby
lipoqil has joined #ruby
splud has joined #ruby
aesthetikx has joined #ruby
forvelin has joined #ruby
gcd has joined #ruby
legahc has joined #ruby
_axx has joined #ruby
EdwardIII has joined #ruby
gfawcett has joined #ruby
rodd has joined #ruby
cnsvc has joined #ruby
postmodern has joined #ruby
Garb0 has joined #ruby
Qchmqs has joined #ruby
Qchmqs has quit [Changing host]
Qchmqs has joined #ruby
jetchisel has quit [Ping timeout: 240 seconds]
jetchisel has joined #ruby
ignorand1 has joined #ruby
ignorand has quit [Ping timeout: 252 seconds]
jetchisel has quit [Ping timeout: 252 seconds]
_ht has quit [Remote host closed the connection]
Qchmqs_ has joined #ruby
Qchmqs has quit [Ping timeout: 246 seconds]
ignorand1 has quit [Ping timeout: 252 seconds]
jacktar has quit [Ping timeout: 244 seconds]
jacktar has joined #ruby
Garb0 has quit [Ping timeout: 240 seconds]
Garb0 has joined #ruby
ignorand has joined #ruby
Garb0 has quit [Read error: Connection reset by peer]