Your GET parameter is not starting with a /, which, as far as I'm concerned, is not possible. This is your 400 error most likely.
But your host header is also incorrect, it should be the same value used in /sockopen.
Your on sockread event also is incorrect on many points.
You need to discard the headers first before looking for your text as your text may appear in headers. And you need better reading logic than just read anything that is available because you may end up with a packet being "TTN" with the next one being "M7", making your if condition fails.
To discard headers you need to use a true/false bool variable to store whether or not you discarded the headers already.
On *:sockread:demo:{
var %r
Sockread %r
If (!$sockbr) return
If (%headersread) {
If (TTNM7 isin %r) ...
}
Elseif (%r == $null) %headersread = 1
}
}
you will need to make sure %headersread is either unset when the socket close, or reset it when you reopen the socket.
If you are using https 1.1 your connection should stay alive by default and on sockclose won't trigger, you will have to specify a connection: close header.