Get headers through URLConnection

TIL that you can get just the headers of a url through URLConnection by using HEAD:

call urlconn.SendSync( "HEAD", url ) // or Send

Now if we could stop it from redirecting, that would make the tool complete (for me).

feedback://showreport?report_id=55337

1 Like

Just curious because I haven’t run into one myself, what is the use case for not following a redirect?

As a workaround in the meantime, you could consider https://github.com/thommcgrath/HTTPClientSocket which has a FollowRedirects property.

55337 is one year old, so “in the mean time” can takes time.

Security, @Tim Parnell. For certain cases, you want to make sure the content you’re getting is from the source you requested, and not from some other location behind the scenes. For example, Kaju lets you turn off redirects when getting the update information file because, in most cases, that should not legitimately be redirected.

I can fake this with asynchronous calls by comparing the URL returned by the event to the URL that was requested, but there is no way right now with synchronous calls.

1 Like

Reviving old thread, because I too would like to be able to detect redirects.

As an alternative, if curl is on the machine.

curl -I "https://t.co/tszjvjHaVY?amp=1"