-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Remove UTF-8 charset parameter from Content-Type in SseEmitter #24632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SseEmitter is adding header "Content-type:text/event-stream;charset=UTF-8". Golang revproxy is expecting header "Content-Type: text/event-stream" for immediately flushing the event stream. HTML standard says [ https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model ] ignore the MIME type param and the data is always expected in utf-8.
@sada-sigsci Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@sada-sigsci Thank you for signing the Contributor License Agreement! |
The origin of this seems to be #18978 which was added as a workaround for spring-projects/spring-boot#6230. I don't entirely understand the original issue since the sample project repo is now gone. My assumption is that as a result of spring-projects/spring-boot#5459, use of The workaround to add charset=UTF-8 to SSE responses does not seem to be free of side effects, as this issue shows, and we went through a similar cycle with removing the charset from application/json, see #22788. I've accepted this for 5.2.5 but I'll allow some time for the Boot team to comment before processing this. /cc @bclozel @wilkinsona |
Thanks, @rstoyanchev. My memory of the Boot issue is hazy at best but I think the problem was reported when we were enforcing the encoding on both requests and responses. That was then split out so that it was only done for requests by default. If that's correct, you'd have to explicitly set |
Okay, I think we need to process this change to start. If that still causes the original side effect on Jetty with |
Thank you so much. |
SseEmitter is adding header "Content-type:text/event-stream;charset=UTF-8".
Golang revproxy is expecting header "Content-Type: text/event-stream" for
immediately flushing the event stream.
HTML standard says [ https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model ]
ignore the MIME type param and the data is always expected in utf-8.
https://github.com/golang/go/blob/master/src/net/http/httputil/reverseproxy.go#L374