Kong admin fails (500) to handle HTTP-request with duplicated header keys Content-Type
#14187
Open
1 task done
Content-Type
#14187
Is there an existing issue for this?
"Content-Type" 500
,"bad argument #1 to 'sub'"
)Can be related: #8734
Kong version (
$ kong version
)Kong Enterprise 3.9.0.0
Current Behavior
I'm using
kong:3.9.0-ubuntu
docker image.When I send crafted HTTP-packet with multiple
Content-Type
keys in the header, Kong fails with Internal Server Error 500.Expected Behavior
Maybe it should return Bad request (400).
Steps To Reproduce
The
start.sh
file (based on the docker image documentation):The Packet
packet.txt
(two empty lines at the end. The line-endings must be CRLF):The
send.sh
script:Steps:
bash start.sh
bash send.sh packet.txt
Anything else?
Logs from netcat:
Logs from server:
Source (260 instead of 267 due to 7 lines of copyright in the beginning of the file in the docker image): https://github.com/Kong/kong/blob/3.9.0/kong/api/api_helpers.lua#L260-L262
As I can see,
sub
function expects string incontent_type
variable (and receives it, if there is only one header with keyContent-Type
). However, if multiple linesContent-Type: ...
provided, thecontent_type
variable will contain a table.Same issue happens if I change
POST
toPUT
in the packet.txt.Similar issue happens if I change
POST
toGET
in the packet.txt, however, the error relates to/usr/local/share/lua/5.1/lapis/application.lua
so I will create an issue in the Lapis repository. (leafo/lapis#794)The issue will not happen if I change
POST
toDELETE
in the packet.txt.The text was updated successfully, but these errors were encountered: