Patent ID: 8724654

Claim:
A method for rewriting a stream of content traversing a device intermediary to a client and a server, the method comprising: (a) identifying, by a device intermediary to a client and a server, a plurality of patterns to match for rewriting a stream of content received by the device via a plurality of packets over a connection between the client and the server traversing the device, (b) performing, by the device via a single parsing of content of a packet, matching of the plurality of patterns to the content of a payload of the packet of the plurality of packets; (c) storing, by the device, results of the matching to a database associated with the connection; (d) storing, by the device, the packet to a rewrite buffer with a predetermined size threshold for storing packets to be rewritten before transmission; (e) performing, by the device responsive to a determination that the size of the rewrite buffer exceeds the predetermined size threshold, a rewrite on an oldest packet removed from the rewrite buffer based on results of matching performed on the oldest packet stored in the database; and (f) transmitting, by the device, the rewritten oldest packet.