How to list response headers in xojo.net.HTTPSocket?

I’m playing with the new xojo.net.HTTPSocket, and I see there is a method there to retrieve a header if you know the name of it… but what if I don’t necessarily know the name of a header that I need to retrieve? Is there any way to get at the names of the headers that have been received by the socket?

Why not just expose the dictionary of response headers directly?

A dictionary is inadequate as you can legally have several of the same header in a response
An array of pairs or something else would be required

http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
[i]Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list . It MUST be possible to combine the multiple header fields into one “field-name: field-value” pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.

As for why its not exposed yet - because its not exposed yet
I’d expect there’s already an FR for it

Hrm. Looks like the ResponseHeader() method is also inadequate, due to the same spec. Lovely.

Is there a way to loop through the response headers with Xojo.Net.HTTPSocket?

I feel like I must be mixing something but there doesn’t seem to be a way to view all response headers so if you don’t know the name of the header, it’s impossible to know what you have received.

It doesn’t seem to be in the new HTTPSocket (at least according to the docs)… I think the reasoning behind this was something about a header being able to appear more than once, which could just be easily sorted out by using an array inside a dictionary… Hopefully they will re-add it by Xojo 2020r15

This has nothing to do with it. If you remember, the classic sockets handle this situation just fine.

The ability to enumerate the available header names just hasn’t been added yet.

[quote=335896:@Paul Levine]
I feel like I must be mixing something but there doesn’t seem to be a way to view all response headers so if you don’t know the name of the header, it’s impossible to know what you have received.[/quote]
There is a set list of headers in the RFC and a rather limited set of common ones. You could loop through them and see what you’ve got for now.