[ https://issues.apache.org/jira/browse/TS-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikolai Gorchilov updated TS-2930: ---------------------------------- Description: ts.client_request.get_uri() omits hostname from the returned url - responds with "http:///pathname?parameters" instead of "http://hostname/pathname?parameters". This happens in the context of early state hooks up to and including TS_HTTP_POST_REMAP_HOOK. In case of cacheurl.so rewrite on the URL, hostname reamains empty even after post_remap. Here're the steps to reproduce the problem - a global lua plugin (plugins.config): ==========[cut]========== function do_global_txn_start() print('==========[cut]==========') print ('do_global_txt_start: ' .. ts.client_request.get_url()) end function do_global_txn_close() print ('do_global_txn_close: ' .. ts.client_request.get_url()) print('==========[cut]==========') end function do_global_os_dns() print ('do_global_os_dns: ' .. ts.client_request.get_url()) end function do_global_pre_remap() print ('do_global_pre_remap: ' .. ts.client_request.get_url()) end function do_global_post_remap() print ('do_global_post_remap: ' .. ts.client_request.get_url()) end function do_global_read_request() print ('do_global_read_request: ' .. ts.client_request.get_url()) end function do_global_send_request() print ('do_global_send_request: ' .. ts.client_request.get_url()) end function do_global_read_response() print ('do_global_read_response: ' .. ts.client_request.get_url()) end function do_global_send_response() print ('do_global_send_response: ' .. ts.client_request.get_url()) end function do_global_cache_lookup_complete() print ('do_global_cache_lookup_complete: ' .. ts.client_request.get_url()) end function do_global_read_cache() print ('do_global_read_cache: ' .. ts.client_request.get_url()) end Requesting same URL - http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png - in 4 different scenarios: 1. empty cache (MISS) without cacheurl.so activated 2. HIT request without cacheurl.so activated 3. empty cache (MISS) with cacheurl.so activated 4. HIT request with cacheurl.so activated Here's my traffic.out output: 1. MISS without cacheurl.so ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_os_dns: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_send_request: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_read_response: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== 2. HIT without cacheurl.so: ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_read_cache: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== 3. MISS with cacheurl.so: ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_os_dns: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_send_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_read_response: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http:///os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== 4. HIT with cacheurl.so: ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_read_cache: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http:///os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== was: ts.client_request.get_uri() omits hostname from the returned url - responds with "http:///pathname?parameters" instead of "http://hostname/pathname?parameters". This happens in the context of early state hooks up to and including TS_HTTP_POST_REMAP_HOOK. When cacheurl plugin is used, hostname is always omitted even in states after post_remap. Here're the steps to reproduce the problem - a global lua plugin (plugins.config): ==========[cut]========== function do_global_txn_start() print('==========[cut]==========') print ('do_global_txt_start: ' .. ts.client_request.get_url()) end function do_global_txn_close() print ('do_global_txn_close: ' .. ts.client_request.get_url()) print('==========[cut]==========') end function do_global_os_dns() print ('do_global_os_dns: ' .. ts.client_request.get_url()) end function do_global_pre_remap() print ('do_global_pre_remap: ' .. ts.client_request.get_url()) end function do_global_post_remap() print ('do_global_post_remap: ' .. ts.client_request.get_url()) end function do_global_read_request() print ('do_global_read_request: ' .. ts.client_request.get_url()) end function do_global_send_request() print ('do_global_send_request: ' .. ts.client_request.get_url()) end function do_global_read_response() print ('do_global_read_response: ' .. ts.client_request.get_url()) end function do_global_send_response() print ('do_global_send_response: ' .. ts.client_request.get_url()) end function do_global_cache_lookup_complete() print ('do_global_cache_lookup_complete: ' .. ts.client_request.get_url()) end function do_global_read_cache() print ('do_global_read_cache: ' .. ts.client_request.get_url()) end Requesting same URL - http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png - in 4 different scenarios: 1. empty cache (MISS) without cacheurl.so activated 2. HIT request without cacheurl.so activated 3. empty cache (MISS) with cacheurl.so activated 4. HIT request with cacheurl.so activated Here's my traffic.out output: 1. MISS without cacheurl.so ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_os_dns: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_send_request: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_read_response: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== 2. HIT without cacheurl.so: ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_read_cache: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== 3. MISS with cacheurl.so: ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_os_dns: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_send_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_read_response: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http:///os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== 4. HIT with cacheurl.so: ==========[cut]========== do_global_txt_start: / do_global_read_request: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_pre_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_post_remap: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_read_cache: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_cache_lookup_complete: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_send_response: http:///os/mit/media/m/base/images/transparent-1093278.png do_global_txn_close: http:///os/mit/media/m/base/images/transparent-1093278.png ==========[cut]========== > Missing hostname in ts.client_request.get_url() > ----------------------------------------------- > > Key: TS-2930 > URL: https://issues.apache.org/jira/browse/TS-2930 > Project: Traffic Server > Issue Type: Bug > Components: Lua, Plugins, TS API > Reporter: Nikolai Gorchilov > > ts.client_request.get_uri() omits hostname from the returned url - responds > with "http:///pathname?parameters" instead of > "http://hostname/pathname?parameters". This happens in the context of early > state hooks up to and including TS_HTTP_POST_REMAP_HOOK. > In case of cacheurl.so rewrite on the URL, hostname reamains empty even after > post_remap. > Here're the steps to reproduce the problem - a global lua plugin > (plugins.config): > ==========[cut]========== > function do_global_txn_start() > print('==========[cut]==========') > print ('do_global_txt_start: ' .. ts.client_request.get_url()) > end > function do_global_txn_close() > print ('do_global_txn_close: ' .. ts.client_request.get_url()) > print('==========[cut]==========') > end > function do_global_os_dns() > print ('do_global_os_dns: ' .. ts.client_request.get_url()) > end > function do_global_pre_remap() > print ('do_global_pre_remap: ' .. ts.client_request.get_url()) > end > function do_global_post_remap() > print ('do_global_post_remap: ' .. ts.client_request.get_url()) > end > function do_global_read_request() > print ('do_global_read_request: ' .. ts.client_request.get_url()) > end > function do_global_send_request() > print ('do_global_send_request: ' .. ts.client_request.get_url()) > end > function do_global_read_response() > print ('do_global_read_response: ' .. ts.client_request.get_url()) > end > function do_global_send_response() > print ('do_global_send_response: ' .. ts.client_request.get_url()) > end > function do_global_cache_lookup_complete() > print ('do_global_cache_lookup_complete: ' .. > ts.client_request.get_url()) > end > function do_global_read_cache() > print ('do_global_read_cache: ' .. ts.client_request.get_url()) > end > Requesting same URL - > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png - in 4 > different scenarios: > 1. empty cache (MISS) without cacheurl.so activated > 2. HIT request without cacheurl.so activated > 3. empty cache (MISS) with cacheurl.so activated > 4. HIT request with cacheurl.so activated > Here's my traffic.out output: > 1. MISS without cacheurl.so > ==========[cut]========== > do_global_txt_start: / > do_global_read_request: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_pre_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_post_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_os_dns: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_cache_lookup_complete: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_send_request: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_read_response: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_send_response: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_txn_close: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > ==========[cut]========== > 2. HIT without cacheurl.so: > ==========[cut]========== > do_global_txt_start: / > do_global_read_request: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_pre_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_post_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_read_cache: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_cache_lookup_complete: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_send_response: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > do_global_txn_close: > http://l.yimg.com/os/mit/media/m/base/images/transparent-1093278.png > ==========[cut]========== > 3. MISS with cacheurl.so: > ==========[cut]========== > do_global_txt_start: / > do_global_read_request: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_pre_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_post_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_cache_lookup_complete: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_os_dns: http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_send_request: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_read_response: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_send_response: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_txn_close: > http:///os/mit/media/m/base/images/transparent-1093278.png > ==========[cut]========== > 4. HIT with cacheurl.so: > ==========[cut]========== > do_global_txt_start: / > do_global_read_request: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_pre_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_post_remap: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_read_cache: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_cache_lookup_complete: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_send_response: > http:///os/mit/media/m/base/images/transparent-1093278.png > do_global_txn_close: > http:///os/mit/media/m/base/images/transparent-1093278.png > ==========[cut]========== -- This message was sent by Atlassian JIRA (v6.2#6252)