From c677b0ac9562dd72b04ff233a6f62de858f28890 Mon Sep 17 00:00:00 2001 From: heitorganzeli Date: Mon, 2 Dec 2013 15:36:03 -0200 Subject: [PATCH 1/2] transaction diagram was remade using graphviz --- doc/sdk/http-hooks-and-transactions.en.rst | 67 +++++++++++++++++++--- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/doc/sdk/http-hooks-and-transactions.en.rst b/doc/sdk/http-hooks-and-transactions.en.rst index 98191cbe397..90cf8a8dcb1 100644 --- a/doc/sdk/http-hooks-and-transactions.en.rst +++ b/doc/sdk/http-hooks-and-transactions.en.rst @@ -72,12 +72,65 @@ 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:: /static/images/sdk/http_state2.jpg - :alt: HTTP Transaction State Diagram - - HTTP Transaction State Diagram +**HTTP Transaction State Diagram** + + +.. graphviz:: +digraph g{ + accept -> TS_HTTP_TXN_START_HOOK; + TS_HTTP_TXN_START_HOOK -> "read req hdrs"; + "read req hdrs" -> TS_HTTP_READ_REQUEST_HDR_HOOK; + TS_HTTP_READ_REQUEST_HDR_HOOK -> "cache lookup"; + "cache lookup" -> DNS [label = "miss"]; + DNS -> TS_HTTP_OS_DNS_HOOK; + TS_HTTP_OS_DNS_HOOK -> TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK; + "cache lookup" -> TS_HTTP_SELECT_ALT_HOOK [label = "hit"]; + TS_HTTP_SELECT_ALT_HOOK -> "cache match"; + "cache match" -> TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK [label="no match"]; + "cache match" -> TS_HTTP_READ_CACHE_HDR_HOOK [label = "cache fresh"]; + TS_HTTP_READ_CACHE_HDR_HOOK -> "cache fresh"; + "cache fresh" -> TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK; + TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK -> "lock URL in cache" [label = "miss"]; + TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK -> "lock URL in cache" [label = "no match "]; + TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK -> "lock URL in cache" [label = "stale"]; + TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK -> "send cached hdrs" [label = "fresh"]; + "send cached hdrs" -> "set up transform"; + "lock URL in cache" -> "pick address"; + "pick address" -> "try connect" [label = " "]; + "try connect" -> "pick address" [label = "fail"]; + "try connect" -> TS_HTTP_SEND_REQUEST_HDR_HOOK [label = "success"]; + TS_HTTP_SEND_REQUEST_HDR_HOOK -> "send req hdrs"; + "send req hdrs" -> "set up POST/PUT read" [label = "POST/PUT"]; + "send req hdrs" -> "read reply hdrs" [label = "GET"]; + "set up POST/PUT read" -> "set up req transform"; + "set up req transform" -> "tunnel req body"; + "tunnel req body" -> "read reply hdrs"; + "read reply hdrs" -> TS_HTTP_READ_RESPONSE_HDR_HOOK; + TS_HTTP_READ_RESPONSE_HDR_HOOK -> "check valid"; + "check valid" -> "setup server read" [label = "yes"]; + "check valid" -> "pick address" [label = "no"]; + "setup server read" -> "set up cache write" [label = "cacheable"]; + "setup server read" -> "set up transform" [label = "uncacheable"]; + "set up cache write" -> "set up transform"; + "set up transform" -> TS_HTTP_SEND_RESPONSE_HDR_HOOK; + TS_HTTP_SEND_RESPONSE_HDR_HOOK -> "send reply hdrs"; + "send reply hdrs" -> "tunnel response"; + "tunnel response" -> TS_HTTP_TXN_CLOSE_HOOK; + TS_HTTP_TXN_CLOSE_HOOK -> accept; + + TS_HTTP_TXN_START_HOOK [shape=box]; + TS_HTTP_READ_REQUEST_HDR_HOOK [shape = box]; + TS_HTTP_OS_DNS_HOOK [shape = box]; + TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK[shape = box]; + TS_HTTP_SELECT_ALT_HOOK [shape = box]; + TS_HTTP_READ_CACHE_HDR_HOOK [shape = box]; + TS_HTTP_SEND_REQUEST_HDR_HOOK [shape = box]; + "set up req transform" [tooltip = "req transform takes place here"]; + TS_HTTP_READ_RESPONSE_HDR_HOOK [shape = box]; + "set up transform" [tooltip = "response transform takes place here"]; + TS_HTTP_SEND_RESPONSE_HDR_HOOK [shape = box]; + TS_HTTP_TXN_CLOSE_HOOK [shape = box]; +} + From e27a07013cf366d6d93666bba987e219e546b2f3 Mon Sep 17 00:00:00 2001 From: heitorganzeli Date: Mon, 2 Dec 2013 16:34:39 -0200 Subject: [PATCH 2/2] removing trailing spaces --- doc/sdk/http-hooks-and-transactions.en.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sdk/http-hooks-and-transactions.en.rst b/doc/sdk/http-hooks-and-transactions.en.rst index 90cf8a8dcb1..97c20c6a159 100644 --- a/doc/sdk/http-hooks-and-transactions.en.rst +++ b/doc/sdk/http-hooks-and-transactions.en.rst @@ -118,7 +118,7 @@ digraph g{ "tunnel response" -> TS_HTTP_TXN_CLOSE_HOOK; TS_HTTP_TXN_CLOSE_HOOK -> accept; - TS_HTTP_TXN_START_HOOK [shape=box]; + TS_HTTP_TXN_START_HOOK [shape=box]; TS_HTTP_READ_REQUEST_HDR_HOOK [shape = box]; TS_HTTP_OS_DNS_HOOK [shape = box]; TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK[shape = box]; @@ -126,7 +126,7 @@ digraph g{ TS_HTTP_READ_CACHE_HDR_HOOK [shape = box]; TS_HTTP_SEND_REQUEST_HDR_HOOK [shape = box]; "set up req transform" [tooltip = "req transform takes place here"]; - TS_HTTP_READ_RESPONSE_HDR_HOOK [shape = box]; + TS_HTTP_READ_RESPONSE_HDR_HOOK [shape = box]; "set up transform" [tooltip = "response transform takes place here"]; TS_HTTP_SEND_RESPONSE_HDR_HOOK [shape = box]; TS_HTTP_TXN_CLOSE_HOOK [shape = box];