seungho_33263
Mar 14, 2012Nimbostratus
Delayed response occured when I changed HTTP response data.
I want to replace http link to https link in html body content.
When I tested below code in the test environment, it worked correctly.(only IE test)
but it didn't work customer's environment.
(IE opened the page in 20sec, Chrome and Firefox didn't open)
The difference is response data's size.
In the test environment, the response data size are about 200Bytes, but the customer's response data size are over 32KB.
I think one of the reason is that it takes much time to replace after searching string pattern.
Do you have any advice for solving this problem?
-below-
when HTTP_RESPONSE {
HTTP::collect 30000
}
when HTTP_RESPONSE_DATA {
if {[HTTP::header "Content-Language"] contains "en-US"}{
set object [HTTP::payload]
regsub "http://ab.cde.co.kr/webapps/login/" $object "https://ab.cde.co.kr/webapps/login/" newdata
log "BB REDIRECT TEST(len [HTTP::payload length])"
HTTP::payload replace 0 [HTTP::payload length] $newdata
HTTP::release
}
}
=or==============================================================
when HTTP_RESPONSE {
if {[HTTP::header "Content-Language"] contains "en-US"}{
HTTP::collect 33000
}
}
when HTTP_RESPONSE_DATA {
if {[HTTP::header "Content-Language"] contains "en-US"}{
set object [HTTP::payload]
set _org "http://ab.cde.co.kr/webapps/login/"
set _new "https://ab.cde.co.kr/webapps/login/"
set offset [string first "http://ab.cde.co.kr/webapps/login/" $object 0]
if { $offset > 0 } {
set len [string length $_org]
set last [expr {$offset + $len}]
set _newobject [string replace $object $offset $last $_new]
HTTP::payload replace 0 [HTTP::payload length] $_newobject
HTTP::release
}
}
}