enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
201 stars 34 forks source link

Duplicate headers in controller cause a crash #8404

Closed poi33 closed 3 years ago

poi33 commented 4 years ago

A user reported that when they have a part sending in a header that is allready present it crashes.

A part returns with a header. The part is added twice on the same site. This creates com.enonic.xp.web.WebException: Multiple entries with same key:

The system merges: pageContributions and cookies, but not headers?

rymsha commented 3 years ago

New behavior after #8521 is that duplicate header from different parts won't generate an error. Instead response will have only one header value for each key (last one wins)

HTTP Header specs went through a few RFCs and still problematic to implement correctly. Generally, "duplicate header key" is exotic:

Current implementation of Enonic XP Web Response is written so that keys are unique (it is a js/json object), changing it in a non-breaking way would be too much effort for an exotic use-case. If there is a demand for this, we can open a new feature request.