walklown commented on PR #14026:
URL: https://github.com/apache/dubbo/pull/14026#issuecomment-2076889743

   > > > Test `org.apache.dubbo.demo.provider.ApiProvider` with curl:
   > > > ```
   > > > curl.exe -v --http2 -k -H "Content-Type: application/json" -d '"asd"' 
http://127.0.0.1:50051/org.apache.dubbo.demo.GreeterService/sayHelloAsync
   > > > ```
   > > > 
   > > > 
   > > >     
   > > >       
   > > >     
   > > > 
   > > >       
   > > >     
   > > > 
   > > >     
   > > >   
   > > > but upgrade failed, could you please take a look? 
![image](https://private-user-images.githubusercontent.com/716461/325296326-94c2ab96-7d9f-4501-ac08-57d414a37821.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTQwMTM4OTUsIm5iZiI6MTcxNDAxMzU5NSwicGF0aCI6Ii83MTY0NjEvMzI1Mjk2MzI2LTk0YzJhYjk2LTdkOWYtNDUwMS1hYzA4LTU3ZDQxNGEzNzgyMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNDI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDQyNVQwMjUzMTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xYThjODZlYjZlYjQ0MWU2OTU5YmUyOGVlNmM1M2EzZDY2ZWNiYzAzZWQ0YTRiZDFjMTZiMzQzZDFjNzJlNzg3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.JKdyX8HrY6s6lgk8n-oIWn91P9LaY-GNW0sQ9QWo4e8)
   > > 
   > > 
   > > Because you specified a http scheme (and not https), and asked curl to 
use HTTP/2, then curl will attempt to perform a HTTP/1.1 upgrade to HTTP/2, as 
can be seen from the logs.
   > > Typical HTTP/1.1 upgrades are performed using GET, not POST, notably the 
HTTP/1.1 upgrade to WebSocket.
   > > The server does not seem to be prepared to accept a POST with a body as 
an attempt to upgrade and replies with 413 because it does not expect a body.
   > > If you try a GET without body it will likely succeed.
   > > Alternatively, if you know that port 8889 accepts prior-knowledge 
clear-text HTTP/2 (that is, you can send directly HTTP/2 bytes to that port 
without having to perform a HTTP/1.1 upgrade), you can try:
   > > `curl -v --http2-prior-knowledge -X POST -k -H 
"content-type:application/json" -d '["myFirstParameter"]' 
http://127.0.0.1:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello`
   > > 
![image](https://private-user-images.githubusercontent.com/22697462/325495591-614ede50-314e-4ac9-92a1-060405e7ef87.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTQwMjkxMjEsIm5iZiI6MTcxNDAyODgyMSwicGF0aCI6Ii8yMjY5NzQ2Mi8zMjU0OTU1OTEtNjE0ZWRlNTAtMzE0ZS00YWM5LTkyYTEtMDYwNDA1ZTdlZjg3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDI1VDA3MDcwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzZGE4NDcyM2IzMWEwZjQyMGZlNmY3ZDNlNDY2ZWYzZTg3NjhjZDczMDUwODAxZWFlN2EyYzBhZDgzYTFiZTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AsDhJ3nUlf4URnX-22QRbBtSyryHXf1Ek_l9hppiWqE)
   > > `$ curl -v --http2-prior-knowledge -X POST -k -H 
"content-type:application/json" -d '["myFirstParameter"]' 
http://127.0.0.1:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello 
Note: Unnecessary use of -X or --request, POST is already inferred.
   > > 
   > > * Trying 127.0.0.1:50052...
   > > * Connected to 127.0.0.1 (127.0.0.1) port 50052
   > > * [HTTP/2] [1] OPENED stream for 
http://127.0.0.1:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello
   > > * [HTTP/2] [1] [:method: POST]
   > > * [HTTP/2] [1] [:scheme: http]
   > > * [HTTP/2] [1] [:authority: 127.0.0.1:50052]
   > > * [HTTP/2] [1] [:path: 
/org.apache.dubbo.springboot.demo.DemoService/sayHello]
   > > * [HTTP/2] [1] [user-agent: curl/8.5.0]
   > > * [HTTP/2] [1] [accept: _/_]
   > > * [HTTP/2] [1] [content-type: application/json]
   > > * [HTTP/2] [1] [content-length: 20]
   > > 
   > > > POST /org.apache.dubbo.springboot.demo.DemoService/sayHello HTTP/2
   > > > Host: 127.0.0.1:50052
   > > > User-Agent: curl/8.5.0
   > > > Accept: _/_
   > > > content-type:application/json
   > > > Content-Length: 20
   > > 
   > > 
   > > < HTTP/2 200 < te: trailers < content-type: application/json <
   > > 
   > > * Connection #0 to host 127.0.0.1 left intact
   > >   "Hello myFirstParameter"`
   > 
   > > > Test `org.apache.dubbo.demo.provider.ApiProvider` with curl:
   > > > ```
   > > > curl.exe -v --http2 -k -H "Content-Type: application/json" -d '"asd"' 
http://127.0.0.1:50051/org.apache.dubbo.demo.GreeterService/sayHelloAsync
   > > > ```
   > > > 
   > > > 
   > > >     
   > > >       
   > > >     
   > > > 
   > > >       
   > > >     
   > > > 
   > > >     
   > > >   
   > > > but upgrade failed, could you please take a look? 
![image](https://private-user-images.githubusercontent.com/716461/325296326-94c2ab96-7d9f-4501-ac08-57d414a37821.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTQwMTM4OTUsIm5iZiI6MTcxNDAxMzU5NSwicGF0aCI6Ii83MTY0NjEvMzI1Mjk2MzI2LTk0YzJhYjk2LTdkOWYtNDUwMS1hYzA4LTU3ZDQxNGEzNzgyMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNDI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDQyNVQwMjUzMTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xYThjODZlYjZlYjQ0MWU2OTU5YmUyOGVlNmM1M2EzZDY2ZWNiYzAzZWQ0YTRiZDFjMTZiMzQzZDFjNzJlNzg3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.JKdyX8HrY6s6lgk8n-oIWn91P9LaY-GNW0sQ9QWo4e8)
   > > 
   > > 
   > > Because you specified a http scheme (and not https), and asked curl to 
use HTTP/2, then curl will attempt to perform a HTTP/1.1 upgrade to HTTP/2, as 
can be seen from the logs.
   > > Typical HTTP/1.1 upgrades are performed using GET, not POST, notably the 
HTTP/1.1 upgrade to WebSocket.
   > > The server does not seem to be prepared to accept a POST with a body as 
an attempt to upgrade and replies with 413 because it does not expect a body.
   > > If you try a GET without body it will likely succeed.
   > > Alternatively, if you know that port 8889 accepts prior-knowledge 
clear-text HTTP/2 (that is, you can send directly HTTP/2 bytes to that port 
without having to perform a HTTP/1.1 upgrade), you can try:
   > > `curl -v --http2-prior-knowledge -X POST -k -H 
"content-type:application/json" -d '["myFirstParameter"]' 
http://127.0.0.1:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello`
   > > 
![image](https://private-user-images.githubusercontent.com/22697462/325495591-614ede50-314e-4ac9-92a1-060405e7ef87.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTQwMjkxMjEsIm5iZiI6MTcxNDAyODgyMSwicGF0aCI6Ii8yMjY5NzQ2Mi8zMjU0OTU1OTEtNjE0ZWRlNTAtMzE0ZS00YWM5LTkyYTEtMDYwNDA1ZTdlZjg3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA0MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNDI1VDA3MDcwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzZGE4NDcyM2IzMWEwZjQyMGZlNmY3ZDNlNDY2ZWYzZTg3NjhjZDczMDUwODAxZWFlN2EyYzBhZDgzYTFiZTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AsDhJ3nUlf4URnX-22QRbBtSyryHXf1Ek_l9hppiWqE)
   > > `$ curl -v --http2-prior-knowledge -X POST -k -H 
"content-type:application/json" -d '["myFirstParameter"]' 
http://127.0.0.1:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello 
Note: Unnecessary use of -X or --request, POST is already inferred.
   > > 
   > > * Trying 127.0.0.1:50052...
   > > * Connected to 127.0.0.1 (127.0.0.1) port 50052
   > > * [HTTP/2] [1] OPENED stream for 
http://127.0.0.1:50052/org.apache.dubbo.springboot.demo.DemoService/sayHello
   > > * [HTTP/2] [1] [:method: POST]
   > > * [HTTP/2] [1] [:scheme: http]
   > > * [HTTP/2] [1] [:authority: 127.0.0.1:50052]
   > > * [HTTP/2] [1] [:path: 
/org.apache.dubbo.springboot.demo.DemoService/sayHello]
   > > * [HTTP/2] [1] [user-agent: curl/8.5.0]
   > > * [HTTP/2] [1] [accept: _/_]
   > > * [HTTP/2] [1] [content-type: application/json]
   > > * [HTTP/2] [1] [content-length: 20]
   > > 
   > > > POST /org.apache.dubbo.springboot.demo.DemoService/sayHello HTTP/2
   > > > Host: 127.0.0.1:50052
   > > > User-Agent: curl/8.5.0
   > > > Accept: _/_
   > > > content-type:application/json
   > > > Content-Length: 20
   > > 
   > > 
   > > < HTTP/2 200 < te: trailers < content-type: application/json <
   > > 
   > > * Connection #0 to host 127.0.0.1 left intact
   > >   "Hello myFirstParameter"`
   > 
   > There is no documentation mentioned that methods other than GET are not 
supported. I think it might be because you haven't set maxContentLength 
https://github.com/netty/netty/blob/4379f0b92dc1ae375bba9afa1c279b5aa867a3eb/codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java#L190
   > 
   > --http2-prior-knowledge will skip negotiation, therefore this test is 
meaningless.
   
   You are right, thanks for the guidance. I have submitted a fix


-- 
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: notifications-unsubscr...@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to