trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Content-type lost when sent after duplicate headers

Open jasmine-nahrain opened this issue 1 year ago • 4 comments

Prior to issue #9527, content-type header was being deleted and readded in merge_response_header_with_cached_header despite line 5005 specificaly stating that it should not be overwritten.

Once the issue was fixed, if duplicate headers were found and content-type was being sent after one of the duplicate headers, it would be deleted in the for loop at line 5038. E.g.

HTTP/1.1 200 OK
x-reveal-duplicate: same
content-type: text/plain
x-reveal-duplicate: same

once the duplicate header is found, all headers subsequent to the dup are deleted. The intended course of this code is to then have those headers readded in the greater for loop. This works fine for most cases but because content-type is specified to not follow this behaviour, it is getting deleted but never readded.

This adds a secondary check for content-type to not be altered.

This fixes #11784

jasmine-nahrain avatar Oct 18 '24 02:10 jasmine-nahrain

[approve ci autest]

jasmine-nahrain avatar Oct 21 '24 00:10 jasmine-nahrain

[approve ci format]

jasmine-nahrain avatar Oct 21 '24 01:10 jasmine-nahrain

[approve ci rat]

jasmine-nahrain avatar Oct 21 '24 01:10 jasmine-nahrain

[approve ci centos]

jasmine-nahrain avatar Oct 21 '24 03:10 jasmine-nahrain

Cherry-picked to v10.0.x

cmcfarlen avatar Oct 31 '24 16:10 cmcfarlen