You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2012/06/15 18:13:56 UTC
svn commit: r1350672 -
/trafficserver/site/trunk/content/docs/trunk/sdk/sample-source-code/index.en.mdtext
Author: jpeach
Date: Fri Jun 15 16:13:56 2012
New Revision: 1350672
URL: http://svn.apache.org/viewvc?rev=1350672&view=rev
Log:
Fix sample code to not use tabs
Modified:
trafficserver/site/trunk/content/docs/trunk/sdk/sample-source-code/index.en.mdtext
Modified: trafficserver/site/trunk/content/docs/trunk/sdk/sample-source-code/index.en.mdtext
URL: http://svn.apache.org/viewvc/trafficserver/site/trunk/content/docs/trunk/sdk/sample-source-code/index.en.mdtext?rev=1350672&r1=1350671&r2=1350672&view=diff
==============================================================================
--- trafficserver/site/trunk/content/docs/trunk/sdk/sample-source-code/index.en.mdtext (original)
+++ trafficserver/site/trunk/content/docs/trunk/sdk/sample-source-code/index.en.mdtext Fri Jun 15 16:13:56 2012
@@ -98,16 +98,16 @@ This plugin illustrates:
for (i = 0; i < nsites; i++) {
if (strncmp (host, sites[i], host_length) == 0) {
- if (log) {
- TSTextLogObjectWrite(log, "blacklisting site: %s", sites[i]);
- } else {
- printf ("blacklisting site: %s\n", sites[i]);
- }
+ if (log) {
+ TSTextLogObjectWrite(log, "blacklisting site: %s", sites[i]);
+ } else {
+ 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);
+ TSMutexUnlock(sites_mutex);
return;
}
}
@@ -180,30 +180,30 @@ This plugin illustrates:
nsites = 0;
if (file != NULL) {
- char buffer[1024];
+ char buffer[1024];
- while (TSfgets (file, buffer, sizeof(buffer)-1) != NULL && nsites < MAX_NSITES) {
- char* eol;
- if ((eol = strstr(buffer, "\r\n")) != NULL) {
- /* To handle newlines on Windows */
- *eol = '\0';
- } else if ((eol = strchr(buffer, '\n')) != NULL) {
- *eol = '\0';
- } else {
- /* Not a valid line, skip it */
- continue;
- }
- if (sites[nsites] != NULL) {
- TSfree (sites[nsites]);
- }
- sites[nsites] = TSstrdup (buffer);
- nsites++;
- }
-
- TSfclose (file);
- } else {
- TSError ("unable to open %s\n", blacklist_file);
- TSError ("all sites will be allowed\n", blacklist_file);
+ while (TSfgets (file, buffer, sizeof(buffer)-1) != NULL && nsites < MAX_NSITES) {
+ char* eol;
+ if ((eol = strstr(buffer, "\r\n")) != NULL) {
+ /* To handle newlines on Windows */
+ *eol = '\0';
+ } else if ((eol = strchr(buffer, '\n')) != NULL) {
+ *eol = '\0';
+ } else {
+ /* Not a valid line, skip it */
+ continue;
+ }
+ if (sites[nsites] != NULL) {
+ TSfree (sites[nsites]);
+ }
+ sites[nsites] = TSstrdup (buffer);
+ nsites++;
+ }
+
+ TSfclose (file);
+ } else {
+ TSError ("unable to open %s\n", blacklist_file);
+ TSError ("all sites will be allowed\n", blacklist_file);
}
TSMutexUnlock (sites_mutex);
@@ -222,8 +222,8 @@ This plugin illustrates:
handle_response (txnp);
return 0;
case TS_EVENT_MGMT_UPDATE:
- read_blacklist ();
- return 0;
+ read_blacklist ();
+ return 0;
default:
break;
}
@@ -243,12 +243,12 @@ This plugin illustrates:
int patch_ts_version = 0;
if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version) != 3) {
- return 0;
+ return 0;
}
/* Need at least TS 2.0 */
if (major_ts_version >= 2) {
- result = 1;
+ result = 1;
}
}
@@ -273,22 +273,22 @@ This plugin illustrates:
}
if (!check_ts_version()) {
- TSError ("Plugin requires Traffic Server 2.0 or later\n");
- return;
+ TSError ("Plugin requires Traffic Server 2.0 or later\n");
+ return;
}
/* create an TSTextLogObject to log blacklisted requests to */
log = TSTextLogObjectCreate("blacklist", TS_LOG_MODE_ADD_TIMESTAMP,
NULL, &error);
if (!log) {
- printf("Blacklist plugin: error %d while creating log\n", error);
+ printf("Blacklist plugin: error %d while creating log\n", error);
}
sites_mutex = TSMutexCreate ();
nsites = 0;
for (i = 0; i < MAX_NSITES; i++) {
- sites[i] = NULL;
+ sites[i] = NULL;
}
read_blacklist ();