I
Iñaki Baz Castillo
Hi, in Ruby 1.8 there is an issue when adding more and more Symbols
since they remain in memory and are never removed.
I'm doing a server in Ruby that receives messages with headers (From,
To, Subject, X-Custom-Header-1...) and after parsing I store the
headers in a hash using symbols as keys:
headers =3D {
:from =3D> "(e-mail address removed)",
:to =3D> "(e-mail address removed)",
:"x-custom-header-1" =3D> "Hi there"
}
I could use strings as keys instead of symbols, but I've checked that
getting a Hash entry is ~25% faster using Symbols.
The problem is that I could receive custom headers so for each one a
new Symbol would be created. An attacker could send lots of custom
headers to fill the server memory and cause a denial of service.
Perhaps this is solved in Ruby 1.9? any suggestion on it? Thanks a lot.
--=20
I=C3=B1aki Baz Castillo
<[email protected]>
since they remain in memory and are never removed.
I'm doing a server in Ruby that receives messages with headers (From,
To, Subject, X-Custom-Header-1...) and after parsing I store the
headers in a hash using symbols as keys:
headers =3D {
:from =3D> "(e-mail address removed)",
:to =3D> "(e-mail address removed)",
:"x-custom-header-1" =3D> "Hi there"
}
I could use strings as keys instead of symbols, but I've checked that
getting a Hash entry is ~25% faster using Symbols.
The problem is that I could receive custom headers so for each one a
new Symbol would be created. An attacker could send lots of custom
headers to fill the server memory and cause a denial of service.
Perhaps this is solved in Ruby 1.9? any suggestion on it? Thanks a lot.
--=20
I=C3=B1aki Baz Castillo
<[email protected]>