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 2013/06/02 07:02:01 UTC
[04/26] Separate the Admin and SDK guides.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-headers/mime-headers.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-headers/mime-headers.en.rst b/doc/source/sdk/http-headers/mime-headers.en.rst
deleted file mode 100644
index ec9b0e8..0000000
--- a/doc/source/sdk/http-headers/mime-headers.en.rst
+++ /dev/null
@@ -1,437 +0,0 @@
-MIME Headers
-************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-The Traffic Server \*\*MIME header functions \*\* enable you to retrieve
-and modify information about HTTP MIME fields.
-
-An HTTP request or response consists of a header, body, and trailer. The
-**HTTP** **header** contains a request (or response) line and a MIME
-header. A **MIME** **header** is composed of zero or more MIME fields. A
-**MIME** **field** is composed of a field name, a colon, and zero or
-more field values (values in a field are separated by commas).
-
-In the example below: ``Foo`` is the MIME field name, ``bar`` is the
-first MIME field value, and ``car`` is the second MIME field value.
-
-::
-
- :::text
- Foo: bar, car
-
-The following example is an augmented **Backus-Naur Form** (BNF) for the
-form of a MIME header - it specifies exactly what was described above. A
-**header** consists of zero or more **fields** that contain a name,
-separating colon, and zero or more values. A **name** or **value** is
-simply a string of tokens that is potentially zero length; a **token**
-is any character except certain control characters and separators (such
-as colons). For the purpose of retrieving a field, field names are not
-case-sensitive; therefore, the field names ``Foo``, ``foo`` and ``fOO``
-are all equivalent.
-
-::
-
- :::text
- 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 (see `URLs <urls>`__). The actual data is stored in a
-marshal buffer; the MIME header functions operate on a marshal buffer
-and a location (``TSMLoc``) within the buffer.
-
-After a call to ``TSMimeHdrFieldDestroy``, ``TSMimeHdrFieldRemove``, or
-``TSUrlDestroy`` is made, you must deallocate the ``TSMLoc`` handle with
-a call to ``TSHandleMLocRelease``. You do not need to deallocate a
-``NULL`` handles. For example: if you call
-``TSMimeHdrFieldValueStringGet`` to get the value of the content type
-field and the field does not exist, then it returns ``TS_NULL_MLOC``. In
-such a case, you wouldn't need to deallocate the handle with a call to
-``TSHandleMLocRelease``.
-
-The location (``TSMLoc``) in the `MIME header
-functions <#MimeHeaderFxns>`__ can be either an HTTP header location or
-a MIME header location. If an HTTP header location is passed to these
-functions, then the system locates the MIME header associated with that
-HTTP header and executes the corresponding MIME header operations
-specified by the functions (see the example in the description of
-```TSMimeHdrCopy`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a6e0a392b2e072db8e7f1d795151203b4>`__).
-
-**Note:** MIME headers may contain more than one MIME field with the
-same name. Previous versions of Traffic Server joined multiple fields
-with the same name into one field with composite values, but this
-behavior came at a performance cost and caused compatability issues with
-older clients and servers. Hence, the current version of Traffic Server
-does not coalesce duplicate fields. Correctly-behaving plugins should
-check for the presence of duplicate fields and iterate over the
-duplicate fields by using ``TSMimeHdrFieldNextDup``.
-
-To facilitate fast comparisons and reduce storage size, Traffic Server
-defines several pre-allocated field names. These field names correspond
-to the field names in HTTP and NNTP headers.
-
-``TS_MIME_FIELD_ACCEPT``
- "Accept"
- ``TS_MIME_LEN_ACCEPT``
-
-``TS_MIME_FIELD_ACCEPT_CHARSET``
- "Accept-Charset"
- ``TS_MIME_LEN_ACCEPT_CHARSET``
-
-``TS_MIME_FIELD_ACCEPT_ENCODING``
- "Accept-Encoding"
- ``TS_MIME_LEN_ACCEPT_ENCODING``
-
-``TS_MIME_FIELD_ACCEPT_LANGUAGE``
- "Accept-Language"
- ``TS_MIME_LEN_ACCEPT_LANGUAGE``
-
-``TS_MIME_FIELD_ACCEPT_RANGES``
- "Accept-Ranges"
- ``TS_MIME_LEN_ACCEPT_RANGES``
-
-``TS_MIME_FIELD_AGE``
- "Age"
- ``TS_MIME_LEN_AGE``
-
-``TS_MIME_FIELD_ALLOW``
- "Allow"
- ``TS_MIME_LEN_ALLOW``
-
-``TS_MIME_FIELD_APPROVED``
- "Approved"
- ``TS_MIME_LEN_APPROVED``
-
-``TS_MIME_FIELD_AUTHORIZATION``
- "Authorization"
- ``TS_MIME_LEN_AUTHORIZATION``
-
-``TS_MIME_FIELD_BYTES``
- "Bytes"
- ``TS_MIME_LEN_BYTES``
-
-``TS_MIME_FIELD_CACHE_CONTROL``
- "Cache-Control"
- ``TS_MIME_LEN_CACHE_CONTROL``
-
-``TS_MIME_FIELD_CLIENT_IP``
- "Client-ip"
- ``TS_MIME_LEN_CLIENT_IP``
-
-``TS_MIME_FIELD_CONNECTION``
- "Connection"
- ``TS_MIME_LEN_CONNECTION``
-
-``TS_MIME_FIELD_CONTENT_BASE``
- "Content-Base"
- ``TS_MIME_LEN_CONTENT_BASE``
-
-``TS_MIME_FIELD_CONTENT_ENCODING``
- "Content-Encoding"
- ``TS_MIME_LEN_CONTENT_ENCODING``
-
-``TS_MIME_FIELD_CONTENT_LANGUAGE``
- "Content-Language"
- ``TS_MIME_LEN_CONTENT_LANGUAGE``
-
-``TS_MIME_FIELD_CONTENT_LENGTH``
- "Content-Length"
- ``TS_MIME_LEN_CONTENT_LENGTH``
-
-``TS_MIME_FIELD_CONTENT_LOCATION``
- "Content-Location"
- ``TS_MIME_LEN_CONTENT_LOCATION``
-
-``TS_MIME_FIELD_CONTENT_MD5``
- "Content-MD5"
- ``TS_MIME_LEN_CONTENT_MD5``
-
-``TS_MIME_FIELD_CONTENT_RANGE``
- "Content-Range"
- ``TS_MIME_LEN_CONTENT_RANGE``
-
-``TS_MIME_FIELD_CONTENT_TYPE``
- "Content-Type"
- ``TS_MIME_LEN_CONTENT_TYPE``
-
-``TS_MIME_FIELD_CONTROL``
- "Control"
- ``TS_MIME_LEN_CONTROL``
-
-``TS_MIME_FIELD_COOKIE``
- "Cookie"
- ``TS_MIME_LEN_COOKIE``
-
-``TS_MIME_FIELD_DATE``
- "Date"
- ``TS_MIME_LEN_DATE``
-
-``TS_MIME_FIELD_DISTRIBUTION``
- "Distribution"
- ``TS_MIME_LEN_DISTRIBUTION``
-
-``TS_MIME_FIELD_ETAG``
- "Etag"
- ``TS_MIME_LEN_ETAG``
-
-``TS_MIME_FIELD_EXPECT``
- "Expect"
- ``TS_MIME_LEN_EXPECT``
-
-``TS_MIME_FIELD_EXPIRES``
- "Expires"
- ``TS_MIME_LEN_EXPIRES``
-
-``TS_MIME_FIELD_FOLLOWUP_TO``
- "Followup-To"
- ``TS_MIME_LEN_FOLLOWUP_TO``
-
-``TS_MIME_FIELD_FROM``
- "From"
- ``TS_MIME_LEN_FROM``
-
-``TS_MIME_FIELD_HOST``
- "Host"
- ``TS_MIME_LEN_HOST``
-
-``TS_MIME_FIELD_IF_MATCH``
- "If-Match"
- ``TS_MIME_LEN_IF_MATCH``
-
-``TS_MIME_FIELD_IF_MODIFIED_SINCE``
- "If-Modified-Since"
- ``TS_MIME_LEN_IF_MODIFIED_SINCE``
-
-``TS_MIME_FIELD_IF_NONE_MATCH``
- "If-None-Match"
- ``TS_MIME_LEN_IF_NONE_MATCH``
-
-``TS_MIME_FIELD_IF_RANGE``
- "If-Range"
- ``TS_MIME_LEN_IF_RANGE``
-
-``TS_MIME_FIELD_IF_UNMODIFIED_SINCE``
- "If-Unmodified-Since"
- ``TS_MIME_LEN_IF_UNMODIFIED_SINCE``
-
-``TS_MIME_FIELD_KEEP_ALIVE``
- "Keep-Alive"
- ``TS_MIME_LEN_KEEP_ALIVE``
-
-``TS_MIME_FIELD_KEYWORDS``
- "Keywords"
- ``TS_MIME_LEN_KEYWORDS``
-
-``TS_MIME_FIELD_LAST_MODIFIED``
- "Last-Modified"
- ``TS_MIME_LEN_LAST_MODIFIED``
-
-``TS_MIME_FIELD_LINES``
- "Lines"
- ``TS_MIME_LEN_LINES``
-
-``TS_MIME_FIELD_LOCATION``
- "Location"
- ``TS_MIME_LEN_LOCATION``
-
-``TS_MIME_FIELD_MAX_FORWARDS``
- "Max-Forwards"
- ``TS_MIME_LEN_MAX_FORWARDS``
-
-``TS_MIME_FIELD_MESSAGE_ID``
- "Message-ID"
- ``TS_MIME_LEN_MESSAGE_ID``
-
-``TS_MIME_FIELD_NEWSGROUPS``
- "Newsgroups"
- ``TS_MIME_LEN_NEWSGROUPS``
-
-``TS_MIME_FIELD_ORGANIZATION``
- "Organization"
- ``TS_MIME_LEN_ORGANIZATION``
-
-``TS_MIME_FIELD_PATH``
- "Path"
- ``TS_MIME_LEN_PATH``
-
-``TS_MIME_FIELD_PRAGMA``
- "Pragma"
- ``TS_MIME_LEN_PRAGMA``
-
-``TS_MIME_FIELD_PROXY_AUTHENTICATE``
- "Proxy-Authenticate"
- ``TS_MIME_LEN_PROXY_AUTHENTICATE``
-
-``TS_MIME_FIELD_PROXY_AUTHORIZATION``
- "Proxy-Authorization"
- ``TS_MIME_LEN_PROXY_AUTHORIZATION``
-
-``TS_MIME_FIELD_PROXY_CONNECTION``
- "Proxy-Connection"
- ``TS_MIME_LEN_PROXY_CONNECTION``
-
-``TS_MIME_FIELD_PUBLIC``
- "Public"
- ``TS_MIME_LEN_PUBLIC``
-
-``TS_MIME_FIELD_RANGE``
- "Range"
- ``TS_MIME_LEN_RANGE``
-
-``TS_MIME_FIELD_REFERENCES``
- "References"
- ``TS_MIME_LEN_REFERENCES``
-
-``TS_MIME_FIELD_REFERER``
- "Referer"
- ``TS_MIME_LEN_REFERER``
-
-``TS_MIME_FIELD_REPLY_TO``
- "Reply-To"
- ``TS_MIME_LEN_REPLY_TO``
-
-``TS_MIME_FIELD_RETRY_AFTER``
- "Retry-After"
- ``TS_MIME_LEN_RETRY_AFTER``
-
-``TS_MIME_FIELD_SENDER``
- "Sender"
- ``TS_MIME_LEN_SENDER``
-
-``TS_MIME_FIELD_SERVER``
- "Server"
- ``TS_MIME_LEN_SERVER``
-
-``TS_MIME_FIELD_SET_COOKIE``
- "Set-Cookie"
- ``TS_MIME_LEN_SET_COOKIE``
-
-``TS_MIME_FIELD_SUBJECT``
- "Subject"
- ``TS_MIME_LEN_SUBJECTTS_MIME_LEN_SUBJECT``
-
-``TS_MIME_FIELD_SUMMARY``
- "Summary"
- ``TS_MIME_LEN_SUMMARY``
-
-``TS_MIME_FIELD_TE``
- "TE"
- ``TS_MIME_LEN_TE``
-
-``TS_MIME_FIELD_TRANSFER_ENCODING``
- "Transfer-Encoding"
- ``TS_MIME_LEN_TRANSFER_ENCODING``
-
-``TS_MIME_FIELD_UPGRADE``
- "Upgrade"
- ``TS_MIME_LEN_UPGRADE``
-
-``TS_MIME_FIELD_USER_AGENT``
- "User-Agent"
- ``TS_MIME_LEN_USER_AGENT``
-
-``TS_MIME_FIELD_VARY``
- "Vary"
- ``TS_MIME_LEN_VARY``
-
-``TS_MIME_FIELD_VIA``
- "Via"
- ``TS_MIME_LEN_VIA``
-
-``TS_MIME_FIELD_WARNING``
- "Warning"
- ``TS_MIME_LEN_WARNING``
-
-``TS_MIME_FIELD_WWW_AUTHENTICATE``
- "Www-Authenticate"
- ``TS_MIME_LEN_WWW_AUTHENTICATE``
-
-``TS_MIME_FIELD_XREF``
- "Xref"
- ``TS_MIME_LEN_XREF``
-
-The header field names above are defined in ``ts.h`` as ``const char*``
-strings. When Traffic Server sets the name portion of a header field (or
-any portion for that matter), it quickly checks to see if the new value
-is one of the known values. If it is, then Traffic Server stores a
-pointer into a global table instead of storing the known value in the
-marshal buffer. The header field names listed above are also pointers
-into this table, which enables simple pointer comparison of the value
-returned from ``TSMimeHdrFieldNameGet`` with one of the values listed
-above. It is recommended that you use the above values when referring to
-one of the known header field names to avoid the possibility of a
-spelling error.
-
-Traffic Server adds one important feature to MIME fields that you may
-not know about: Traffic Server does not print a MIME field if the field
-name begins with the '``@``\ ' symbol. For example: a plugin can add the
-field "``@My-Field``\ " to a header. Even though Traffic Server never
-sends that field out in a request to an origin server or in a response
-to a client, it can be printed to Traffic Server logs by defining a
-custom log configuration file that explicitly logs such fields. This
-provides a useful mechanism for plugins to store information about an
-object in one of the MIME headers associated with the object.
-
-The MIME header functions are listed below:
-
-- ```TSMimeHdrFieldAppend`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ae36c9bab9147a30b259d8e0223d697f2>`__
-- ```TSMimeHdrFieldClone`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ade66cd69ddff40d14b015a9e2cd7b46f>`__
-- ```TSMimeHdrFieldCopy`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a612ebefde403abc216af99f9150dd66f>`__
-- ```TSMimeHdrFieldCopyValues`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a5e4b2f68392a26643620641e50e5045b>`__
-- ```TSMimeHdrFieldCreate`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a7f79c0bea2ce14ced3b017eac08f8916>`__
-- ```TSMimeHdrFieldDestroy`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a6bf2d8e95e6f3ef351f63dbe8bc54020>`__
-- ```TSMimeHdrFieldLengthGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a8a906f22ccf7a4a04fac817dc57a785f>`__
-- ```TSMimeHdrFieldNameGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ad68f51073e4630ad6a0433efbfeef2ea>`__
-- ```TSMimeHdrFieldNameSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a6856f6069fa4ee67d1a788bd642d59f0>`__
-- ```TSMimeHdrFieldNext`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#aaf3a205e8a4e7128f3fa3de70991df80>`__
-- ```TSMimeHdrFieldNextDup`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#af2d776615afe959ed7c3639830a7061f>`__
-- ```TSMimeHdrFieldValueAppend`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad1d4d1dda95311e3389245fd9fa961b5>`__
-- ```TSMimeHdrFieldValueAppend`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad1d4d1dda95311e3389245fd9fa961b5>`__
-- ```TSMimeHdrFieldValueDateGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad74a60f0da93397ee015d82f30021d15>`__
-- ```TSMimeHdrFieldValueDateInsert`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a0520a29de96736b04f14e9d790ec8e9c>`__
-- ```TSMimeHdrFieldValueDateSet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#abf85e014cb316977dedca38c341d4369>`__
-- ```TSMimeHdrFieldValueIntGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ace1fac92d2be75ff7cbd8eb7725d3fac>`__
-- ```TSMimeHdrFieldValueIntSet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aec96c5629a750cdaec709228c4bd8a76>`__
-- ```TSMimeHdrFieldValueStringGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a4aa55cd4eeb9e6d0a5151c02f0c18c28>`__
-- ```TSMimeHdrFieldValueStringInsert`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a979d1591becf1c59de830af117d54923>`__
-- ```TSMimeHdrFieldValueStringSet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ac21e44e84b25c23e52ba7bea7bd09ed6>`__
-- ```TSMimeHdrFieldValueUintGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a116b4c9144ad6eda66213adb0167706a>`__
-- ```TSMimeHdrFieldValueUintInsert`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a88db3a90d3ac7766e55c734c89dfe86f>`__
-- ```TSMimeHdrFieldValueUintSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a63b0a686b4a6ec6b8a4f1b796009c3cd>`__
-- ```TSMimeHdrFieldValuesClear`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a8fd3afaf88f6c76793fdb635bbd22113>`__
-- ```TSMimeHdrFieldValuesCount`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a326283521986acf9b8a9ec00f3d6d164>`__
-- ```TSMimeHdrClone`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aa8ab95bda93c3e16e6d134fe35acd1b6>`__
-- ```TSMimeHdrCopy`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a6e0a392b2e072db8e7f1d795151203b4>`__
-- ```TSMimeHdrCreate`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a3427dfbd6b79c531fcba4e8c8b4e217d>`__
-- ```TSMimeHdrDestroy`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a60ad7f4f4f9e2559dcc2ff28ebe8d96c>`__
-- ```TSMimeHdrFieldFind`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a30e4ce224761b273a119dcd57f5a352b>`__
-- ```TSMimeHdrFieldGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a31c0c307010a5d19d027ffb3a2656745>`__
-- ```TSMimeHdrFieldRemove`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a96d9a50d0687456e6e67eb2e9a9c2d72>`__
-- ```TSMimeHdrFieldsClear`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a65d7539e48c9f5c26075344dee6c6ae2>`__
-- ```TSMimeHdrFieldsCount`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ab02f7d0cba75cf0146c6a9b507c79fcf>`__
-- ```TSMimeHdrLengthGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a001cd786282f5c9d04189ddf7c96e269>`__
-- ```TSMimeHdrParse`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a4a6042bcd5b5b0a21267c03cf102e90d>`__
-- ```TSMimeParserClear`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ac173b595659d1909aae5410ecd1ce028>`__
-- ```TSMimeParserCreate`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a518072dc5a90b753df7726878119506b>`__
-- ```TSMimeParserDestroy`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a5f287f5016d931842c0a5012c3d227b7>`__
-- ```TSMimeHdrPrint`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#adfca8722edc6469df4410b8050406bb0>`__
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-headers/urls.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-headers/urls.en.rst b/doc/source/sdk/http-headers/urls.en.rst
deleted file mode 100644
index 5f32b82..0000000
--- a/doc/source/sdk/http-headers/urls.en.rst
+++ /dev/null
@@ -1,134 +0,0 @@
-URLs
-****
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-API URL functions provide access to URL data stored in marshal buffers.
-The URL functions can create, copy, retrieve or delete entire URLs; they
-can also retrieve or modify parts of URLs, such as port or scheme
-information.
-
-The general form of an Internet URL is:
-
-::
-
- :::text
- scheme://user:password@host:port/stuff
-
-The URL data structure includes support for two specific types of
-internet URLs. HTTP URLs have the form:
-
-::
-
- :::text
- http://user:password@host:port/path;params?query#fragment
-
-The URL port is stored as integer. All remaining parts of the URL
-(scheme, user, etc.) are stored as strings. Traffic Server URL functions
-are named according to the portion of the URL on which they operate. For
-instance, the function that retrieves the host portion of a URL is named
-``TSUrlHostGet``.
-
-To facilitate fast comparisons and reduce storage size, Traffic Server
-defines several preallocated scheme names.
-
-``TS_URL_SCHEME_FILE``
- "file"
- ``TS_URL_LEN_FILE``
-
-``TS_URL_SCHEME_FTP``
- "ftp"
- ``TS_URL_LEN_FTP``
-
-``TS_URL_SCHEME_GOPHER``
- "gopher"
- ``TS_URL_LEN_GOPHER``
-
-``TS_URL_SCHEME_HTTP``
- "http"
- ``TS_URL_LEN_HTTP``
-
-``TS_URL_SCHEME_HTTPS``
- "https"
- ``TS_URL_LEN_HTTPS``
-
-``TS_URL_SCHEME_MAILTO``
- "mailto"
- ``TS_URL_LEN_MAILTO``
-
-``TS_URL_SCHEME_NEWS``
- "news"
- ``TS_URL_LEN_NEWS``
-
-``TS_URL_SCHEME_NNTP``
- "nntp"
- ``TS_URL_LEN_NNTP``
-
-``TS_URL_SCHEME_PROSPERO``
- "prospero"
- ``TS_URL_LEN_PROSPERO``
-
-``TS_URL_SCHEME_TELNET``
- "telnet"
- ``TS_URL_LEN_TELNET``
-
-``TS_URL_SCHEME_WAIS``
- "wais"
- ``TS_URL_LEN_WAIS``
-
-The scheme names above are defined in ``ts.h`` as ``const`` ``char*``
-strings. When Traffic Server sets the scheme portion of the URL (or any
-portion for that matter), it quickly checks to see if the new value is
-one of the known values. If it is, then it stores a pointer into a
-global table (instead of storing the known value in the marshal buffer).
-The scheme values listed above are also pointers into this table. This
-allows simple pointer comparison of the value returned from
-``TSUrlSchemeGet`` with one of the values listed above. You should use
-the Traffic Server-defined values when referring to one of the known
-schemes, since doing so can prevent the possibility of spelling errors.
-
-Traffic Server **URL functions** are listed below:
-
-```TSUrlClone`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#acb775f48f1da5f6c5bf32c833a236574>`__
-```TSUrlCopy`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aa2b8d5f9289a23ab985210914a6301a7>`__
-```TSUrlCreate`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ad3518ea3bca6a6f2d899b859c6fbbede>`__
-```TSUrlDestroy`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a87559aac42f4f9439399ba2bd32693fa>`__
-```TSUrlPrint`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#adec26f5a4afe62b4308dd86f97ae08fd>`__
-```TSUrlFtpTypeGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a5cd15d2c288a48b832f0fc096ed6fb80>`__
-```TSUrlFtpTypeSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a66df700e23085cabf945e92eb1e22890>`__
-```TSUrlHostGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a48e626d9497d4d81c0b9d2781f86066b>`__
-```TSUrlHostSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a7e550dac573f5780f7ba39509aa881f3>`__
-```TSUrlHttpFragmentGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a316696ad964cb6c6afb7e3028da3ef84>`__
-```TSUrlHttpFragmentSet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a45f7b216882c4517b92929145adf5424>`__
-```TSUrlHttpParamsGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a9395d5d794078c8ec0f17f27dc8d8498>`__
-```TSUrlHttpParamsSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a566f2996d36663e3eb8ed4a8fda738c3>`__
-```TSUrlHttpQueryGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a74a6c51ea9f472cf29514facbf897785>`__
-```TSUrlHttpQuerySet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a9846aaf11accd8c817fff48bfaa784e0>`__
-```TSUrlLengthGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a96ded2567985b187c0a8274d76d12c17>`__
-```TSUrlParse`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a17f785697773b62b1f5094c06896cac5>`__
-```TSUrlPasswordGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a14614f77e0c15b206bab8fd6fdfa7bd1>`__
-```TSUrlPasswordSet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#abb4d983b9d47ba5a254c2b9dd9ad835e>`__
-```TSUrlPathGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#aa064a2d5256d839819d1ec8f252c01a9>`__
-```TSUrlPathSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad73274cb5b7e98a64d53f992681110b7>`__
-```TSUrlPortGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad99bfb408a46f47c4aa9478fc1b95e0c>`__
-```TSUrlPortSet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aab07c0482fc3c3aae1b545fb0104e3aa>`__
-```TSUrlSchemeGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a24c660b5b46f17b24d7a1cc9aa9a4930>`__
-```TSUrlSchemeSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a03b1a806ea8d79806dfff39bfe138934>`__
-```TSUrlStringGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a1cda3103d8dd59372609aed6c9c47417>`__
-```TSUrlUserGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a3c4d7ffcbbda447c3b665dc857a3226b>`__
-```TSUrlUserSet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a3175e9c89c2bbea5ed50e2a7f52d7f9f>`__
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions.en.rst b/doc/source/sdk/http-hooks-and-transactions.en.rst
deleted file mode 100644
index 037ec0a..0000000
--- a/doc/source/sdk/http-hooks-and-transactions.en.rst
+++ /dev/null
@@ -1,83 +0,0 @@
-HTTP Hooks and Transactions
-***************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-Hooks are points in Traffic Server transaction processing where plugins
-can step in and do some work. Registering a plugin function for callback
-amounts to "adding" the function to a hook. You can register your plugin
-to be called back for every single transaction or only for specific
-transactions.
-
-This chapter contains the following sections:
-
-.. toctree::
- :maxdepth: 2
-
- http-hooks-and-transactions/adding-hooks.en
- http-hooks-and-transactions/http-sessions.en
- http-hooks-and-transactions/http-transactions.en
- http-hooks-and-transactions/intercepting-http-transactions.en
- http-hooks-and-transactions/initiate-http-connection.en
- http-hooks-and-transactions/http-alternate-selection.en
-
-The Set of Hooks
-----------------
-
-To understand hooks and transactions, you should be familiar with the
-following terminology:
-
-***HTTP Transaction***
-
-A **transaction** consists of a single HTTP request from a client and
-the response Traffic Server sends to that client. Thus, a transaction
-begins when Traffic Server receives a request and ends when Traffic
-Server sends the response.
-
-Traffic Server uses **HTTP state machines** to process transactions. The
-state machines follow a complex set of states involved in sophisticated
-caching and document retrieval (taking into account, for example,
-alternate selection, freshness criteria, and hierarchical caching). The
-Traffic Server API provides hooks to a subset of these states, as
-illustrated in the `HTTP Transaction State
-Diagram <#HHTTPTxStateDiag>`__ below.
-
-***Transform hooks***
-
-The two **transform hooks**, ``TS_HTTP_REQUEST_TRANSFORM_HOOK`` and
-``TS_HTTP_RESPONSE_TRANSFORM_HOOK``, are called in the course of an HTTP
-transform. To see where in the HTTP transaction they are called, look
-for the "set up transform" ovals in the `HTTP Transaction State
-Diagram <#HHTTPTxStateDiag>`__ below.
-
-***HTTP session***
-
-A **session** consists of a single client connection to Traffic Server;
-it may consist of a single transaction or several transactions in
-succession. The session starts when the client connection opens and ends
-when the connection closes.
-
-**HTTP Transaction State Diagram (*not yet updated*)**
-{#HHTTPTxStateDiag}
-
-.. figure:: /images/sdk/http_state2.jpg
- :alt: HTTP Transaction State Diagram
-
- HTTP Transaction State Diagram
-
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions/adding-hooks.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions/adding-hooks.en.rst b/doc/source/sdk/http-hooks-and-transactions/adding-hooks.en.rst
deleted file mode 100644
index 3de9dc6..0000000
--- a/doc/source/sdk/http-hooks-and-transactions/adding-hooks.en.rst
+++ /dev/null
@@ -1,149 +0,0 @@
-Adding Hooks
-************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-There are several ways to add hooks to your plugin.
-
-- **Global HTTP hooks** HTTP transaction hooks are set on a global
- basis using the function ``TSHttpHookAdd``. This means that the
- continuation specified as the parameter to ``TSHttpHookAdd`` is
- called for every transaction. ``TSHttpHookAdd`` must be used in
- ``TSPluginInit``.
-
-- **Transaction hooks** Transaction hooks can be used to call plugins
- back for a specific HTTP transaction. You cannot add transaction
- hooks in ``TSPluginInit``; you first need a handle to a transaction.
- See `Accessing the Transaction Being
- Processed <../header-based-plugin-examples/blacklist-plugin/accessing-the-transaction-being-processed>`__
-
-- **Transformation hooks** Transformation hooks are a special case of
- transaction hooks. See
- ```TSVConnCacheObjectSizeGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#af5ca2c5b00e4859d2fa5dec466dfd058>`__
- for more information about transformation hooks. You add a
- transformation hook using ``TSHttpTxnHookAdd``, as described in `HTTP
- Transactions <HTTP_Transactions.html>`__.
-
-- **Session hooks** An HTTP session starts when a client opens a
- connection to Traffic Server and ends when the connection closes. A
- session can consist of several transactions. Session hooks enable you
- to hook your plugin to a particular point in every transaction within
- a specified session (see `HTTP Sessions <HTTPSessions.html>`__).
- Session hooks are added in a manner similar to transaction hooks (ie,
- you first need a handle to an HTTP session).
-
-- **HTTP select alternate hook** Alternate selection hooks enable you
- to hook on to the alternate selection state. These hooks must be
- added globally, since Traffic Server does not have a handle to a
- transaction or session when alternate selection is taking place. See
- `HTTP Alternate Selection <HTTPAlternateSelection.html>`__ for
- information on the alternate selection mechanism.
-
-All of the hook addition functions
-(```TSHttpHookAdd`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a19a663edd3ec439f66256fbbb26cc1db>`__,
-```TSHttpSsnHookAdd`` <HTTPSessionFunctions.html#TSHttpSsnHookAdd>`__,
-```TSHttpSsnReenable`` <HTTPSessionFunctions.html#TSHttpSsnReenable>`__)
-take ``TSHttpHookID`` (identifies the hook to add on to) and ``TSCont``
-(the basic callback mechanism in Traffic Server). A single ``TSCont``
-can be added to any number of hooks at a time.
-
-An HTTP hook is identified by the enumerated type ``TSHttpHookID``. The
-values for ``TSHttpHookID`` are:
-
-**Values for TSHttpHookID**
-
-``TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK``
- Called after the HTTP state machine has completed the cache lookup
- for the document requested in the ongoing transaction. Register this
- hook via ``TSHttpTxnHookAdd`` or ``TSHttpHookAdd``. Corresponds to
- the event ``TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE``.
-
-``TS_HTTP_OS_DNS_HOOK``
- Called immediately after the HTTP state machine has completed a DNS
- lookup of the origin server. The HTTP state machine will know the
- origin server's IP address at this point, which is useful for
- performing both authentication and blacklisting. Corresponds to the
- event ``TS_EVENT_HTTP_OS_DNS``.
-
-``TS_HTTP_READ_CACHE_HDR_HOOK``
- Called immediately after the request and response header of a
- previously-cached object is read from cache. This hook is only
- called if the document is being served from cache. Corresponds to
- the event ``TS_EVENT_HTTP_READ_CACHE_HDR``.
-
-``TS_HTTP_READ_RESPONSE_HDR_HOOK``
- Called immediately after the response header is read from the origin
- server or parent proxy. Corresponds to the event
- ``TS_EVENT_HTTP_READ_RESPONSE_HDR``.
-
-``TS_HTTP_RESPONSE_TRANSFORM_HOOK``
- See
- "`"Transformations" <../http-transformation-plugin#Transformations>`__
- for information about transformation hooks.
-
-``TS_HTTP_READ_REQUEST_HDR_HOOK``
- Called immediately after the request header is read from the client.
- Corresponds to the event ``TS_EVENT_HTTP_READ_REQUEST_HDR``.
-
-``TS_HTTP_READ_REQUEST_PRE_REMAP_HOOK``
- Called after the request header is read from the client, before any
- remapping of the headers occurs. Corresponds to the event
- ``TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP``.
-
-``TS_HTTP_REQUEST_TRANSFORM_HOOK``
- See
- "`"Transformations" <../http-transformation-plugin#Transformations>`__
- for information about transformation hooks.
-
-``TS_HTTP_SELECT_ALT_HOOK``
- See `"HTTP Alternate Selection" <http-alternate-selection>`__ for
- information about the alternate selection mechanism.
-
-``TS_HTTP_SEND_RESPONSE_HDR_HOOK``
- Called immediately before the proxy's response header is written to
- the client; this hook is usually used for modifying the response
- header. Corresponds to the event
- ``TS_EVENT_HTTP_SEND_RESPONSE_HDR``.
-
-``TS_HTTP_SEND_REQUEST_HDR_HOOK``
- Called immediately before the proxy's request header is sent to the
- origin server or the parent proxy. This hook is not called if the
- document is being served from cache. This hook is usually used for
- modifying the proxy's request header before it is sent to the origin
- server or parent proxy.
-
-``TS_HTTP_SSN_CLOSE_HOOK``
- Called when an HTTP session ends. A session ends when the client
- connection is closed. You can only add this hook as a global hook
-
-``TS_HTTP_SSN_START_HOOK``
- Called when an HTTP session is started. A session starts when a
- client connects to Traffic Server. You can only add this hook as a
- global hook.
-
-``TS_HTTP_TXN_CLOSE_HOOK``
- Called when an HTTP transaction ends.
-
-``TS_HTTP_TXN_START_HOOK``
- Called when an HTTP transaction is started. A transaction starts
- when either a client connects to Traffic Server and data is
- available on the connection, or a previous client connection that
- was left open for keep alive has new data available.
-
-The function you use to add a global HTTP hook is
-```TSHttpHookAdd`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a19a663edd3ec439f66256fbbb26cc1db>`__.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions/http-alternate-selection.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions/http-alternate-selection.en.rst b/doc/source/sdk/http-hooks-and-transactions/http-alternate-selection.en.rst
deleted file mode 100644
index 70f0214..0000000
--- a/doc/source/sdk/http-hooks-and-transactions/http-alternate-selection.en.rst
+++ /dev/null
@@ -1,192 +0,0 @@
-HTTP Alternate Selection
-************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-The HTTP alternate selection functions provide a mechanism for hooking
-into Traffic Server's alternate selection mechanism and augmenting it
-with additional information. **HTTP alternate selection** refers to the
-process of choosing between several alternate versions of a document for
-a specific URL. Alternates arise because the HTTP 1.1 specification
-allows different documents to be sent back for the same URL (depending
-on the clients request). For example, a server might send back a GIF
-image to a client that only accepts GIF images, and might send back a
-JPEG image to a client that only accepts JPEG images.
-
-The alternate selection mechanism is invoked when Traffic Server looks
-up a URL in its cache. For each URL, Traffic Server stores a vector of
-alternates. For each alternate in this vector, Traffic Server computes a
-quality value between 0 and 1 that represents how "good" the alternate
-is. A quality value of 0 means that the alternate is unacceptable; a
-value of 1 means that the alternate is a perfect match.
-
-If a plugin hooks onto the ``TS_HTTP_SELECT_ALT_HOOK``, then it will be
-called back when Traffic Server performs alternate selection. You cannot
-register locally to the hook ``TS_HTTP_SELECT_ALT_HOOK`` by using
-``TSHttpTxnHookAdd`` - you can only do so by using only
-``TSHttpHookAdd``. Since Traffic Server does not actually have an HTTP
-transaction or an HTTP session on hand when alternate selection is
-performed, it is only valid to hook onto the global list of
-``TS_HTTP_SELECT_ALT_HOOK``. Traffic Server calls each of the select
-alternate hooks with the ``TS_EVENT_HTTP_SELECT_ALT`` event. The
-``void *edata`` argument that is passed to the continuation is a pointer
-to an ``TSHttpAltInfo`` structure. It can be used later to call the HTTP
-alternate selection functions listed at the end of this section. Unlike
-other hooks, this alternate selection callout is non-blocking; the
-expectation is that the quality value for the alternate will be changed
-by a call to ``TSHttpAltInfoQualitySet``.
-
-|[Note]| **Note**
-
-HTTP SM does not have to be reenabled using ``TSHttpTxnReenable`` or any
-other 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));
- }
-
-Traffic Server augments the alternate selection through these callouts
-using the following algorithm:
-
-1. Traffic Server computes its own quality value for the alternate,
- taking into account the quality of the accept match, the encoding
- match, and the language match.
-
-2. Traffic Server then calls out each of the continuations on the global
- ``TS_HTTP_SELECT_ALT_HOOK``'s list.
-
-3. It multiplies its quality value with the value returned by each
- callout. Since all of the values are clamped to be between 0 and 1,
- the final value will be between 0 and 1 as well.
-
-4. This algorithm also ensures that a single callout can block the usage
- of a given alternate by specifying a quality value of 0.
-
-A common usage for the alternate selection mechanism is when a plugin
-transforms a document for some clients and not for others, but wants to
-store both the transformed and unchanged document. The client's request
-will specify whether it accepted the transformed document. The plugin
-will then determine if the alternate matches this specification and then
-set the appropriate quality level for the alternate.
-
-The HTTP alternate selection functions are:
-
-- ```TSHttpAltInfoCachedReqGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#af4f3a56716e3e97afd582c7fdb14bcb7>`__
-
-- ```TSHttpAltInfoCachedRespGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aff5861ae4a4a7a6ce7b2d669c113b3bb>`__
-
-- ```TSHttpAltInfoClientReqGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a74d494c6442b6012d8385e92f0e14dee>`__
-
-- ```TSHttpAltInfoQualitySet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a978b7160a048491d5698e0f4c0c79aad>`__
-
-.. |[Note]| image:: /images/docbook/note.png
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions/http-sessions.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions/http-sessions.en.rst b/doc/source/sdk/http-hooks-and-transactions/http-sessions.en.rst
deleted file mode 100644
index 8d45478..0000000
--- a/doc/source/sdk/http-hooks-and-transactions/http-sessions.en.rst
+++ /dev/null
@@ -1,52 +0,0 @@
-HTTP Sessions
-*************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-An **HTTP session** is an object that is defined for the lifetime of a
-client's TCP session. The Traffic Server API enables you to add a global
-hook to the start or end of an HTTP session, as well as add session
-hooks that call back your plugin for every transaction within a given
-session. When a client connects to Traffic Server, it opens up a TCP
-connection and sends one or more HTTP requests. An individual request
-and its response comprise the HTTP transaction. The **HTTP session**
-begins when the client opens the connection and ends when 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 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 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). If you want your plugin to be called back for each transaction
-within the session, then use ``TSHttpSsnHookAdd``.
-
-**Note:** you must reenable the session with ``TSHttpSsnReenable`` after
-processing a session hook.
-
-The session hook functions are listed below:
-
-- ```TSHttpSsnHookAdd`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a268d493d94fa5461c8200883a9b8d20b>`__
-- ```TSHttpSsnReenable`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a3bbe42bf4757625bdb8bb65e7ac6f52d>`__
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions/http-transactions.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions/http-transactions.en.rst b/doc/source/sdk/http-hooks-and-transactions/http-transactions.en.rst
deleted file mode 100644
index 35550fd..0000000
--- a/doc/source/sdk/http-hooks-and-transactions/http-transactions.en.rst
+++ /dev/null
@@ -1,205 +0,0 @@
-HTTP Transactions
-*****************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-The HTTP transaction functions enable you to set up plugin callbacks to
-HTTP transactions and obtain/modify information about particular HTTP
-transactions.
-
-As described in the section on HTTP sessions, an **HTTP transaction** is
-an object defined for the lifetime of a single request from a client and
-the corresponding response from Traffic Server. The **``TSHttpTxn``**
-structure is the main handle given to a plugin for manipulating a
-transaction's internal state. Additionally, an HTTP transaction has a
-reference back to the HTTP session that created it.
-
-The sample code below illustrates how to register locally to a
-transaction 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);
- }
-
-See `Adding Hooks <adding-hooks>`__ for background about HTTP
-transactions and HTTP hooks, as well as `HTTP Hooks and
-Transactions <../http-hooks-and-transactions>`__ Also see the [HTTP
-Transaction State Diagram
-](HTTPHooksAndTransactions.html(../http-hooks-and-transactions#HHTTPTxStateDiag)
-for an illustration of the steps involved in a typical HTTP transaction.
-
-The HTTP transaction functions are:
-
-- ```TSHttpTxnCacheLookupStatusGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad26c77fa4ba251fb8ccbbd1505a74687>`__
-
-- ```TSHttpTxnCachedReqGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a889b626142157077f4f3cfe479e8b8e2>`__
- - Note that it is an error to modify cached headers.
-
-- ```TSHttpTxnCachedRespGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ae8f24b8dabb5008ad11620a11682ffd6>`__
- - Note that it is an error to modify cached headers.
-
-- `TSHttpTxnClientIncomingPortGet <link/to/doxygen>`__
-
-- `TSHttpTxnClientIPGet <link/to/doxygen>`__
-
-- `TSHttpTxnClientRemotePortGet <link/to/doxygen>`__
-
-- ```TSHttpTxnClientReqGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#acca66f22d0f87bf8f08478ed926006a5>`__
- - Plugins that must read client request headers use this call to
- retrieve the HTTP header.
-
-- ```TSHttpTxnClientRespGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a92349c8363f72b1f6dfed3ae80901fff>`__
-
-- ```TSHttpTxnErrorBodySet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ad7efc431279dc97de4b50a58d4ed33c1>`__
-
-- ```TSHttpTxnHookAdd`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a10382b88145bbfba0fa9d8ed6402f4b1>`__
-
-- ```TSHttpTxnNextHopAddrGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aa0118beabfefe35d2642f007ac7afa97>`__
-
-- ```TSHttpTxnParentProxySet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a2a1260b900b665d38a262544446b886c>`__
-
-- ```TSHttpTxnReenable`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#ac367347e02709ac809994dfb21d3288a>`__
-
-- ```TSHttpTxnServerAddrGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a63917ec11275c4f1ed559362865cd65f>`__
-
-- ```TSHttpTxnServerReqGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aac2343a8b47bf9150f3ff7cd4e692d57>`__
-
-- ```TSHttpTxnServerRespGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a39e8bfb199eadabb54c067ff25a9a400>`__
-
-- ```TSHttpTxnSsnGet`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a8c5190bd2e940ef2d1969a5be65f0edd>`__
-
-- ```TSHttpTxnTransformedRespCache`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a213b584cd04001e8f8ad509d187a4103>`__
-
-- ```TSHttpTxnTransformRespGet`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a4fc46502733adcff09587a436e300114>`__
-
-- ```TSHttpTxnUntransformedRespCache`` <http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#a8b9c0e61cbcb251417df0d06ae6c4408>`__
-
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions/initiate-http-connection.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions/initiate-http-connection.en.rst b/doc/source/sdk/http-hooks-and-transactions/initiate-http-connection.en.rst
deleted file mode 100644
index 059747d..0000000
--- a/doc/source/sdk/http-hooks-and-transactions/initiate-http-connection.en.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-Initiate HTTP Connection
-************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-This function enables plugins to initiate HTTP transactions. The
-initiate HTTP connection function is:
-
-- ```TSHttpConnect`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a2b45aa63ac1353b4c52123110197b61e>`__
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-hooks-and-transactions/intercepting-http-transactions.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-hooks-and-transactions/intercepting-http-transactions.en.rst b/doc/source/sdk/http-hooks-and-transactions/intercepting-http-transactions.en.rst
deleted file mode 100644
index 9dd7682..0000000
--- a/doc/source/sdk/http-hooks-and-transactions/intercepting-http-transactions.en.rst
+++ /dev/null
@@ -1,30 +0,0 @@
-Intercepting HTTP Transactions
-******************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-The intercepting HTTP transaction functions enable plugins to intercept
-transactions either after the request is received or upon contact with
-the origin server. The plugin then acts as the origin server using the
-``TSVConn`` interface. The intercepting HTTP transaction function allow
-for reading ``POST`` bodies in plugins as well as using alternative
-transports to the origin server.The intercepting HTTP transaction
-functions are:
-
-- ```TSHttpTxnIntercept`` <http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a3408017633f95161e2ab4fa175c44fa3>`__
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-transformation-plugin.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-transformation-plugin.en.rst b/doc/source/sdk/http-transformation-plugin.en.rst
deleted file mode 100644
index 8d6356f..0000000
--- a/doc/source/sdk/http-transformation-plugin.en.rst
+++ /dev/null
@@ -1,159 +0,0 @@
-HTTP Transformation Plugins
-***************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-Transform plugins examine or transform HTTP message body content. For
-example, transform plugins can:
-
-- Append text to HTML documents
-
-- Compress images
-
-- Do virus checking (on client ``POST`` data or server response data)
-
-- Do content-based filtering (filter out HTML documents that contain
- certain terms or expressions)
-
-This chapter explains how to write transform plugins. The following
-examples are discussed in detail:
-
-.. toctree::
- :maxdepth: 2
-
- http-transformation-plugin/sample-null-transformation-plugin.en
- http-transformation-plugin/append-transform-plugin.en
- http-transformation-plugin/sample-buffered-null-transformation-plugin.en
-
-Writing Content Transform Plugins
----------------------------------
-
-Content transformation plugins transform HTTP response content (such as
-images or HTML documents) and HTTP request content (such as client
-``POST`` data). Because the data stream to be transformed is of variable
-length, these plugins must use a mechanism that passes data from buffer
-to buffer *and* checks to see if the end of the data stream is reached.
-This mechanism is provided by virtual connections (``VConnection``\ s)
-and virtual IO descriptors (``VIO``\ s).
-
-A **``VConnection``** is an abstraction for a data pipe that allows its
-users to perform asynchronous reads and writes without knowing the
-underlying implementation. A transformation is a specific type of
-``VConnection``. A **transformation** connects an input data source and
-an output data sink; this feature enables it to view and modify all the
-data passing through it.
-
-Transformations can be chained together, one after the other, so that
-multiple transformations can be performed on the same content. The
-``VConnection`` type, ``TSVConn``, is actually a subclass of ``TSCont``,
-which means that ``VConnection``\ s (and transformations) are
-continuations. ``VConnection``\ s and transformations can thus exchange
-events, informing one another that data is available for reading or
-writing, or that the end of a data stream is reached.
-
-A **``VIO``** is a description of an IO operation that is in progress.
-Every ``VConnection`` has an associated *input VIO* and an associated
-*output VIO*. When ``VConnection``\ s are transferring data to one
-another, one ``VConnection``'s input ``VIO`` is another
-``VConnection``'s output ``VIO``. A ``VConnection``'s input ``VIO`` is
-also called its **write ``VIO``** because the input ``VIO`` refers to a
-write operation performed on the ``VConnection`` itself. Similarly, the
-outpt ``VIO`` is also called the **read ``VIO``**. For transformations,
-which are designed to pass data in one direction, you can picture the
-relationship between the transformation ``VConnection`` and its
-``VIO``\ s as follows:
-
-**Transformation and its ``VIO``\ s** {#TransformationAndVIOs}
-
-.. figure:: /images/sdk/vconnection.jpg
- :alt: A Transformation and its VIOs
-
- A Transformation and its VIOs
-Because the Traffic Server API places transformations directly in the
-response or request data stream, the transformation ``VConnection`` is
-responsible only for reading the data from the input buffer,
-transforming it, and then writing it to the output buffer. The upstream
-``VConnection`` writes the incoming data to the transformation's input
-buffer. In the figure above, `A Transformation and its
-``VIO``\ s <#TransformationAndVIOs>`__, the input ``VIO`` describes the
-progress of the upstream ``VConnection``'s write operation on the
-transformation, while the output ``VIO`` describes the progress of the
-transformation's write operation on the output (downstream)
-``VConnection``. The **nbytes** value in the ``VIO`` is the total number
-of bytes to be written. The **ndone** value is the current progress, or
-the number of bytes that have been written at a specific point in time.
-
-When writing a transformation plugin, you must understand implementation
-as well as the use of ``VConnection``\ s. The *implementor's side*
-refers to how to implement a ``VConnection`` that others can use. At
-minimum, a transform plugin creates a transformation that sits in the
-data stream and must be able to handle the events that the upstream and
-downstream ``VConnection``\ s send to it. The *user's side* refers to
-how to use a ``VConnection`` to read or write data. At the very least,
-transformations output (write) data.
-
-Transformations
-~~~~~~~~~~~~~~~
-
-VIOs
-~~~~
-
-A **``VIO``** or virtual IO is a description of an in progress IO
-operation. The ``VIO`` data structure is used by ``VConnection`` users
-to determine how much progress has been made on a particular IO
-operation, and to reenable an IO operation when it stalls due to buffer
-space. ``VConnection`` implementors use ``VIO``\ s to determine the
-buffer for an IO operation, how much work to do on the IO operation, and
-which continuation to call back when progress on the IO operation is
-made.
-
-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;
-
-IO Buffers
-~~~~~~~~~~
-
-The **IO buffer** data structure is the building block of the
-``VConnection`` abstraction. An IO buffer is composed of a list of
-buffer blocks which, in turn, point to buffer data. Both the *buffer
-block* (``TSIOBufferBlock``) and *buffer data* (``TSIOBufferData``) data
-structures are reference counted so they can reside in multiple buffers
-at the same time. This makes it extremely efficient to copy data from
-one IO buffer to another using ``TSIOBufferCopy``, since Traffic Server
-only needs to copy pointers and adjust reference counts appropriately
-(instead of actually copying any data).
-
-The IO buffer abstraction provides for a single writer and multiple
-readers. In order for the readers to have no knowledge of each other,
-they manipulate IO buffers through the\ ``TSIOBufferReader`` data
-structure. Since only a single writer is allowed, there is no
-corresponding ``TSIOBufferWriter`` data structure. The writer simply
-modifies the IO buffer directly.
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-transformation-plugin/append-transform-plugin.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-transformation-plugin/append-transform-plugin.en.rst b/doc/source/sdk/http-transformation-plugin/append-transform-plugin.en.rst
deleted file mode 100644
index 5896c57..0000000
--- a/doc/source/sdk/http-transformation-plugin/append-transform-plugin.en.rst
+++ /dev/null
@@ -1,145 +0,0 @@
-The Append-Transform Plugin
-***************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-The append-transform plugin appends text to the body of an HTTP
-response. It 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
-
-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 adds text to the response.
-
-Below is a list of the functions in ``append-transform.c``, in the order
-they appear in the source code. Below each entry is a description of
-what the function does:
-
-- **``my_data_alloc``**
-
- 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) 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 ``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 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 ``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 ``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_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``. 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 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 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
-
- - 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.
-
- - Calls ``TSHttpTxnReenable`` to continue the transaction
-
-- **``load``**
-
- 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:
-
- - 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.
-
- - 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.
-
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a782694b/doc/source/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
----------------------------------------------------------------------
diff --git a/doc/source/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst b/doc/source/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
deleted file mode 100644
index deacf8f..0000000
--- a/doc/source/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
+++ /dev/null
@@ -1,213 +0,0 @@
-The Sample Buffered Null Transform Plugin
-*****************************************
-
-.. Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
-The buffered null transform, ``bnull-transform.c``, reads the response
-content into a buffer and then writes the full buffer out to the client.
-Many examples of transformations, such as compression, require you to
-gather the full response content in order to perform the transformation.
-
-The buffered null transform uses a state variable to keep track of when
-it is (a) reading data into the buffer and (b) writing the data from the
-buffer to the downstream vconnection.
-
-The following is a step-by-step walk through the buffered null
-transform:
-
-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 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 (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;
- }
- }
-
-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 vconnection is ``bnull_transform``.
-
-4. The ``bnull_transform`` function has to handle ``ERROR``,
- ``WRITE_COMPLETE``, ``WRITE_READY``, and ``IMMEDIATE`` events. If
- the transform is just beginning, the event received is probably
- ``IMMEDIATE``. The ``bnull_transform`` function calls
- ``handle_transform`` to handle ``WRITE_READY`` and ``IMMEDIATE``.
-
-5. The ``handle_transform`` function examines the data parameter for
- the continuation passed to it (the continuation passed to
- ``handle_transform`` is the transformation vconnection). The data
- structure keeps track of two states: copying the data into the
- buffer (``STATE_BUFFER_DATA``) and writing the contents of the
- buffer to the output vconnection (``STATE_OUTPUT_DATA``).
-
-6. Get a handle to the input VIO (see the ``handle_buffering``
- function). ``input_vio = TSVConnWriteVIOGet (contp);`` This is so
- that the transformation can get information about the upstream
- vconnection's 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);
-
-8. Tell the input buffer that the transformation has read the data. See
- the ``handle_buffering`` function for the following code fragment:
- ``TSIOBufferReaderConsume (TSVIOReaderGet (write_vio), towrite);``
-
-9. Modify the input VIO to tell it how much data has been read
- (increase the value of ``ndone``). See the ``handle_buffering``
- function for the following code fragment:
- ``TSVIONDoneSet (write_vio, TSVIONDoneGet (write_vio) + towrite); }``
-
-10. If there is more data left to read ( if ndone < 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 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:
-
- **Reading Data Into the Buffer (the ``STATE_BUFFER_DATA`` State)**
- {#ReadingDataIntoBuffer}
-
- .. figure:: /images/sdk/vconn_buffer.jpg
- :alt: Reading Data Into the Buffer the STATE\_BUFFER\_DATA State
-
- Reading Data Into the Buffer the STATE\_BUFFER\_DATA State
-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);
-
-12. The upstream vconnection will probably shut down the write operation
- when it receives the ``WRITE_COMPLETE`` event. The handler function
- of the transformation, ``bnull_transform``, receives an
- ``IMMEDIATE`` event and calls the ``handle_transform`` function.
- This time, the state is ``STATE_OUTPUT_DATA``, so
- ``handle_transform`` calls ``handle_output``.
-
-13. The ``handle_output`` function gets a handle to the output
- vconnection: ``output_conn = TSTransformOutputVConnGet (contp);``
-
-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:
-
- **Writing the Buffered Data to the Output Vconnection**
- {#WritingBufferedtDataIntoVConnection)
-
- .. figure:: /images/sdk/vconn_buf_output.jpg
- :alt: Writing the Buffered Data to the Output Vconnection
-
- Writing the Buffered Data to the Output Vconnection
-