Attributes not appearing in .Net Request.Headers collection

Cantor, Scott cantor.2 at osu.edu
Wed Jun 10 11:14:13 EDT 2015


On 6/10/15, 10:51 AM, "dev on behalf of Martin Robinson" <dev-bounces at shibboleth.net on behalf of martin.robinson at dai.co.uk> wrote:

>I got my debug build of isapi_shib.dll working, and very quickly found the problem...

Sorry for doubting you...

>The call to m_pn->SetHeader in isapi_shib.cpp was returning TRUE (success), yet the attribute was not appearing in the .net Request.Headers collection. Somewhere within IIS and/or .Net, headers are being removed or ignored if their value starts with a space!

That sounds plausible certainly.

>Is this perhaps because attribute values should actually be URL-Encoded?

It's not really that well-defined, but spaces certainly work in general in header values.

>A more general question: How SHOULD attribute values be handled if they contain non-ASCII characters, such as a name like "Süß"? Will they appear in the .Net headers collection as UTF-8 or what?

The data extracted from the XML is stored as Unicode data and encoded as UTF-8 when it's expressed in an 8-bit string. By default, that's all it does, it's passed as is into the header value.

An option was added a while ago to tell the SP to URL-encode the values when it creates the headers. You have to put encoding="URL" into the RequestMap as a setting. In this specific instance, that would probably fix it, at the cost of requiring your application code to reverse the encoding.

-- Scott



More information about the dev mailing list