I’m downloading updates with Kaju. Since a while I’ve moved the updates to a CDN. Some users have reported stalled downloads. The CND support wants me to send them the internet headers. But how do I get them? The HeadersReceived even fires but there are no headers to be seen:
Sub HeadersReceived(URL As String, HTTPStatus As Integer) Handles HeadersReceived
beep
End Sub
It’s a property you have to loop through.
https://documentation.xojo.com/api/networking/urlconnection.html#urlconnection-responseheader
If your CDN is cloudflare I’d recommend anyone else.
1 Like
I’m not using CloudFlare.
What am I doing wrong? The code below makes an OutOfBoundsException:
dim temp as String
while self.ResponseHeaders.Iterator.MoveNext
temp = temp + self.ResponseHeaders.Iterator.Value
wend
Documentation isn’t clear about this but ResponseHeaders is a Pair
This should work better:
Var headers() as String
For each header as pair in me.ResponseHeaders
headers.Add header.Left + ": " + header.Right
Next
Var allHeaders as String = String.FromArray(headers, Endofline)
2 Likes
Now, I understand. I saw something about the pair in older posts. But then someone mentioned the iterator and I thought that this was supposed to be the new version of doing things. I’ll do a ticket for the documentation.
1 Like