Forum Discussion
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 envi...
ykkim
Mar 15, 2012Nimbostratus
Hi Aron
Thanks for your answer. I'm working with Seungho. I'm updating our status and questions.
As Seungho wrote already, source was like "SOURCE1".
Then,
case1. An expected(well changed) response page was displayed on MS-IE soon.
-- In all the tests, every response was HTTP 1.0.
case2. Nothing appeared on Chrome. At that time, Wireshark captured the full of page contents which I expected.
-- Response was HTTP 1.1.
case3. If the collection length was less than 27000(not exact number), even Chrome showed perfect page like MS-IE. Captured packets were same whith case 2.
-- Response was HTTP 1.1.
[Question1] Can collect length affect HTTP response phase?
Based on case2 and case3, I thought, it doesn't matter whether HTTP1.0 or HTTP1.1. Nevertheless, I put several lines changing HTTP request version from 1.1 to 1.0 like SOURCE2.
Then,
case4. It worked well on MS-IE. Response was HTTP 1.0, same with case1.
case5. It worked well on Chromel, too. Even though actual collected response was more than 32000 bytes, no problem. Response was HTTP1.0. (Some decorations in response part were added far later. They didn't exist during case5 tests.)
[Question2]
What does HTTP version have to do with the operation of iRule(HTTP::collect, precisely)? Can you explain the relationship between them?
[Question3]
(This is an extra.) MS-IE client sends HTTP1.1 request. And yet, how come server(or F5) responses in HTTP 1.0 automatically, with no "1.0 pushing" routine.
------ SOURCE 1 ----------------------------------------------
when HTTP_RESPONSE {
HTTP::collect 30000
}
when HTTP_RESPONSE_DATA {
set object [HTTP::payload]
set _org "http://ab.cde.ac.kr/webapps/login/"
set _new "https://ab.cde.ac.kr/webapps/login/"
set offset [string first $_org $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
}
------ SOURCE 2 ----------------------------------------------
when HTTP_REQUEST {
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
}
when HTTP_RESPONSE {
if {[HTTP::header "Content-Type"] contains "text" && [HTTP::header "Content-Language"] contains "en-US"} {
if {[HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] <= 1048576 } {
set col_len [HTTP::header "Content-Length"]
}
else {
set col_len 1048576
}
HTTP::collect $col_len
}
}
when HTTP_RESPONSE_DATA {
set object [HTTP::payload]
set _org "http://ab.cde.ac.kr/webapps/login/"
set _new "https://ab.cde.ac.kr/webapps/login/"
set offset [string first $_org $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
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects