This is similar to https://github.com/NanoHttpd/nanohttpd/issues/629, but on the request side, and a bit worse because it actually loses information that the client has sent. In other words, if the client sends the following headers—
my-header: value1
my-header: value2
—then session.getHeaders().get("my-header") will return only "value2". But it is legal for a client to do this (as an alternative to sending comma-delimited values), so it should be possible for the server to see what was sent.
I don't see any workaround for this in the current implementation (I mean, except to make sure the client will always send comma-delimited values instead of multiple lines, but when you're writing server code you can't necessarily control what the client will do). And I don't think I have ever seen an HTTP server framework that simply ignores multiple header lines like this; generally they provide a method for getting a list of values for any given header name.
This is similar to https://github.com/NanoHttpd/nanohttpd/issues/629, but on the request side, and a bit worse because it actually loses information that the client has sent. In other words, if the client sends the following headers—
—then
session.getHeaders().get("my-header")
will return only"value2"
. But it is legal for a client to do this (as an alternative to sending comma-delimited values), so it should be possible for the server to see what was sent.I don't see any workaround for this in the current implementation (I mean, except to make sure the client will always send comma-delimited values instead of multiple lines, but when you're writing server code you can't necessarily control what the client will do). And I don't think I have ever seen an HTTP server framework that simply ignores multiple header lines like this; generally they provide a method for getting a list of values for any given header name.