]> git.tdb.fi Git - libs/net.git/commitdiff
Fix header name normalization logic
authorMikko Rasa <tdb@tdb.fi>
Mon, 16 May 2016 15:15:29 +0000 (18:15 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 16 May 2016 15:16:34 +0000 (18:16 +0300)
If the name begins with a hyphen, the following letter shall be
uppercased.

source/http/message.cpp

index 92321e8a87bd4c953f039141724c621c2d977ac2..b86f95495eb267639bbc1bdf9ee58662dd198bf1 100644 (file)
@@ -135,13 +135,13 @@ string Message::normalize_header_name(const string &hdr) const
        bool upper = true;
        for(string::iterator i=result.begin(); i!=result.end(); ++i)
        {
        bool upper = true;
        for(string::iterator i=result.begin(); i!=result.end(); ++i)
        {
-               if(upper)
+               if(*i=='-')
+                       upper = true;
+               else if(upper)
                {
                        *i = toupper(*i);
                        upper = false;
                }
                {
                        *i = toupper(*i);
                        upper = false;
                }
-               else if(*i=='-')
-                       upper = true;
                else
                        *i = tolower(*i);
        }
                else
                        *i = tolower(*i);
        }