HTTP::disable

Description

Changes the HTTP filter from full parsing to passthrough mode. This command is useful when using an HTTP profile with an application that proxies data over HTTP. One use of this command is when you need to tunnel PPP over HTTP and disable HTTP processing once the connection has been established.

Syntax

HTTP::disable
HTTP::disable discard

HTTP::disable

  • Puts HTTP traffic filtering into passthrough mode (disabling the HTTP proxy) for the lifetime of the TCP connection or until HTTP::enable is called.
  • Once in passthrough mode, further use of HTTP commands will throw an error until the HTTP filter is re-enabled.
  • When called from an HTTP event, the current event will continue. Once the current HTTP event completes, all further HTTP events will be disabled until the HTTP filter is re-enabled. For this reason, it could be useful to ask the server to close the TCP connection after answering the current HTTP request. This can be done by replacing/inserting the current Connection header with Connection: close.
  • Using “event disable” will disable the current event which will prevent execution of higher priority HTTP events. The event will need to be re-enabled if the HTTP filter is re-enabled.

HTTP::disable discard

  • Same as ‘HTTP::disable’ but also discards the headers before setting the HTTP filter into the passthrough mode (added in ~9.4?).

Examples

when HTTP_REQUEST {
   persist hash $key
   if { [string toupper [HTTP::method]] eq "CONNECT" } {

      # Proxy connect method should continue as a passthrough
      HTTP::disable

      # Ask the server to close the connection after this request
      HTTP::header replace Connection close
   }
}