Invalid Accept header results in IllegalStateException #29794
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Affects: 5.3.23
Hitting IllegalStateExcption at - Sourcegraph
(Comment says should never happen)
Reproducer - https://github.com/malware27/simple-springboot-app/tree/master/simple-springboot-app
Sample curl after bringing the above application up locally -
curl 'http://localhost:9001/property' \ -H 'Accept: abc' \ -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Pragma: no-cache' \ -H 'Sec-Fetch-Dest: document' \ -H 'Sec-Fetch-Mode: navigate' \ -H 'Sec-Fetch-Site: none' \ -H 'Sec-Fetch-User: ?1' \ -H 'Upgrade-Insecure-Requests: 1' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' \ -H 'sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "macOS"' \ --compressed
The application logs after hitting the above curl -
This specifically happens when the following two cases are satisfied -
I had a library with spring boot auto configuration enabled which had a handlerMethod handling the same endpoint which my application did and hence discovered this issue.
Happy to contribute if this an actual issue and I did not mess up something.
The text was updated successfully, but these errors were encountered: