Prebody and Postbody Files

Added by Gaurav Joshua Vaz , last edited by Gaurav Joshua Vaz on Jan 10, 2008
Tags: 

Brief overview of the prebody and postbody files used for HTTP Body Injection. Also, sample prebody and postbody files.

Summary

Configuring Prebody Files

Content injected before the response body is called the prebody content. To insert content into the response prebody, you need to create a separate prebody file on the system with the content you want injected.

By default, prebody files are stored in the /nsconfig/htmlinjectiondirectory on the system. However, you can store them in any other location you prefer. The prebody file name can have a maximum of 64 characters and can have any extension.

The following is a sample prebody file to be used for prebody insertion.

Sample prebody file: /nsconfig/htmlinjection/prebody.js

<!- This is a sample prebody file ->

<script language="JavaScript">

// Internal variables are delimited by the percent characters

/* The following two variables must be quoted.

* Otherwise browser may give a JavaScript error.

*/

// System IID

var sys_iid="%%SYS.IID%%";

// HTTP transaction ID

var http_xid="%%HTTP.XID%%";

/* Following timestamp variables will always be valid

* when prebody is injected (When we get the initial

* bytes of server response).

*/

// Client request timestamps

var clt_req_beg=%%HTTP.REQ.RECEIVE_TIME_BEG%%;

var clt_req_end=%%HTTP.REQ.RECEIVE_TIME_END%%;

// Netsclaer to server request timestamps

var ns_req_beg=%%HTTP.REQ.SEND_TIME_BEG%%;

var ns_req_end=%%HTTP.REQ.SEND_TIME_END%%;

</script>

Configuring Postbody Files

Content injected after the response body of a response is called the postbodycontent. To insert content into the response postbody, you must need to create a separate postbody file on the system, containing with the content you want injected.

Postbody files are stored by default in the/nsconfig/htmlinjection directory on the system by default. However, they can be stored in any other location of your choice. The postbody file name can have a maximum of 64 characters and can have any extension.

The following is a sample postbody file created on the system that will be used for postbody injection.

Sample postbody file: /nsconfig/htmlinjection/postbody.js

<!- This is a sample postbody file ->

<script language="JavaScript">

// Internal variables are delimited by the percent characters

/* The following two variables must be quoted.

* Otherwise browser may give a JavaScript error.

*/

// System IID

var sys_iid="%%SYS.IID%%";

// HTTP transaction ID

var http_xid="%%HTTP.XID%%";

/* Following timestamp variables are guaranteed to be

* valid only when we get the last byte of response

* (That is, when we are injecting postbody).

*/

// Server response timestamp variables

var server_res_beg=%%HTTP.RES.RECEIVE_TIME_BEG%%;

var server_res_end=%%HTTP.RES.RECEIVE_TIME_END%%;

// System to client response timestamp variables

var ns_res_beg=%%HTTP.RES.SEND_TIME_BEG%%;

var ns_res_end=%%HTTP.RES.SEND_TIME_END%%;

</script>

More Information