trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject svn commit: r1164283 [2/3] - in /trafficserver/site/branches/ats-cms/content/docs/trunk: admin/cluster-howto/ admin/configuration-files/ admin/configuring-cache/ admin/faqs/ admin/working-log-files/ sdk/actions-guide/ sdk/adding-statistics/ sdk/continu...
Date Thu, 01 Sep 2011 21:34:30 GMT
Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/basic-authorization-plugin/working-with-http-headers.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/basic-authorization-plugin/working-with-http-headers.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/basic-authorization-plugin/working-with-http-headers.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/basic-authorization-plugin/working-with-http-headers.en.mdtext Thu Sep  1 21:34:29 2011
@@ -24,70 +24,70 @@ handler, `auth-plugin`, calls `handle_dn
 field. The `handle_dns` routine uses `TSHttpTxnClientReqGet` and `TSMimeHdrFieldFind`
 to obtain the `Proxy-Authorization` field:
 
-	:::c
-	{
-		TSMBuffer bufp;
-		TSMLoc hdr_loc;
-		TSMLoc field_loc;
-		const char *val;
-		char *user, *password;
-
-		if (!TSHttpTxnClientReqGet (txnp, &bufp, &hdr_loc)) {
-			TSError ("couldn't retrieve client request header\n");
-			goto done;
-		}
+    :::c
+    {
+        TSMBuffer bufp;
+        TSMLoc hdr_loc;
+        TSMLoc field_loc;
+        const char *val;
+        char *user, *password;
+
+        if (!TSHttpTxnClientReqGet (txnp, &bufp, &hdr_loc)) {
+            TSError ("couldn't retrieve client request header\n");
+            goto done;
+        }
 
-		field_loc = TSMimeHdrFieldFind (bufp, hdr_loc,
-				TS_MIME_FIELD_PROXY_AUTHORIZATION);
+        field_loc = TSMimeHdrFieldFind (bufp, hdr_loc,
+                TS_MIME_FIELD_PROXY_AUTHORIZATION);
 
 If the `Proxy-Authorization` field is present, then the plugin checks that
 the authentication type is "Basic", and the user name and password are present
 and valid:
 
-	:::c
-	val = TSMimeHdrFieldValueStringGet (bufp, hdr_loc, field_loc, 0, &authval_length);
-	if (!val) {
-		TSError ("no value in Proxy-Authorization field\n");
-		TSHandleMLocRelease (bufp, hdr_loc, field_loc);
-		TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-		goto done;
-	}
-	
-	if (strncmp (val, "Basic", 5) != 0) {
-		TSError ("no Basic auth type in Proxy-Authorization\n");
-		TSHandleMLocRelease (bufp, hdr_loc, field_loc);
-		TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-		goto done;
-	}
-	
-	val += 5;
-	while ((*val == ' ') || (*val == '\t')) {
-		val += 1;
-	}
-	
-	user = base64_decode (val);
-	password = strchr (user, ':');
-	if (!password) {
-		TSError ("no password in authorization information\n");
-		TSfree (user);
-		TSHandleMLocRelease (bufp, hdr_loc, field_loc);
-		TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-		goto done;
-	}
-	*password = '\0';
-	password += 1;
-	
-	if (!authorized (user, password)) {
-		TSError ("%s:%s not authorized\n", user, password);
-		TSfree (user);
-		TSHandleMLocRelease (bufp, hdr_loc, field_loc);
-		TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-		goto done;
-	}
-	
-	TSfree (user);
-	TSHandleMLocRelease (bufp, hdr_loc, field_loc);
-	TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-	TSHttpTxnReenable (txnp, TS_EVENT_HTTP_CONTINUE);
-	return;
+    :::c
+    val = TSMimeHdrFieldValueStringGet (bufp, hdr_loc, field_loc, 0, &authval_length);
+    if (!val) {
+        TSError ("no value in Proxy-Authorization field\n");
+        TSHandleMLocRelease (bufp, hdr_loc, field_loc);
+        TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+        goto done;
+    }
+    
+    if (strncmp (val, "Basic", 5) != 0) {
+        TSError ("no Basic auth type in Proxy-Authorization\n");
+        TSHandleMLocRelease (bufp, hdr_loc, field_loc);
+        TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+        goto done;
+    }
+    
+    val += 5;
+    while ((*val == ' ') || (*val == '\t')) {
+        val += 1;
+    }
+    
+    user = base64_decode (val);
+    password = strchr (user, ':');
+    if (!password) {
+        TSError ("no password in authorization information\n");
+        TSfree (user);
+        TSHandleMLocRelease (bufp, hdr_loc, field_loc);
+        TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+        goto done;
+    }
+    *password = '\0';
+    password += 1;
+    
+    if (!authorized (user, password)) {
+        TSError ("%s:%s not authorized\n", user, password);
+        TSfree (user);
+        TSHandleMLocRelease (bufp, hdr_loc, field_loc);
+        TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+        goto done;
+    }
+    
+    TSfree (user);
+    TSHandleMLocRelease (bufp, hdr_loc, field_loc);
+    TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+    TSHttpTxnReenable (txnp, TS_EVENT_HTTP_CONTINUE);
+    return;
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/accessing-the-transaction-being-processed.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/accessing-the-transaction-being-processed.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/accessing-the-transaction-being-processed.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/accessing-the-transaction-being-processed.en.mdtext Thu Sep  1 21:34:29 2011
@@ -34,23 +34,23 @@ passed to the continuation's handler is 
 represents HTTP transactions). Your plugin can then do things with the transaction.
 Here's how it looks in the code for the Blacklist plugin's handler:
 
-	:::c
-	static int
-	blacklist_plugin (TSCont contp, TSEvent event, void *edata)
-	{
-	     TSHttpTxn txnp = (TSHttpTxn) edata;
-	     switch (event) {
-	          case TS_EVENT_HTTP_OS_DNS:
-	               handle_dns (txnp, contp);
-	               return 0;
-	          case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
-	               handle_response (txnp);
-	               return 0;
-	          default:
-	               break;
-	     }
-	     return 0;
-	}
+    :::c
+    static int
+    blacklist_plugin (TSCont contp, TSEvent event, void *edata)
+    {
+         TSHttpTxn txnp = (TSHttpTxn) edata;
+         switch (event) {
+              case TS_EVENT_HTTP_OS_DNS:
+                   handle_dns (txnp, contp);
+                   return 0;
+              case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
+                   handle_response (txnp);
+                   return 0;
+              default:
+                   break;
+         }
+         return 0;
+    }
 
 For example: when the origin server DNS lookup event is sent, `blacklist_plugin`
 can call `handle_dns `and pass `txnp` as an argument.

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/index.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/index.en.mdtext Thu Sep  1 21:34:29 2011
@@ -46,39 +46,39 @@ to access the same continuation's data.
 
 Here is how the static parent continuation is created in `blacklist-1.c`:
 
-	:::c
-	void
-	TSPluginInit (int argc, const char *argv[])
-	{ ...
-	       TSCont contp;
-	       	
-	       contp = TSContCreate (blacklist_plugin, NULL);
-	...
-	}
+    :::c
+    void
+    TSPluginInit (int argc, const char *argv[])
+    { ...
+           TSCont contp;
+               
+           contp = TSContCreate (blacklist_plugin, NULL);
+    ...
+    }
 
 The handler function for the plugin is `blacklist_plugin`, and the mutex is
 null. The continuation handler function's job is to handle the events that
 are sent to it; accordingly, the `blacklist_plugin` routine consists of a switch
 statement that covers each of the events that might be sent to it:
 
-	:::c
-	static int
-	blacklist_plugin (TSCont contp, TSEvent event, void *edata)
-	{
-		TSHttpTxn txnp = (TSHttpTxn) edata;
-		switch (event) {
-			case TS_EVENT_HTTP_OS_DNS:
-				handle_dns (txnp, contp);
-				return 0;
-			case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
-				handle_response (txnp);
-				return 0;
-			default:
-				TSDebug ("blacklist_plugin", "This event was unexpected: %d\n", );
-				break;
-		}
-		return 0;
-	}
+    :::c
+    static int
+    blacklist_plugin (TSCont contp, TSEvent event, void *edata)
+    {
+        TSHttpTxn txnp = (TSHttpTxn) edata;
+        switch (event) {
+            case TS_EVENT_HTTP_OS_DNS:
+                handle_dns (txnp, contp);
+                return 0;
+            case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
+                handle_response (txnp);
+                return 0;
+            default:
+                TSDebug ("blacklist_plugin", "This event was unexpected: %d\n", );
+                break;
+        }
+        return 0;
+    }
 
 When you write handler functions, you have to anticipate any events that might
 be sent to the handler by hooks or by other functions. In the Blacklist plugin,

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-a-global-hook.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-a-global-hook.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-a-global-hook.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-a-global-hook.en.mdtext Thu Sep  1 21:34:29 2011
@@ -24,8 +24,8 @@ two arguments of `TSHttpHookAdd` are the
 when processing the event corresponding to the hook. In `blacklist-1.c`, the
 global hook is added as follows:
 
-	:::c
-	TSHttpHookAdd (TS_HTTP_OS_DNS_HOOK, contp);
+    :::c
+    TSHttpHookAdd (TS_HTTP_OS_DNS_HOOK, contp);
 
 Above, `TS_HTTP_OS_DNS_HOOK` is the ID for the origin server DNS lookup hook
 and `contp` is the parent continuation created earlier.

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-up-a-transaction-hook.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-up-a-transaction-hook.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-up-a-transaction-hook.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/setting-up-a-transaction-hook.en.mdtext Thu Sep  1 21:34:29 2011
@@ -24,24 +24,24 @@ hook so it will be called back when Traf
 the "send response header" event. In the Blacklist plugin's `handle_dns` routine,
 the transaction hook is added as follows:
 
-	:::c
-	TSMutexLock (sites_mutex);
-	for (i = 0; i < nsites; i++) {
-		if (strncmp (host, sites[i], host_length) == 0) {
-			printf ("blacklisting site: %s\n", sites[i]);
-			TSHttpTxnHookAdd (txnp,
-					TS_HTTP_SEND_RESPONSE_HDR_HOOK,
-					contp);
-			TSHandleMLocRelease (bufp, hdr_loc, url_loc);
-			TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-			TSHttpTxnReenable (txnp, TS_EVENT_HTTP_ERROR);
-			TSMutexUnlock (sites_mutex);
-			return;
-		}
-	}
-	TSMutexUnlock (sites_mutex);
-	done:
-		TSHttpTxnReenable (txnp, TS_EVENT_HTTP_CONTINUE);
+    :::c
+    TSMutexLock (sites_mutex);
+    for (i = 0; i < nsites; i++) {
+        if (strncmp (host, sites[i], host_length) == 0) {
+            printf ("blacklisting site: %s\n", sites[i]);
+            TSHttpTxnHookAdd (txnp,
+                    TS_HTTP_SEND_RESPONSE_HDR_HOOK,
+                    contp);
+            TSHandleMLocRelease (bufp, hdr_loc, url_loc);
+            TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+            TSHttpTxnReenable (txnp, TS_EVENT_HTTP_ERROR);
+            TSMutexUnlock (sites_mutex);
+            return;
+        }
+    }
+    TSMutexUnlock (sites_mutex);
+    done:
+        TSHttpTxnReenable (txnp, TS_EVENT_HTTP_CONTINUE);
 
 This code fragment shows some interesting features. The plugin is comparing
 the requested site to the list of blacklisted sites. While the plugin is using

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/working-with-http-header-functions.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/working-with-http-header-functions.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/working-with-http-header-functions.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/blacklist-plugin/working-with-http-header-functions.en.mdtext Thu Sep  1 21:34:29 2011
@@ -23,36 +23,36 @@ The Blacklist plugin examines the host h
 This is done in the `handle_dns` routine, using `TSHttpTxnClientIPGet`, `TSHttpHdrUrlGet`,
 and `TSUrlHostGet`.
 
-	:::c
-	static void
-	handle_dns (TSHttpTxn txnp, TSCont contp)
-	{
-		TSMBuffer bufp;
-		TSMLoc hdr_loc;
-		TSMLoc url_loc;
-		const char *host;
-		int i;
-
-		if (!TSHttpTxnClientIPGet (txnp, &bufp, &hdr_loc)) {
-			TSError ("couldn't retrieve client request header\n");
-			goto done;
-		}
-
-		url_loc = TSHttpHdrUrlGet (bufp, hdr_loc);
-
-		if (!url_loc) {
-			TSError ("couldn't retrieve request url\n");
-			TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-			goto done;
-		}
-
-		host = TSUrlHostGet (bufp, url_loc, NULL);
-		if (!host) {
-			TSError ("couldn't retrieve request hostname\n");
-			TSHandleMLocRelease (bufp, hdr_loc, url_loc);
-			TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
-			goto done;
-		}
+    :::c
+    static void
+    handle_dns (TSHttpTxn txnp, TSCont contp)
+    {
+        TSMBuffer bufp;
+        TSMLoc hdr_loc;
+        TSMLoc url_loc;
+        const char *host;
+        int i;
+
+        if (!TSHttpTxnClientIPGet (txnp, &bufp, &hdr_loc)) {
+            TSError ("couldn't retrieve client request header\n");
+            goto done;
+        }
+
+        url_loc = TSHttpHdrUrlGet (bufp, hdr_loc);
+
+        if (!url_loc) {
+            TSError ("couldn't retrieve request url\n");
+            TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+            goto done;
+        }
+
+        host = TSUrlHostGet (bufp, url_loc, NULL);
+        if (!host) {
+            TSError ("couldn't retrieve request hostname\n");
+            TSHandleMLocRelease (bufp, hdr_loc, url_loc);
+            TSHandleMLocRelease (bufp, TS_NULL_MLOC, hdr_loc);
+            goto done;
+        }
 
 To access the host header, the plugin must first get the client request, retrieve
 the URL portion, and then obtain the host header. See [HTTP Headers](../../http-headers)

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/index.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/header-based-plugin-examples/index.en.mdtext Thu Sep  1 21:34:29 2011
@@ -21,17 +21,17 @@ Notice:    Licensed to the Apache Softwa
 **Table of Contents**
 
 * [The Blacklist Plugin](blacklist-plugin)
-	* [Creating the Parent Continuation](blacklist-plugin#CreatingParentContinuation)
-	* [Setting a Global Hook](blacklist-plugin/setting-a-global-hook)
-	* [Setting Up UI Update Callbacks](blacklist-plugin/setting-up-ui-update-callbacks)
-	* [Accessing the Transaction Being Processed](blacklist-plugin/accessing-the-transaction-being-processed)
-	* [Setting Up a Transaction Hook](blacklist-plugin/setting-up-a-transaction-hook)
-	* [Working with HTTP Header Functions](blacklist-plugin/working-with-http-header-functions)
+    * [Creating the Parent Continuation](blacklist-plugin#CreatingParentContinuation)
+    * [Setting a Global Hook](blacklist-plugin/setting-a-global-hook)
+    * [Setting Up UI Update Callbacks](blacklist-plugin/setting-up-ui-update-callbacks)
+    * [Accessing the Transaction Being Processed](blacklist-plugin/accessing-the-transaction-being-processed)
+    * [Setting Up a Transaction Hook](blacklist-plugin/setting-up-a-transaction-hook)
+    * [Working with HTTP Header Functions](blacklist-plugin/working-with-http-header-functions)
 * [The Basic Authorization Plugin](basic-authorization-plugin/)
-	* [Creating the Plugin's Parent Continuation and Global Hook](basic-authorization-plugin/#CreatingPluginsParentContinuationGlobalHook)
-	* [Implementing the Handler and Getting a Handle to the Transaction](basic-authorization-plugin/implementing-the-handler-and-getting-a-handle-to-the-transaction)
-	* [Working With HTTP Headers](basic-authorization-plugin/working-with-http-headers)
-	* [Setting a Transaction Hook](setting-a-transaction-hook)
+    * [Creating the Plugin's Parent Continuation and Global Hook](basic-authorization-plugin/#CreatingPluginsParentContinuationGlobalHook)
+    * [Implementing the Handler and Getting a Handle to the Transaction](basic-authorization-plugin/implementing-the-handler-and-getting-a-handle-to-the-transaction)
+    * [Working With HTTP Headers](basic-authorization-plugin/working-with-http-headers)
+    * [Setting a Transaction Hook](setting-a-transaction-hook)
 
 Header-based plugins read or modify the headers of HTTP messages that Traffic
 Server sends and receives. Reading this chapter will help you to understand

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/how-to-create-trafficserver-plugins/roadmap-for-creating-plugins.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/how-to-create-trafficserver-plugins/roadmap-for-creating-plugins.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/how-to-create-trafficserver-plugins/roadmap-for-creating-plugins.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/how-to-create-trafficserver-plugins/roadmap-for-creating-plugins.en.mdtext Thu Sep  1 21:34:29 2011
@@ -24,28 +24,28 @@ capabilities of Traffic Server API funct
 
 * **HTTP header manipulation functions**
 
-	Obtain information about and manipulate HTTP headers, URLs, & MIME headers.
+    Obtain information about and manipulate HTTP headers, URLs, & MIME headers.
 
 * **HTTP transaction functions**
 
-	Get information about and modify HTTP transactions (for example: get the client
+    Get information about and modify HTTP transactions (for example: get the client
 IP associated to the transaction; get the server IP; get parent proxy information)
 
 * **IO functions**
 
-	Manipulate vconnections (virtual connections, used for network and disk I/O)
+    Manipulate vconnections (virtual connections, used for network and disk I/O)
 
 * **Network connection functions**
 
-	Open connections to remote servers.
+    Open connections to remote servers.
 
 * **Statistics functions**
 
-	Define and compute statistics for your plugin's activity.
+    Define and compute statistics for your plugin's activity.
 
 * **Traffic Server management functions**
 
-	Obtain values for Traffic Server configuration and statistics variables.
+    Obtain values for Traffic Server configuration and statistics variables.
 
 
 Below are some guidelines for creating a plugin:

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/index.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/index.en.mdtext Thu Sep  1 21:34:29 2011
@@ -40,13 +40,13 @@ or object requested does not exist.
 For example (from the `blacklist-1` sample):
 
         :::c
-	char *host_string;
-	int host_length;
-	host_string = TSUrlHostGet (bufp, url_loc, &host_length);
-	for (i = 0; i < nsites; i++) {
-	if (strncmp (host_string, sites[i], host_length) == 0) {
-	...
-	}
+    char *host_string;
+    int host_length;
+    host_string = TSUrlHostGet (bufp, url_loc, &host_length);
+    for (i = 0; i < nsites; i++) {
+    if (strncmp (host_string, sites[i], host_length) == 0) {
+    ...
+    }
 
 See the sample plugins for additional examples.
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/mime-fields-always-belong-to-an-associated-mime-header.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/mime-fields-always-belong-to-an-associated-mime-header.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/mime-fields-always-belong-to-an-associated-mime-header.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/mime-fields-always-belong-to-an-associated-mime-header.en.mdtext Thu Sep  1 21:34:29 2011
@@ -36,25 +36,25 @@ below.
 Instead of:
 
         :::c
-	TSMLoc TSMimeFieldCreate (TSMBuffer bufp)
+    TSMLoc TSMimeFieldCreate (TSMBuffer bufp)
 
 You should use:
 
         :::c
-	TSMLoc TSMimeHdrFieldCreate (TSMBuffer bufp, TSMLoc hdr)
+    TSMLoc TSMimeHdrFieldCreate (TSMBuffer bufp, TSMLoc hdr)
 
 Instead of:
 
         :::c
-	void TSMimeFieldCopyValues (TSMBuffer dest_bufp, TSMLoc dest_offset,
-	   TSMBuffer src_bufp, TSMLoc src_offset)
+    void TSMimeFieldCopyValues (TSMBuffer dest_bufp, TSMLoc dest_offset,
+       TSMBuffer src_bufp, TSMLoc src_offset)
 
 You should use:
 
         :::c
-	void TSMimeHdrFieldCopyValues (TSMBuffer dest_bufp, TSMLoc dest_hdr,
-	   TSMLoc dest_field, TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc
-	   src_field)
+    void TSMimeHdrFieldCopyValues (TSMBuffer dest_bufp, TSMLoc dest_hdr,
+       TSMLoc dest_field, TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc
+       src_field)
 
 In the `TSMimeHdrField*` function prototypes, the `TSMLoc` field corresponds 
 to the `TSMLoc` offset used the deprecated `TSMimeField*` functions (see 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/release-marshal-buffer-handles.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/release-marshal-buffer-handles.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/release-marshal-buffer-handles.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/guide-to-trafficserver-http-header-system/release-marshal-buffer-handles.en.mdtext Thu Sep  1 21:34:29 2011
@@ -34,20 +34,20 @@ to be released. The parent location is u
 `TSMLoc` or string. For example, if your plugin had the following calls:
 
         ::::c
-	url_loc = TSHttpHdrUrlGet (bufp, hdr_loc);
-	host_string = TSUrlHostGet (bufp, url_loc, &host_length);
+    url_loc = TSHttpHdrUrlGet (bufp, hdr_loc);
+    host_string = TSUrlHostGet (bufp, url_loc, &host_length);
 
 then your plugin would have to call:
 
         ::::c
-	TSHandleMLocRelease (bufp, hdr_loc, url_loc);
+    TSHandleMLocRelease (bufp, hdr_loc, url_loc);
 
 If an `TSMLoc` is obtained from a transaction, then it does not have a parent 
 `TSMLoc`. Use the null `TSMLoc` constant `TS_NULL_MLOC` as its parent. For 
 example, if your plugin calls:
 
         ::::c
-	TSHttpTxnClientReqGet (txnp, &bufp, &hdr_loc);
+    TSHttpTxnClientReqGet (txnp, &bufp, &hdr_loc);
 
 then you must release `hdr_loc` with:
 
@@ -60,10 +60,10 @@ by the `TSHttpTxn*Get` functions.
 Here's an example using a new `TSMimeHdrField` function:
 
         ::::c
-	TSHttpTxnServerRespGet( txnp, &resp_bufp, &resp_hdr_loc );
-	new_field_loc = TSMimeHdrFieldCreate (resp_bufp, resp_hdr_loc);
-	TSHandleMLocRelease ( resp_bufp, resp_hdr_loc, new_field_loc);
-	TSHandleMLocRelease ( resp_bufp, TS_NULL_MLOC, resp_hdr_loc);
+    TSHttpTxnServerRespGet( txnp, &resp_bufp, &resp_hdr_loc );
+    new_field_loc = TSMimeHdrFieldCreate (resp_bufp, resp_hdr_loc);
+    TSHandleMLocRelease ( resp_bufp, resp_hdr_loc, new_field_loc);
+    TSHandleMLocRelease ( resp_bufp, TS_NULL_MLOC, resp_hdr_loc);
 
 See the sample plugins for many more examples.
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/index.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/index.en.mdtext Thu Sep  1 21:34:29 2011
@@ -52,30 +52,30 @@ line is usually referred to as a **reque
 typical request header.
 
         ::::text
-	GET http://www.tiggerwigger.com/ HTTP/1.0
-	Proxy-Connection: Keep-Alive
-	User-Agent: Mozilla/5.0 [en] (X11; I; Linux 2.2.3 i686)
-	Host: www.tiggerwigger.com
-	Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */
-	*
-	
-	Accept-Encoding: gzip
-	Accept-Language: en
-	Accept-Charset: iso-8859-1, *, utf-8
+    GET http://www.tiggerwigger.com/ HTTP/1.0
+    Proxy-Connection: Keep-Alive
+    User-Agent: Mozilla/5.0 [en] (X11; I; Linux 2.2.3 i686)
+    Host: www.tiggerwigger.com
+    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */
+    *
+    
+    Accept-Encoding: gzip
+    Accept-Language: en
+    Accept-Charset: iso-8859-1, *, utf-8
 
 The **response header** for the above request might look like the following: 
 
         ::::plain
-	HTTP/1.0 200 OK
-	Date: Fri, 13 Nov 2009 06:57:43 GMT
-	Content-Location: http://locutus.tiggerwigger.com/index.html
-	Etag: "07db14afa76be1:1074"
-	Last-Modified: Thu, 05 Nov 2009 20:01:38 GMT
-	Content-Length: 7931
-	Content-Type: text/html
-	Server: Microsoft-IIS/4.0
-	Age: 922
-	Proxy-Connection: close
+    HTTP/1.0 200 OK
+    Date: Fri, 13 Nov 2009 06:57:43 GMT
+    Content-Location: http://locutus.tiggerwigger.com/index.html
+    Etag: "07db14afa76be1:1074"
+    Last-Modified: Thu, 05 Nov 2009 20:01:38 GMT
+    Content-Length: 7931
+    Content-Type: text/html
+    Server: Microsoft-IIS/4.0
+    Age: 922
+    Proxy-Connection: close
 
 The following figure illustrates an HTTP message with an expanded HTTP header. 
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/mime-headers.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/mime-headers.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/mime-headers.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-headers/mime-headers.en.mdtext Thu Sep  1 21:34:29 2011
@@ -45,11 +45,11 @@ a field, field names are not case-sensit
 
 
         :::text
-	MIME-header = *MIME-field
-	MIME-field = field-name ":" #field-value
-	field-name = *token
-	field-value = *token
-	
+    MIME-header = *MIME-field
+    MIME-field = field-name ":" #field-value
+    field-name = *token
+    field-value = *token
+    
 
 The MIME header data structure is a parsed version of a standard Internet MIME 
 header. The MIME header data structure is similar to the URL data structure 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-alternate-selection.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-alternate-selection.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-alternate-selection.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-alternate-selection.en.mdtext Thu Sep  1 21:34:29 2011
@@ -55,100 +55,100 @@ APIs; just return from the function.
 
 The sample code below shows how to call the alternate APIs.
 
-	:::c
-	static void handle_select_alt(TSHttpAltInfo infop)
-	{
-		TSMBuffer client_req_buf, cache_resp_buf;
-		TSMLoc client_req_hdr, cache_resp_hdr;
-		
-		TSMLoc accept_transform_field;
-		TSMLoc content_transform_field;
-		
-		int accept_transform_len = -1, content_transform_len = -1;
-		const char* accept_transform_value = NULL;
-		const char* content_transform_value = NULL;
-		int content_plugin, accept_plugin;
-		
-		float quality;
-		
-		/* get client request, cached request and cached response */
-		TSHttpAltInfoClientReqGet (infop, &client_req_buf, &client_req_hdr);
-		TSHttpAltInfoCachedRespGet(infop, &cache_resp_buf, &cache_resp_hdr);
-		
-		/* get the Accept-Transform field value from the client request */
-		accept_transform_field = TSMimeHdrFieldFind(client_req_buf,
-				client_req_hdr, "Accept-Transform", -1);
-		if (accept_transform_field) {
-			TSMimeHdrFieldValueStringGet(client_req_buf, client_req_hdr,
-					accept_transform_field, 0, &accept_transform_value, &accept_transform_len);
-			TSDebug(DBG_TAG, "Accept-Transform = |%s|",
-					accept_transform_value);
-		}
-		
-		/* get the Content-Transform field value from cached server response */
-		content_transform_field = TSMimeHdrFieldFind(cache_resp_buf,
-				cache_resp_hdr, "Content-Transform", -1);
-		if (content_transform_field) {
-			TSMimeHdrFieldValueStringGet(cache_resp_buf, cache_resp_hdr,
-					content_transform_field, 0, &content_transform_value, &content_transform_len);
-			TSDebug(DBG_TAG, "Content-Transform = |%s|",
-					content_transform_value);
-		}
-		
-		/* compute quality */
-		accept_plugin = (accept_transform_value && (accept_transform_len > 0) &&
-				(strncmp(accept_transform_value, "plugin",
-					 accept_transform_len) == 0));
-		
-		content_plugin = (content_transform_value && (content_transform_len >0) &&
-				(strncmp(content_transform_value, "plugin",
-					 content_transform_len) == 0));
-		
-		if (accept_plugin) {
-			quality = content_plugin ? 1.0 : 0.0;
-		} else {
-			quality = content_plugin ? 0.0 : 0.5;
-		}
-		
-		TSDebug(DBG_TAG, "Setting quality to %3.1f", quality);
-		
-		/* set quality for this alternate */
-		TSHttpAltInfoQualitySet(infop, quality);
-		
-		/* cleanup */
-		if (accept_transform_field)
-			TSHandleMLocRelease(client_req_buf, client_req_hdr,
-					accept_transform_field);
-		TSHandleMLocRelease(client_req_buf, TS_NULL_MLOC, client_req_hdr);
-		
-		if (content_transform_field)
-			TSHandleMLocRelease(cache_resp_buf, cache_resp_hdr,
-					content_transform_field);
-		TSHandleMLocRelease(cache_resp_buf, TS_NULL_MLOC, cache_resp_hdr);
-	}
-		
-	static int alt_plugin(TSCont contp, TSEvent event, void *edata)
-	{
-		TSHttpAltInfo infop;
-		
-		switch (event) {
-			case TS_EVENT_HTTP_SELECT_ALT:
-				infop = (TSHttpAltInfo)edata;
-				handle_select_alt(infop);
-				break;
-				
-			default:
-				break;
-		}
-		
-		return 0;
-	}
-		
-	void TSPluginInit (int argc, const char *argv[])
-	{
-		TSHttpHookAdd(TS_HTTP_SELECT_ALT_HOOK, TSContCreate (alt_plugin,
-					NULL));
-	}
+    :::c
+    static void handle_select_alt(TSHttpAltInfo infop)
+    {
+        TSMBuffer client_req_buf, cache_resp_buf;
+        TSMLoc client_req_hdr, cache_resp_hdr;
+        
+        TSMLoc accept_transform_field;
+        TSMLoc content_transform_field;
+        
+        int accept_transform_len = -1, content_transform_len = -1;
+        const char* accept_transform_value = NULL;
+        const char* content_transform_value = NULL;
+        int content_plugin, accept_plugin;
+        
+        float quality;
+        
+        /* get client request, cached request and cached response */
+        TSHttpAltInfoClientReqGet (infop, &client_req_buf, &client_req_hdr);
+        TSHttpAltInfoCachedRespGet(infop, &cache_resp_buf, &cache_resp_hdr);
+        
+        /* get the Accept-Transform field value from the client request */
+        accept_transform_field = TSMimeHdrFieldFind(client_req_buf,
+                client_req_hdr, "Accept-Transform", -1);
+        if (accept_transform_field) {
+            TSMimeHdrFieldValueStringGet(client_req_buf, client_req_hdr,
+                    accept_transform_field, 0, &accept_transform_value, &accept_transform_len);
+            TSDebug(DBG_TAG, "Accept-Transform = |%s|",
+                    accept_transform_value);
+        }
+        
+        /* get the Content-Transform field value from cached server response */
+        content_transform_field = TSMimeHdrFieldFind(cache_resp_buf,
+                cache_resp_hdr, "Content-Transform", -1);
+        if (content_transform_field) {
+            TSMimeHdrFieldValueStringGet(cache_resp_buf, cache_resp_hdr,
+                    content_transform_field, 0, &content_transform_value, &content_transform_len);
+            TSDebug(DBG_TAG, "Content-Transform = |%s|",
+                    content_transform_value);
+        }
+        
+        /* compute quality */
+        accept_plugin = (accept_transform_value && (accept_transform_len > 0) &&
+                (strncmp(accept_transform_value, "plugin",
+                     accept_transform_len) == 0));
+        
+        content_plugin = (content_transform_value && (content_transform_len >0) &&
+                (strncmp(content_transform_value, "plugin",
+                     content_transform_len) == 0));
+        
+        if (accept_plugin) {
+            quality = content_plugin ? 1.0 : 0.0;
+        } else {
+            quality = content_plugin ? 0.0 : 0.5;
+        }
+        
+        TSDebug(DBG_TAG, "Setting quality to %3.1f", quality);
+        
+        /* set quality for this alternate */
+        TSHttpAltInfoQualitySet(infop, quality);
+        
+        /* cleanup */
+        if (accept_transform_field)
+            TSHandleMLocRelease(client_req_buf, client_req_hdr,
+                    accept_transform_field);
+        TSHandleMLocRelease(client_req_buf, TS_NULL_MLOC, client_req_hdr);
+        
+        if (content_transform_field)
+            TSHandleMLocRelease(cache_resp_buf, cache_resp_hdr,
+                    content_transform_field);
+        TSHandleMLocRelease(cache_resp_buf, TS_NULL_MLOC, cache_resp_hdr);
+    }
+        
+    static int alt_plugin(TSCont contp, TSEvent event, void *edata)
+    {
+        TSHttpAltInfo infop;
+        
+        switch (event) {
+            case TS_EVENT_HTTP_SELECT_ALT:
+                infop = (TSHttpAltInfo)edata;
+                handle_select_alt(infop);
+                break;
+                
+            default:
+                break;
+        }
+        
+        return 0;
+    }
+        
+    void TSPluginInit (int argc, const char *argv[])
+    {
+        TSHttpHookAdd(TS_HTTP_SELECT_ALT_HOOK, TSContCreate (alt_plugin,
+                    NULL));
+    }
 
 Traffic Server augments the alternate selection through these callouts using
 the following algorithm:

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-sessions.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-sessions.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-sessions.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-sessions.en.mdtext Thu Sep  1 21:34:29 2011
@@ -30,11 +30,11 @@ the connection closes.
 The HTTP session hooks are:
 
 * `TS_HTTP_SSN_START_HOOK`
-	Called when an HTTP session is started (a session starts when a client connects
+    Called when an HTTP session is started (a session starts when a client connects
 to Traffic Server). This hook must be added as a global hook.
 
 * `TS_HTTP_SSN_CLOSE_HOOK`
-	Called when an HTTP session ends (a session ends when the client connection
+    Called when an HTTP session ends (a session ends when the client connection
 is closed). This hook must be added as a global hook.
 
 Use the session hooks to get a handle to a session (an `TSHttpSsn` object).

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-transactions.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-transactions.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-transactions.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-hooks-and-transactions/http-transactions.en.mdtext Thu Sep  1 21:34:29 2011
@@ -31,120 +31,120 @@ The sample code below illustrates how to
 and associate data to the transaction.
 
 
-	:::c
-	/*
-	* Simple plugin that illustrates:
-	* - how to register locally to a transaction
-	* - how to deal with data that's associated with a tranaction
-	*
-	* Note: for readability, error checking is omitted
-	*/
-	
-	#include <ts/ts.h>
-	
-	#define DBG_TAG "txn"
-	
-	/* Structure to be associated to txns */
-	typedef struct {
-	   int i;
-	   float f;
-	   char *s;
-	} TxnData;
-	
-	/* Allocate memory and init a TxnData structure */
-	TxnData *
-	txn_data_alloc()
-	{
-	   TxnData *data;
-	   data = TSmalloc(sizeof(TxnData));
-		
-	   data->i = 1;
-	   data->f = 0.5;
-	   data->s = "Constant String";
-	   return data;
-	}
-		
-	/* Free up a TxnData structure */
-	void
-	txn_data_free(TxnData *data)
-	{
-	   TSfree(data);
-	}
-		
-	/* Handler for event READ_REQUEST and TXN_CLOSE */
-	static int
-	local_hook_handler (TSCont contp, TSEvent event, void *edata)
-	{
-	   TSHttpTxn txnp = (TSHttpTxn) edata;
-	   TxnData *txn_data = TSContDataGet(contp);
-	   switch (event) {
-	   case TS_EVENT_HTTP_READ_REQUEST_HDR:
-	      /* Modify values of txn data */
-	      txn_data->i = 2;
-	      txn_data->f = 3.5;
-	      txn_data->s = "Constant String 2";
-	      break;
-		
-	   case TS_EVENT_HTTP_TXN_CLOSE:
-	      /* Print txn data values */
-	      TSDebug(DBG_TAG, "Txn data i=%d f=%f s=%s", txn_data->i, txn_data->f, txn_data->s);
-		
-	      /* Then destroy the txn cont and its data */
-	      txn_data_free(txn_data);
-	      TSContDestroy(contp);
-	      break;
-		
-	   default:
-	       TSAssert(!"Unexpected event");
-	       break;
-	   }
-		
-	   TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
-	   return 1;
-	}
-		
-	/* Handler for event TXN_START */
-	static int
-	global_hook_handler (TSCont contp, TSEvent event, void *edata)
-	{
-	   TSHttpTxn txnp = (TSHttpTxn) edata;
-	   TSCont txn_contp;
-	   TxnData *txn_data;
-		
-	   switch (event) {
-	   case TS_EVENT_HTTP_TXN_START:
-	      /* Create a new continuation for this txn and associate data to it */
-	      txn_contp = TSContCreate(local_hook_handler, TSMutexCreate());
-	      txn_data = txn_data_alloc();
-	      TSContDataSet(txn_contp, txn_data);
-		
-	      /* Registers locally to hook READ_REQUEST and TXN_CLOSE */
-	      TSHttpTxnHookAdd(txnp, TS_HTTP_READ_REQUEST_HDR_HOOK, txn_contp);
-	      TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, txn_contp);
-	      break;
-		
-	   default:
-	      TSAssert(!"Unexpected event");
-	      break;
-	   }
-		
-	   TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
-	   return 1;
-	}
-		
-		
-	void
-	TSPluginInit (int argc, const char *argv[])
-	{
-	   TSCont contp;
-		
-	   /* Note that we do not need a mutex for this txn since it registers globally
-	      and doesn't have any data associated with it */
-	   contp = TSContCreate(global_hook_handler, NULL);
-		
-	   /* Register gloabally */
-	   TSHttpHookAdd(TS_HTTP_TXN_START_HOOK, contp);
-	}
+    :::c
+    /*
+    * Simple plugin that illustrates:
+    * - how to register locally to a transaction
+    * - how to deal with data that's associated with a tranaction
+    *
+    * Note: for readability, error checking is omitted
+    */
+    
+    #include <ts/ts.h>
+    
+    #define DBG_TAG "txn"
+    
+    /* Structure to be associated to txns */
+    typedef struct {
+       int i;
+       float f;
+       char *s;
+    } TxnData;
+    
+    /* Allocate memory and init a TxnData structure */
+    TxnData *
+    txn_data_alloc()
+    {
+       TxnData *data;
+       data = TSmalloc(sizeof(TxnData));
+        
+       data->i = 1;
+       data->f = 0.5;
+       data->s = "Constant String";
+       return data;
+    }
+        
+    /* Free up a TxnData structure */
+    void
+    txn_data_free(TxnData *data)
+    {
+       TSfree(data);
+    }
+        
+    /* Handler for event READ_REQUEST and TXN_CLOSE */
+    static int
+    local_hook_handler (TSCont contp, TSEvent event, void *edata)
+    {
+       TSHttpTxn txnp = (TSHttpTxn) edata;
+       TxnData *txn_data = TSContDataGet(contp);
+       switch (event) {
+       case TS_EVENT_HTTP_READ_REQUEST_HDR:
+          /* Modify values of txn data */
+          txn_data->i = 2;
+          txn_data->f = 3.5;
+          txn_data->s = "Constant String 2";
+          break;
+        
+       case TS_EVENT_HTTP_TXN_CLOSE:
+          /* Print txn data values */
+          TSDebug(DBG_TAG, "Txn data i=%d f=%f s=%s", txn_data->i, txn_data->f, txn_data->s);
+        
+          /* Then destroy the txn cont and its data */
+          txn_data_free(txn_data);
+          TSContDestroy(contp);
+          break;
+        
+       default:
+           TSAssert(!"Unexpected event");
+           break;
+       }
+        
+       TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
+       return 1;
+    }
+        
+    /* Handler for event TXN_START */
+    static int
+    global_hook_handler (TSCont contp, TSEvent event, void *edata)
+    {
+       TSHttpTxn txnp = (TSHttpTxn) edata;
+       TSCont txn_contp;
+       TxnData *txn_data;
+        
+       switch (event) {
+       case TS_EVENT_HTTP_TXN_START:
+          /* Create a new continuation for this txn and associate data to it */
+          txn_contp = TSContCreate(local_hook_handler, TSMutexCreate());
+          txn_data = txn_data_alloc();
+          TSContDataSet(txn_contp, txn_data);
+        
+          /* Registers locally to hook READ_REQUEST and TXN_CLOSE */
+          TSHttpTxnHookAdd(txnp, TS_HTTP_READ_REQUEST_HDR_HOOK, txn_contp);
+          TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, txn_contp);
+          break;
+        
+       default:
+          TSAssert(!"Unexpected event");
+          break;
+       }
+        
+       TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
+       return 1;
+    }
+        
+        
+    void
+    TSPluginInit (int argc, const char *argv[])
+    {
+       TSCont contp;
+        
+       /* Note that we do not need a mutex for this txn since it registers globally
+          and doesn't have any data associated with it */
+       contp = TSContCreate(global_hook_handler, NULL);
+        
+       /* Register gloabally */
+       TSHttpHookAdd(TS_HTTP_TXN_START_HOOK, contp);
+    }
 
 
 See [Adding Hooks](adding-hooks) for background about HTTP transactions

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/append-transform-plugin.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/append-transform-plugin.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/append-transform-plugin.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/append-transform-plugin.en.mdtext Thu Sep  1 21:34:29 2011
@@ -23,7 +23,7 @@ The append-transform plugin appends text
 obtains this text from a file; the name of the file containing the append text
 is a parameter you specify in `plugin.config`, as follows:
 
-	append-transform.so path/to/file
+    append-transform.so path/to/file
 
 The append-transform plugin is based on `null-transform.c`. The only difference
 is that after the plugin feeds the document through the transformation, it
@@ -35,96 +35,96 @@ does:
 
 * **`my\_data\_alloc`**
 
-	Allocates and initializes a `MyData` structure. The plugin defines a struct,
+    Allocates and initializes a `MyData` structure. The plugin defines a struct,
 `MyData`, as follows:
 
-		:::c
-		typedef struct {
-			TSVIO output_vio;
-			TSIOBuffer output_buffer;
-			TSIOBufferReader output_reader;
-			int append_needed;
-		} MyData;
-	The `MyData` structure is used to represent data that the transformation (vconnection)
+        :::c
+        typedef struct {
+            TSVIO output_vio;
+            TSIOBuffer output_buffer;
+            TSIOBufferReader output_reader;
+            int append_needed;
+        } MyData;
+    The `MyData` structure is used to represent data that the transformation (vconnection)
 needs. The transformation's data pointer is set to a `MyData` pointer using
 `TSContDataSet` in the `handle_transform` routine.
 
 * **`my\_data\_destroy`**
 
-	Destroys objects of type `MyData`. To deallocate the transform's data, the
+    Destroys objects of type `MyData`. To deallocate the transform's data, the
 `append_transform` routine (see below) calls `my_data_destroy` when the transformation
 is complete.
 
 * **`handle\_transform`**
 
-	This function does the actual data transformation. The transformation is created
+    This function does the actual data transformation. The transformation is created
 in `transform_add` (see below). `handle_transform` is called by `append_transform`.
 
 * **`append\_transform`**
 
-	This is the handler function for the transformation vconnection created in
+    This is the handler function for the transformation vconnection created in
 `transform_add`. It is the implementation of the vconnection.
 
-	* If the transformation vconnection has been closed, then `append_transform`
-	calls `my_data_destroy` to destroy the vonnection.
+    * If the transformation vconnection has been closed, then `append_transform`
+    calls `my_data_destroy` to destroy the vonnection.
 
-	* If `append_transform` receives an error event, then it calls back the continuation
-	to let it know it has completed the write operation.
+    * If `append_transform` receives an error event, then it calls back the continuation
+    to let it know it has completed the write operation.
 
-	* If it receives a `WRITE_COMPLETE` event, then it shuts down the write portion
-	of its vconnection.
+    * If it receives a `WRITE_COMPLETE` event, then it shuts down the write portion
+    of its vconnection.
 
-	* If it receives a `WRITE_READY` or any other event (such as `TS_HTTP_RESPONSE_TRANSFORM_HOOK`),
-	then it calls `handle_transform` to attempt to transform more data.
+    * If it receives a `WRITE_READY` or any other event (such as `TS_HTTP_RESPONSE_TRANSFORM_HOOK`),
+    then it calls `handle_transform` to attempt to transform more data.
 
 
 * **`transformable`**
 
-	The plugin transforms only documents that have a content type of `text/html`.
+    The plugin transforms only documents that have a content type of `text/html`.
 This function examines the `Content-Type` MIME header field in the response
 header. If the value of the MIME field is `text/html`, then the function returns
 1; otherwise, it returns zero.
 
 * **`transform\_add`**
 
-	Creates the transformation for the current transaction and sets up a transformation
+    Creates the transformation for the current transaction and sets up a transformation
 hook. The handler function for the transformation is `append_transform`.
 
 * **`transform\_plugin`**
 
-	This is the handler function for the main continuation for the plugin. Traffic
+    This is the handler function for the main continuation for the plugin. Traffic
 Server calls this function whenever it reads an HTTP response header. `transform_plugin`
 does the following:
 
-	* Gets a handle to the HTTP transaction being processed
+    * Gets a handle to the HTTP transaction being processed
 
-	* Calls `transformable` to determine whether the response document content is
-	of type `text/html`
+    * Calls `transformable` to determine whether the response document content is
+    of type `text/html`
 
-	* If the content is transformable, then it calls `transform_add` to create the
-	transformation.
+    * If the content is transformable, then it calls `transform_add` to create the
+    transformation.
 
-	* Calls `TSHttpTxnReenable` to continue the transaction
+    * Calls `TSHttpTxnReenable` to continue the transaction
 
 
 * **`load`**
 
-	Opens the file containing the text to be appended and loads the contents of
+    Opens the file containing the text to be appended and loads the contents of
 the file into an `TSIOBuffer` called `append_buffer`.
 
 * **`TSPluginInit`**
 
-	Does the following:
+    Does the following:
 
-	* Checks to make sure that the required configuration information (the append
-	text filename) is entered in `plugin.config` correctly.
+    * Checks to make sure that the required configuration information (the append
+    text filename) is entered in `plugin.config` correctly.
 
-	* If there is a filename, then `TSPluginInit` calls load to load the text.
+    * If there is a filename, then `TSPluginInit` calls load to load the text.
 
-	* Creates a continuation for the plugin. The handler for this continuation is
-	`transform_plugin`.
+    * Creates a continuation for the plugin. The handler for this continuation is
+    `transform_plugin`.
 
-	* Adds the plugin's continuation to `TS_HTTP_READ_RESPONSE_HDR_HOOK`. In other
-	words, it sets up a callback of the plugin's continuation when Traffic Server
-	reads HTTP response headers.
+    * Adds the plugin's continuation to `TS_HTTP_READ_RESPONSE_HDR_HOOK`. In other
+    words, it sets up a callback of the plugin's continuation when Traffic Server
+    reads HTTP response headers.
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/index.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/index.en.mdtext Thu Sep  1 21:34:29 2011
@@ -107,15 +107,15 @@ which continuation to call back when pro
 The `TSVIO` data structure itself is opaque, but it might have been defined
 as follows:
 
-	:::c
-	typedef struct {
-	     TSCont continuation;
-	     TSVConn vconnection;
-	     TSIOBufferReader reader;
-	     TSMutex mutex;
-	     int nbytes;
-	     int ndone;
-	} *TSVIO;
+    :::c
+    typedef struct {
+         TSCont continuation;
+         TSVConn vconnection;
+         TSIOBufferReader reader;
+         TSMutex mutex;
+         int nbytes;
+         int ndone;
+    } *TSVIO;
 
 ### IO Buffers ### {#IOBuffers}
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.mdtext Thu Sep  1 21:34:29 2011
@@ -31,61 +31,61 @@ The following is a step-by-step walk thr
 
 1. Gets a handle to HTTP transactions.
 
-		:::c
-		void
-		TSPluginInit (int argc, const char *argv[]) {
-			TSHttpHookAdd (TS_HTTP_READ_RESPONSE_HDR_HOOK,
-					TSContCreate (transform_plugin, NULL)); }
-	With this `TSPluginInit` routine, the plugin is called back every time Traffic
+        :::c
+        void
+        TSPluginInit (int argc, const char *argv[]) {
+            TSHttpHookAdd (TS_HTTP_READ_RESPONSE_HDR_HOOK,
+                    TSContCreate (transform_plugin, NULL)); }
+    With this `TSPluginInit` routine, the plugin is called back every time Traffic
 Server reads a response header.
 
 2. Checks to see if the transaction response is transformable.
 
-		:::c
-		static int transform_plugin (TSCont contp, TSEvent event, void *edata) {
-			TSHttpTxn txnp = (TSHttpTxn) edata;
-			switch (event) {
-				case TS_EVENT_HTTP_READ_RESPONSE_HDR:
-					if (transformable (txnp)) {
-						transform_add (txnp);
-					}
-	The default behavior for transformations is to cache the transformed content
+        :::c
+        static int transform_plugin (TSCont contp, TSEvent event, void *edata) {
+            TSHttpTxn txnp = (TSHttpTxn) edata;
+            switch (event) {
+                case TS_EVENT_HTTP_READ_RESPONSE_HDR:
+                    if (transformable (txnp)) {
+                        transform_add (txnp);
+                    }
+    The default behavior for transformations is to cache the transformed content
 (if desired, you also can tell Traffic Server to cache untransformed content).
 Therefore, only responses received directly from an origin server need to be
 transformed. Objects served from the cache are already transformed. To determine
 whether the response is from the origin server, the routine transformable checks
 the response header for the "200 OK" server response.
 
-		:::c
-		{
-			TSMBuffer bufp;
-			TSMLoc hdr_loc;
-			TSHttpStatus resp_status;
-			
-			TSHttpTxnServerRespGet (txnp, &bufp, &hdr_loc);
-			
-			if(TS_HTTP_STATUS_OK==
-					(resp_status=TSHttpHdrStatusGet(bufp,hdr_loc)))
-			{
-				return 1;
-			}
-			else {
-				return 0;
-			}
-		}
+        :::c
+        {
+            TSMBuffer bufp;
+            TSMLoc hdr_loc;
+            TSHttpStatus resp_status;
+            
+            TSHttpTxnServerRespGet (txnp, &bufp, &hdr_loc);
+            
+            if(TS_HTTP_STATUS_OK==
+                    (resp_status=TSHttpHdrStatusGet(bufp,hdr_loc)))
+            {
+                return 1;
+            }
+            else {
+                return 0;
+            }
+        }
 
 3. If the response is transformable, then the plugin creates a transformation
 vconnection that gets called back when the response data is ready to be transformed
 (as it is streaming from the origin server).
 
-		:::c
-		static void transform_add (TSHttpTxn txnp)
-		{
-			TSVConn connp;
-			connp = TSTransformCreate (bnull_transform, txnp);
-			TSHttpTxnHookAdd (txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
-		}
-	The previous code fragment shows that the handler function for the transformation
+        :::c
+        static void transform_add (TSHttpTxn txnp)
+        {
+            TSVConn connp;
+            connp = TSTransformCreate (bnull_transform, txnp);
+            TSHttpTxnHookAdd (txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
+        }
+    The previous code fragment shows that the handler function for the transformation
 vconnection is `bnull_transform`.
 
 4. The `bnull_transform` function has to handle `ERROR`, `WRITE_COMPLETE`, `WRITE_READY`,
@@ -107,9 +107,9 @@ write operation to the input buffer.
 7. Copy data from the input buffer to the output buffer. See the `handle_buffering`
 function for the following code fragment:
 
-		:::c
-		TSIOBufferCopy (data->output_buffer,
-				TSVIOReaderGet (write_vio), towrite, 0);
+        :::c
+        TSIOBufferCopy (data->output_buffer,
+                TSVIOReaderGet (write_vio), towrite, 0);
 
 8. Tell the input buffer that the transformation has read the data. See the `handle_buffering`
 function for the following code fragment:
@@ -122,32 +122,32 @@ of `ndone`). See the `handle_buffering` 
 10. If there is more data left to read ( if ndone &lt; nbytes), then the
 `handle_buffering` function wakes up the upstream vconnection by sending it `WRITE_READY`:
 
-		:::c
-		if (TSVIONTodoGet (write_vio) > 0) {
-			if (towrite > 0) {
-				TSContCall (TSVIOContGet (write_vio),
-						TS_EVENT_VCONN_WRITE_READY, write_vio);
-			}
-		} else {
-	The process of passing data through the transformation is illustrated in the
+        :::c
+        if (TSVIONTodoGet (write_vio) > 0) {
+            if (towrite > 0) {
+                TSContCall (TSVIOContGet (write_vio),
+                        TS_EVENT_VCONN_WRITE_READY, write_vio);
+            }
+        } else {
+    The process of passing data through the transformation is illustrated in the
 following diagram. The transformation sends `WRITE_READY` events when it needs
 more data; when data is available, the upstream vconnection reenables the transformation
 with an `IMMEDIATE` event.
 
-	The following diagram illustrates the read from an input vconnection:
+    The following diagram illustrates the read from an input vconnection:
 
-	**Reading Data Into the Buffer (the `STATE_BUFFER_DATA` State)**  {#ReadingDataIntoBuffer}
+    **Reading Data Into the Buffer (the `STATE_BUFFER_DATA` State)**  {#ReadingDataIntoBuffer}
 
-	![Reading Data Into the Buffer the STATE_BUFFER_DATA State](/images/sdk/vconn_buffer.jpg)
+    ![Reading Data Into the Buffer the STATE_BUFFER_DATA State](/images/sdk/vconn_buffer.jpg)
 
 11. When the data is read into the output buffer, the `handle_buffering` function
 sets the state of the transformation's data structure to `STATE_OUTPUT_DATA`
 and calls the upstream vconnection back with the `WRITE_COMPLETE` event.
 
-		:::c
-		data->state = STATE_OUTPUT_DATA;
-		TSContCall (TSVIOContGet (write_vio),
-				 TS_EVENT_VCONN_WRITE_COMPLETE, write_vio);
+        :::c
+        data->state = STATE_OUTPUT_DATA;
+        TSContCall (TSVIOContGet (write_vio),
+                 TS_EVENT_VCONN_WRITE_COMPLETE, write_vio);
 
 12. The upstream vconnection will probably shut down the write operation when it
 receives the `WRITE_COMPLETE` event. The handler function of the transformation,
@@ -160,14 +160,14 @@ calls `handle_output`.
 
 14. The `handle_output` function writes the buffer to the output vconnection:
 
-		:::c
-		data->output_vio =
-		TSVConnWrite (output_conn, contp, data->output_reader,
-		TSIOBufferReaderAvail (data->output_reader) );
-	The following diagram illustrates the write to the output vconnection:
+        :::c
+        data->output_vio =
+        TSVConnWrite (output_conn, contp, data->output_reader,
+        TSIOBufferReaderAvail (data->output_reader) );
+    The following diagram illustrates the write to the output vconnection:
 
-	**Writing the Buffered Data to the Output Vconnection** {#WritingBufferedtDataIntoVConnection)
+    **Writing the Buffered Data to the Output Vconnection** {#WritingBufferedtDataIntoVConnection)
 
-	![Writing the Buffered Data to the Output Vconnection](/images/sdk/vconn_buf_output.jpg)
+    ![Writing the Buffered Data to the Output Vconnection](/images/sdk/vconn_buf_output.jpg)
 
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-null-transformation-plugin.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-null-transformation-plugin.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-null-transformation-plugin.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/http-transformation-plugin/sample-null-transformation-plugin.en.mdtext Thu Sep  1 21:34:29 2011
@@ -29,24 +29,24 @@ Below is an overview of the null transfo
 
 1.  Gets a handle to HTTP transactions.
 
-		:::c
-		void
-		TSPluginInit (int argc, const char *argv[]) {
-			TSHttpHookAdd (TS_HTTP_READ_RESPONSE_HDR_HOOK,
-					TSContCreate (transform_plugin, NULL));
+        :::c
+        void
+        TSPluginInit (int argc, const char *argv[]) {
+            TSHttpHookAdd (TS_HTTP_READ_RESPONSE_HDR_HOOK,
+                    TSContCreate (transform_plugin, NULL));
    With this `TSPluginInit` routine, the plugin is called back every time Traffic
 Server reads a response header.
 
 2. Checks to see if the transaction response is transformable.
 
-		:::c
-		static int transform_plugin (TSCont contp, TSEvent event, void *edata) {
-			TSHttpTxn txnp = (TSHttpTxn) edata;
-			switch (event) {
-				case TS_EVENT_HTTP_READ_RESPONSE_HDR:
-					if (transformable (txnp)) {
-						transform_add (txnp);
-					}
+        :::c
+        static int transform_plugin (TSCont contp, TSEvent event, void *edata) {
+            TSHttpTxn txnp = (TSHttpTxn) edata;
+            switch (event) {
+                case TS_EVENT_HTTP_READ_RESPONSE_HDR:
+                    if (transformable (txnp)) {
+                        transform_add (txnp);
+                    }
    The default behavior for transformations is to cache the transformed content
 (you can also tell Traffic Server to cache untransformed content, if you want).
 Therefore, only responses received directly from an origin server need to be
@@ -54,45 +54,45 @@ transformed. Objects served from cache a
 whether the response is from the origin server, the routine `transformable`
 checks the response header for the "200 OK" server response.
 
-		:::c
-		static int transformable (TSHttpTxn txnp)
-		{
-			TSMBuffer bufp;
-			TSMLoc hdr_loc;
-			TSHttpStatus resp_status;
-			TSHttpTxnServerRespGet (txnp, &bufp, &hdr_loc);
-
-			if (TS_HTTP_STATUS_OK == (resp_status =
-						TSHttpHdrStatusGet (bufp, hdr_loc)) ) {
-				return 1;
-			} else {
-				return 0;
-			}
-		}
+        :::c
+        static int transformable (TSHttpTxn txnp)
+        {
+            TSMBuffer bufp;
+            TSMLoc hdr_loc;
+            TSHttpStatus resp_status;
+            TSHttpTxnServerRespGet (txnp, &bufp, &hdr_loc);
+
+            if (TS_HTTP_STATUS_OK == (resp_status =
+                        TSHttpHdrStatusGet (bufp, hdr_loc)) ) {
+                return 1;
+            } else {
+                return 0;
+            }
+        }
 
 3. If the response is transformable, then the plugin creates a transformation
 vconnection that gets called back when the response data is ready to be transformed
 (as it is streaming from the origin server).
 
-		:::c
-		static void transform_add (TSHttpTxn txnp)
-		{
-			TSVConn connp;
-			connp = TSTransformCreate (null_transform, txnp);
-			TSHttpTxnHookAdd (txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
-		}
+        :::c
+        static void transform_add (TSHttpTxn txnp)
+        {
+            TSVConn connp;
+            connp = TSTransformCreate (null_transform, txnp);
+            TSHttpTxnHookAdd (txnp, TS_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
+        }
     The previous code fragment shows that the handler function for the transformation
 vconnection is `null_transform`.
 
 4. Get a handle to the output vconnection (that receives data from the tranformation).
 
-		:::c
-		output_conn = TSTransformOutputVConnGet (con
+        :::c
+        output_conn = TSTransformOutputVConnGet (con
 
 5. Get a handle to the input VIO. (See the `handle_transform` function.)
 
-		:::c
-		input_vio = TSVConnWriteVIOGet (contp);
+        :::c
+        input_vio = TSVConnWriteVIOGet (contp);
    This is so that the transformation can get information about the upstream vconnection's
 write operation to the input buffer.
 
@@ -101,41 +101,41 @@ When the write is initiated, the transfo
 `WRITE_COMPLETE`, or `ERROR` events from the output vconnection.
 See the `handle_transform` function for the following code fragment:
 
-		:::c
-		data->output_vio = TSVConnWrite (output_conn, contp,
-			data->output_reader, TSVIONBytesGet (input_vio));
+        :::c
+        data->output_vio = TSVConnWrite (output_conn, contp,
+            data->output_reader, TSVIONBytesGet (input_vio));
 
 7. Copy data from the input buffer to the output buffer. See the `handle_transform`
 function for the following code fragment:
 
-		::::c
-		TSIOBufferCopy (TSVIOBufferGet (data->output_vio),
-				TSVIOReaderGet (input_vio), towrite, 0);
+        ::::c
+        TSIOBufferCopy (TSVIOBufferGet (data->output_vio),
+                TSVIOReaderGet (input_vio), towrite, 0);
 
 8. Tell the input buffer that the transformation has read the data. See the `handle_transform`
 function for the following code fragment:
 
-		TSIOBufferReaderConsume (TSVIOReaderGet (input_vio), towrite);
+        TSIOBufferReaderConsume (TSVIOReaderGet (input_vio), towrite);
 
 9. Modify the input VIO to tell it how much data has been read (increase the value
 of `ndone`). See the `handle_transform` function for the following code fragment:
 
-		::::c
-		TSVIONDoneSet (input_vio, TSVIONDoneGet (input_vio) + towrite);
+        ::::c
+        TSVIONDoneSet (input_vio, TSVIONDoneGet (input_vio) + towrite);
 
 10. If there is more data left to read ( if ndone &lt; nbytes), then the
 `handle_transform` function wakes up the downstream vconnection with a reenable
 and wakes up the upstream vconnection by sending it `WRITE_READY`:
 
-		:::c
-		if (TSVIONTodoGet (input_vio) > 0) {
-			if (towrite > 0) {
-				TSVIOReenable (data->output_vio);
-			
-				TSContCall (TSVIOContGet (input_vio),
-						TS_EVENT_VCONN_WRITE_READY, input_vio);
-			}
-			} else {
+        :::c
+        if (TSVIONTodoGet (input_vio) > 0) {
+            if (towrite > 0) {
+                TSVIOReenable (data->output_vio);
+            
+                TSContCall (TSVIOContGet (input_vio),
+                        TS_EVENT_VCONN_WRITE_READY, input_vio);
+            }
+            } else {
    The process of passing data through the transformation is illustrated in the
 following diagram. The downstream vconnections send `WRITE_READY` events when
 they need more data; when data is available, the upstream vconnections reenable
@@ -152,16 +152,16 @@ output vconnection with a reenable. It t
 from the upstream vconnection by sending the upstream vconnection a `WRITE_COMPLETE`
 event.
 
-		:::c
-		} else {
-			
-			TSVIONBytesSet (data->output_vio, TSVIONDoneGet (input_vio));
-			TSVIOReenable (data->output_vio);
-			TSContCall (TSVIOContGet (input_vio),
-					TS_EVENT_VCONN_WRITE_COMPLETE, input_vio);
-		}
+        :::c
+        } else {
+            
+            TSVIONBytesSet (data->output_vio, TSVIONDoneGet (input_vio));
+            TSVIOReenable (data->output_vio);
+            TSContCall (TSVIOContGet (input_vio),
+                    TS_EVENT_VCONN_WRITE_COMPLETE, input_vio);
+        }
 
-	When the upstream vconnection receives the `WRITE_COMPLETE` event, it will
+    When the upstream vconnection receives the `WRITE_COMPLETE` event, it will
 probably shut down the write operation.
 
 12.  Similarly, when the downstream vconnection has consumed all of the data, it
@@ -170,13 +170,13 @@ this event with a shut down (the transfo
 to the downstream vconnection). See the `null_plugin` function for the following
 code fragment:
 
-		:::c
-		case TS_EVENT_VCONN_WRITE_COMPLETE:
-			TSVConnShutdown (TSTransformOutputVConnGet (contp), 0, 1
-			break;
+        :::c
+        case TS_EVENT_VCONN_WRITE_COMPLETE:
+            TSVConnShutdown (TSTransformOutputVConnGet (contp), 0, 1
+            break;
    The following diagram illustrates the flow of events:
 
-	**Ending the Transformation** {#EndingTransformation}
+    **Ending the Transformation** {#EndingTransformation}
 
-	![Ending the Transformation](/images/sdk/vconnection2.jpg)
+    ![Ending the Transformation](/images/sdk/vconnection2.jpg)
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/example.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/example.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/example.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/example.en.mdtext Thu Sep  1 21:34:29 2011
@@ -26,28 +26,28 @@ Then, issue `TSVConnRead` to read the do
 required as `content_length`. Assume the following data:
 
             ::::c
-	    TSIOBuffer       cache_bufp = TSIOBufferCreate ();
-	    TSIOBufferReader cache_readerp = TSIOBufferReaderAlloc (out_bufp);
-	    TSVConn          cache_vconnp = NULL;
-	    TSVIO            cache_vio = NULL;
-	    int               content_length = 0;
+        TSIOBuffer       cache_bufp = TSIOBufferCreate ();
+        TSIOBufferReader cache_readerp = TSIOBufferReaderAlloc (out_bufp);
+        TSVConn          cache_vconnp = NULL;
+        TSVIO            cache_vio = NULL;
+        int               content_length = 0;
 
 In the `TS_CACHE_OPEN_READ` handler:
 
         ::::c
-	cache_vconnp = (TSVConn) data;
-	    TSVConnCachedObjectSizeGet (cache_vconnp, &content_length);
-	    cache_vio = TSVConnRead (cache_vconn, contp, cache_bufp, content_length);
+    cache_vconnp = (TSVConn) data;
+        TSVConnCachedObjectSizeGet (cache_vconnp, &content_length);
+        cache_vio = TSVConnRead (cache_vconn, contp, cache_bufp, content_length);
 
 In the `TS_EVENT_VCONN_READ_READY` handler:
 
         ::::c
-	(usual VCONN_READ_READY handler logic)
-	int nbytes = TSVIONBytesGet (cache_vio);
-	int ntodo  = TSVIONTodoGet (cache_vio);
-	int ndone  = TSVIONDoneGet (cache_vio);
-	(consume data in cache_bufp)
-	TSVIOReenable (cache_vio);
+    (usual VCONN_READ_READY handler logic)
+    int nbytes = TSVIONBytesGet (cache_vio);
+    int ntodo  = TSVIONTodoGet (cache_vio);
+    int ndone  = TSVIONDoneGet (cache_vio);
+    (consume data in cache_bufp)
+    TSVIOReenable (cache_vio);
 
 Do not try to get continuations or VIOs from `TSVConn` objects for cache vconnections. 
 Also note that the following APIs can only be used on transformation vconnections 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/index.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/index.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/guide-to-cache-api/index.en.mdtext Thu Sep  1 21:34:29 2011
@@ -30,12 +30,12 @@ plugin-specific data (a specific type of
 **Example:**
 
             :::c
-	    const unsigned char *key_name = "example key name";
+        const unsigned char *key_name = "example key name";
 
-	    TSCacheKey key;
-	    TSCacheKeyCreate (&key);
-	    TSCacheKeyDigestSet (key, (unsigned char *) key_name , strlen(key_name));
-	    TSCacheKeyDestroy (key);
+        TSCacheKey key;
+        TSCacheKeyCreate (&key);
+        TSCacheKeyDigestSet (key, (unsigned char *) key_name , strlen(key_name));
+        TSCacheKeyDestroy (key);
 
 ### How to Do a Cache Read ### {#HowDoaCacheRead}
 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/transformations.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/transformations.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/transformations.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/transformations.en.mdtext Thu Sep  1 21:34:29 2011
@@ -50,17 +50,17 @@ It is common for the handler function fo
 Their basic form looks something like the code fragment below:
 
         ::::c
-	int
-	vconnection_handler (TSCont contp, TSEvent event, void *edata)
-	{
-	if (TSVConnClosedGet (contp)) {
-	        /* Destroy any vconnection specific data here. */
-	        TSContDestroy (contp);
-	        return 0;
-	   } else {
-	        /* Handle the incoming event */
-	   }
-	}
+    int
+    vconnection_handler (TSCont contp, TSEvent event, void *edata)
+    {
+    if (TSVConnClosedGet (contp)) {
+            /* Destroy any vconnection specific data here. */
+            TSContDestroy (contp);
+            return 0;
+       } else {
+            /* Handle the incoming event */
+       }
+    }
 
 This code fragment basically shows that many vconnections simply want to destroy 
 themselves when they are closed. However, the situation might also require 
@@ -131,12 +131,12 @@ the value of ndone for the input VIO, as
 `null-transform.c`:
 
                 :::c
-		TSIOBufferCopy (TSVIOBufferGet (data->output_vio),
-		TSVIOReaderGet (input_vio), towrite, 0);
-		/* Tell the read buffer that we have read the data and are no longer interested in it. */
-		TSIOBufferReaderConsume (TSVIOReaderGet (input_vio), towrite);
-		/* Modify the input VIO to reflect how much has been read.*/
-		TSVIONDoneSet (input_vio, TSVIONDoneGet (input_vio) + towrite);
+        TSIOBufferCopy (TSVIOBufferGet (data->output_vio),
+        TSVIOReaderGet (input_vio), towrite, 0);
+        /* Tell the read buffer that we have read the data and are no longer interested in it. */
+        TSIOBufferReaderConsume (TSVIOReaderGet (input_vio), towrite);
+        /* Modify the input VIO to reflect how much has been read.*/
+        TSVIONDoneSet (input_vio, TSVIONDoneGet (input_vio) + towrite);
 
 * Before sending `TS_EVENT_VCONN_WRITE_COMPLETE`, your transformation should 
 check the number of bytes remaining in the upstream vconnection's write VIO 

Modified: trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/vios.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/vios.en.mdtext?rev=1164283&r1=1164282&r2=1164283&view=diff
==============================================================================
--- trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/vios.en.mdtext (original)
+++ trafficserver/site/branches/ats-cms/content/docs/trunk/sdk/io-guide/vios.en.mdtext Thu Sep  1 21:34:29 2011
@@ -29,14 +29,14 @@ on the IO operation is made.
 The `TSVIO` data structure itself is opaque, but it could be defined as follows: 
 
         ::::c
-	typedef struct {
-	    TSCont continuation;
-	    TSVConn vconnection;
-	    TSIOBufferReader reader;
-	    TSMutex mutex;
-	    int nbytes;
-	    int ndone;
-	} *TSVIO;
+    typedef struct {
+        TSCont continuation;
+        TSVConn vconnection;
+        TSIOBufferReader reader;
+        TSMutex mutex;
+        int nbytes;
+        int ndone;
+    } *TSVIO;
 
 The VIO functions below access and modify various parts of the data structure. 
 



Mime
View raw message