DataScript: avi.http.disable

DataScript

Function avi.http.disable()
Description Some protocols, such as Websockets, may be embedded within HTTP. The initial connection and handshake begins as HTTP, but then switches to a non-HTTP, non-HTML protocol. Some Microsoft applications, Java, and binary protocols use this method to tunnel through HTTP. With the avi.http.disable() function, a DataScript can monitor the client to server handshake over HTTP, then disable HTTP process when the protocol switches to non-HTTP.

Note that Websocket support may be enabled natively via an HTTP profile. However, some application protocols use slightly different variation of the names of the headers, which is when the DataScript becomes a requirement.

The avi.http.disable() function may be invoked during the HTTP response event. The Service Engine will send the server's response to the client, then upgrade (disable) HTTP processing for the current connection, which will subsequently be treated as layer 4 TCP. If SSL termination is being performed, this will continue without interruption. HTTP processing may not be turned on again for the connection.
Events HTTP_RESP
Parameter None
Returns None
Example HTTP Request Event

if string.lower(avi.http.get_header("Upgrade")) == "websocket" and string.lower(avi.http.get_header("Connection") == "upgrade" then
   avi.http.set_reqvar("var", 1)
end
HTTP Response Event

if avi.http.get_reqvar("var") == 1 then
   avi.http.disable()
end