You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "lhsoft (via GitHub)" <gi...@apache.org> on 2023/09/19 06:51:50 UTC

[PR] use AppendHeader for http2 (brpc)

lhsoft opened a new pull request, #2387:
URL: https://github.com/apache/brpc/pull/2387

   ### What problem does this PR solve?
   
   Issue Number:
   
   Problem Summary:
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects(性能影响):
   
   - Breaking backward compatibility(向后兼容性): 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "lhsoft (via GitHub)" <gi...@apache.org>.
lhsoft commented on code in PR #2387:
URL: https://github.com/apache/brpc/pull/2387#discussion_r1330925273


##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   The test case is `http2_header_after_data`.  
   For http2,  according to the rfc : [ https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2](url), it shouldn't be expected to be overwritten



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on code in PR #2387:
URL: https://github.com/apache/brpc/pull/2387#discussion_r1330049003


##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   The original test case was written as "overwrite-a", was it expected to be overwritten? Changing the behavior here may not conform to the previous design.



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "zyearn (via GitHub)" <gi...@apache.org>.
zyearn commented on code in PR #2387:
URL: https://github.com/apache/brpc/pull/2387#discussion_r1339124802


##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   RFC doesn't mention overwritten. It says: Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)].
   
   In brpc implementation, if the incoming header is in the format of "key:value1,value2,value3", brpc won't overwrite cases like this. But combining headers seems reasonable otherwise the previous header would be lost.



##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   LGTM



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on code in PR #2387:
URL: https://github.com/apache/brpc/pull/2387#discussion_r1333832158


##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   Do you know why it was designed to overwrite before? @zyearn 



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "lhsoft (via GitHub)" <gi...@apache.org>.
lhsoft commented on code in PR #2387:
URL: https://github.com/apache/brpc/pull/2387#discussion_r1330925273


##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   The test case is `http2_header_after_data`.  
   For http2,  according to the [rfc](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2) , it shouldn't be expected to be overwritten.
   The [grpc](https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md) use map[string][]string for header:
   ```
   md := metadata.Pairs(
       "key1", "val1",
       "key1", "val1-2", // "key1" will have map value []string{"val1", "val1-2"}
       "key2", "val2",
   )
   ```



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "Huixxi (via GitHub)" <gi...@apache.org>.
Huixxi merged PR #2387:
URL: https://github.com/apache/brpc/pull/2387


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] use AppendHeader for http2 (brpc)

Posted by "lhsoft (via GitHub)" <gi...@apache.org>.
lhsoft commented on code in PR #2387:
URL: https://github.com/apache/brpc/pull/2387#discussion_r1330925273


##########
test/brpc_http_rpc_protocol_unittest.cpp:
##########
@@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) {
     ASSERT_EQ(res_header.content_type(), "application/proto");
     // Check overlapped header is overwritten by the latter.
     const std::string* user_defined1 = res_header.GetHeader("user-defined1");
-    ASSERT_EQ(*user_defined1, "overwrite-a");
+    ASSERT_EQ(*user_defined1, "a,overwrite-a");

Review Comment:
   The test case is `http2_header_after_data`.  
   For http2,  according to the rfc : [ https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2](url), it shouldn't be expected to be overwritten.
   The [grpc](https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md) use map[string][]string for header:
   ```
   md := metadata.Pairs(
       "key1", "val1",
       "key1", "val1-2", // "key1" will have map value []string{"val1", "val1-2"}
       "key2", "val2",
   )
   ```



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org