]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 2633 fix: Ecap::HeaderRep::value(name) fails when there is no named header
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 23 May 2010 16:43:46 +0000 (10:43 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 23 May 2010 16:43:46 +0000 (10:43 -0600)
commit5e6f9b9267737fe76886c5d3bccfc44cad963204
tree6bacd124b773937ba82b2d35cc16af15c475075e
parent253939cd4e46276c731af51424ad6cf7be8921f8
Bug 2633 fix: Ecap::HeaderRep::value(name) fails when there is no named header
field

Calling Adaptation::Ecap::HeaderRep::value(const Name &name) with names
of header fields that do not exist leads to

    ICAP/AsyncJob.cc(218) dial: AsyncJob::noteStart threw exception:
    basic_string::_S_construct NULL not valid

I suspect this is a combination of
 - std::string constructor incapable of handling a nil char* pointer.
 - String::termedBuf() returning an nil pointer when the string is empty.

When there is no specified header field in the message, the value()
wrapper in Squid gets an empty String for the header value, which is
then used to create std::string, which fails or leads to failure.

I think it is wrong for termedBuf to return nil (because nil is not
0-terminated). I have not tried to fix that because we will have a new
String class soon.
src/adaptation/ecap/MessageRep.cc