dubbo-go icon indicating copy to clipboard operation
dubbo-go copied to clipboard

triple request missed http header like scheme, host etc.

Open 2456868764 opened this issue 11 months ago • 3 comments

Environment

  • Server:
  • Client:
  • Protocol:
  • Registry:

Issue description

The user story is to get if the current request is https or http.

there is dubbo filter demo code which just output attachments :

func (f *mtlsFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
	// get request schema
	attachments := ctx.Value(constant.AttachmentKey).(map[string]interface{})
	for key, attachment := range attachments {
		logger.Infof("get triple attachment key %s = %s", key, attachment.([]string)[0])
	}
}

and output as follow:

2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [retries ] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [user-agent grpc-go-triple/0.1.0 (go1.21.6)] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [te trailers] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [content-type application/grpc+proto] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [interface greet.GreetService] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [grpc-accept-encoding gzip] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [timeout ] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [grpc-timeout 2999023u] = %!s(MISSING)
2024-03-22 02:15:34     INFO    logger/logging.go:42    get triple attachment key [accept-encoding identity] = %!s(MISSING)


and miss some common http headers like scheme ,host etc.

Logs

Click me to check logs
Copy logs to here.

2456868764 avatar Mar 22 '24 03:03 2456868764