dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] okclient or curl http2 return result error

Open smalltalkhyb opened this issue 1 year ago • 1 comments

Pre-check

  • [X] I am sure that all the content I provide is in English.

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

jdk17

Steps to reproduce this issue

code

    @RequestMapping(
        method = {RequestMethod.POST},
        value = {"/manager-bu/buNameAll"},
        produces = {"application/json"}
    )
    List<String> allBuName();
    @Override
    public List<String> allBuName() {
        return sysManagerBuQueryService.getAllBuName();
    }

Test http1.1 200 OK

`curl -v 'http://localhost:8080/manager-bu/buNameAll'
--header 'Authorization: eyUserJNCxrYCkpFYTPvHpGuH6IM8RWRrvhx4PYwZwjqmxeDZkLfvuuS3EXiWRGnkwwCRj'
--header 'deprecated: 1'
--header 'must-auth-heade: 1'
--header 'x-mse-tag: xingzhihe'
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)'
--header 'Content-Type: application/json'
--data '{}'

  • Trying [::1]:8080...
  • Connected to localhost (::1) port 8080

POST /manager-bu/buNameAll HTTP/1.1 Host: localhost:8080 Accept: / Authorization: eyUserJNCxrYCkpFYTPvHpGuH6IM8RWRrvhx4PYwZwjqmxeDZkLfvuuS3EXiWRGnkwwCRj deprecated: 1 must-auth-heade: 1 x-mse-tag: xingzhihe User-Agent: Apifox/1.0.0 (https://apifox.com) Content-Type: application/json Content-Length: 2

< HTTP/1.1 200 OK < content-type: application/json < Timing-Allow-Origin: * < trace_id: 00000000000000000000000000000000 < alt-svc: h2=":8080" < content-length: 261 <

  • Connection #0 to host localhost left intact {"code":"000","message":"操作成功","data":["uap","bap","ad","marketing","user","pay","driver","asset","trip","diq","iot","bigdata","matching","Unknown"],"success":true,"devMessage":null,"traceId":"00000000000000000000000000000000","timestamp":1729474933016}%`

Test http2 200 error HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR

`curl --http2 -v 'http://localhost:8080/manager-bu/buNameAll'
--header 'Authorization: eyUserJNCxrYCkpFYTPvHpGuH6IM8RWRrvhx4PYwZwjqmxeDZkLfvuuS3EXiWRGnkwwCRj'
--header 'deprecated: 1'
--header 'must-auth-heade: 1'
--header 'x-mse-tag: xingzhihe'
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)'
--header 'Content-Type: application/json'
--data '{}'

  • Trying [::1]:8080...
  • Connected to localhost (::1) port 8080

POST /manager-bu/buNameAll HTTP/1.1 Host: localhost:8080 Accept: / Connection: Upgrade, HTTP2-Settings Upgrade: h2c HTTP2-Settings: AAMAAABkAAQAoAAAAAIAAAAA Authorization: eyUserJNCxrYCkpFYTPvHpGuH6IM8RWRrvhx4PYwZwjqmxeDZkLfvuuS3EXiWRGnkwwCRj deprecated: 1 must-auth-heade: 1 x-mse-tag: xingzhihe User-Agent: Apifox/1.0.0 (https://apifox.com) Content-Type: application/json Content-Length: 2

< HTTP/1.1 101 Switching Protocols < connection: upgrade < upgrade: h2c

  • Received 101, Switching to HTTP/2 < HTTP/2 200 < content-type: application/json
  • HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
  • Connection #0 to host localhost left intact curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)`

What you expected to happen

return result ok

{"code":"000","message":"操作成功","data":["uap","bap","ad","marketing","user","pay","driver","asset","trip","diq","iot","bigdata","matching","Unknown"],"success":true,"devMessage":null,"traceId":"00000000000000000000000000000000","timestamp":1729474933016}

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [X] Yes I am willing to submit a pull request on my own!

Code of Conduct

smalltalkhyb avatar Oct 21 '24 01:10 smalltalkhyb

Can't reproduce

 curl -v 'http://localhost:50051/manager-bu/buNameAll' --header 'Authorization: eyUserJNCxrYCkpFYTPvHpGuH6IM8RWRrvhx4PYwZwjqmxeDZkLfvuuS3EXiWRGnkwwCRj' --header 'deprecated: 1' --header 'must-auth-heade: 1' --header 'x-mse-tag: xingzhihe' --header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' --header 'Content-Type: application/json' --data '{}' --http2
* Host localhost:50051 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:50051...
* Connected to localhost (::1) port 50051
> POST /manager-bu/buNameAll HTTP/1.1
> Host: localhost:50051
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAAQAoAAAAAIAAAAA
> Authorization: eyUserJNCxrYCkpFYTPvHpGuH6IM8RWRrvhx4PYwZwjqmxeDZkLfvuuS3EXiWRGnkwwCRj
> deprecated: 1
> must-auth-heade: 1
> x-mse-tag: xingzhihe
> User-Agent: Apifox/1.0.0 (https://apifox.com)
> Content-Type: application/json
> Content-Length: 2
>
* upload completely sent off: 2 bytes
< HTTP/1.1 101 Switching Protocols
< connection: upgrade
< upgrade: h2c
<
* Received 101, Switching to HTTP/2
< HTTP/2 200
< content-type: application/json
< vary: origin, access-control-request-method, access-control-request-headers
<
["bu1","bu2","bu3"]* Connection #0 to host localhost left intact

oxsean avatar Oct 22 '24 16:10 oxsean