chenBright commented on code in PR #3606:
URL: https://github.com/apache/brpc/pull/3606#discussion_r4366186113


##########
src/brpc/http_header.h:
##########
@@ -202,7 +215,13 @@ friend void policy::ProcessHttpRequest(InputMessageBase 
*msg);
     std::string _content_type;
     std::string _unresolved_path;
     std::pair<int, int> _version;
-    std::string* _first_set_cookie;
+    // HeaderMap rehashing invalidates value pointers and does not preserve
+    // duplicate-key order. deque keeps existing value pointers stable when
+    // another Set-Cookie header is appended.
+    typedef std::deque<std::pair<std::string, std::string> > SetCookieHeaders;

Review Comment:
   Consider simplifying `SetCookieHeaders` to `std::deque<std::string>`. All 
entries represent `Set-Cookie` headers, so storing the key for each entry is 
redundant. `SyncSetCookieHeaders()` can use the existing `SET_COOKIE` constant 
when inserting values into `_headers`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to