HttpWebResponse can't handle duplicate header

  • Thread starter Thread starter MrJun
  • Start date Start date
M

MrJun

Hi,

HttpWebResponse will just display the last value of
those same name http header.
Ex.
Aheader: a value
Bheader: b value
Cheader: c value 1
Cheader: c value 2
Cheader: c value 3
Dheader: d value

Retrieving the Cheader value by the headers property of
httpwebresponse will only return the "c value 3".

Is there any workaround?


Thanks
MrJun
 
MrJun said:
Hi,

HttpWebResponse will just display the last value of
those same name http header.
Ex.
Aheader: a value
Bheader: b value
Cheader: c value 1
Cheader: c value 2
Cheader: c value 3
Dheader: d value

Retrieving the Cheader value by the headers property of
httpwebresponse will only return the "c value 3".

Is there any workaround?

I cannot reproduce the behaviour using ASP.NET, since
Response.AppendHeader("X-Foo", "Bar");
Response.AppendHeader("X-Foo", "Baz");
produces
X-Foo: Bar,Baz

(I'll retry with Tomcat 5 once I have it up and running)

In case you have control over the serverside application, setting the
header like that should do the trick.

Cheers,
 
Back
Top