Forum Discussion
Brad_53264
Nimbostratus
Jun 27, 2012Need help to translate line feeds (LF) into carriage returns (CR)
I have a client which is doing an HTTP GET on a plain text file. The plain text file contains line feeds (LF) on every line. I need an iRule solution that translates all line feeds into carriage returns (CR).
I am running version Big-IP 9.4.8.
Can someone help draft an iRule to accomplish this?
8 Replies
Sort By
- nitass
Employee
can you try to use stream profile and command something like the one Aaron sugguested in the discussion topic below? - Brad_53264
Nimbostratus
I've been trying to make that solution work, but have been unsuccessful. There are two types of requests that are made on this site. The first is a PROPFIND, no changes are needed to that request. The second is the GET which pulls down the plain text file. It is the plain text file that I need to have the line feeds converted to carriage returns. - nitass
Employee
With the iRule implemented that you have linked my PROPFIND command does not get the expected results, and the GET never happens.is it because stream command changes PROPFIND response content? if so, can you try to not enable stream on PRODFIND response e.g. save HTTP method to variable in HTTP_REQUEST and check it in HTTP_RESPONSE? - Brad_53264
Nimbostratus
Here is what I have so far. PROPFIND is working correctly, GET is pulling down the files, but the content is empty.when HTTP_REQUEST { set request_method [HTTP::method] } when HTTP_RESPONSE { if { $request_method contains "GET" }{ STREAM::disable STREAM::expression {@\r\n@\r\n\r\n@} STREAM::enable } }
- nitass
Employee
is stream expression really correct? - Brad_53264
Nimbostratus
STREAM:expression was used in the example from the link Nitass provided. I'm still struggling to come up with a working solution to this problem. - Brad_53264
Nimbostratus
I've solved this problem using the code belowwhen HTTP_REQUEST { set request_method [HTTP::method] } when HTTP_RESPONSE { if { $request_method contains "GET" }{ HTTP::collect [HTTP::header Content-Length] set clen [HTTP::header Content-Length] } } when HTTP_RESPONSE_DATA { if { $request_method contains "GET" }{ regsub -all "\n" [HTTP::payload] "\r" newdata HTTP::payload replace 0 $clen $newdata HTTP::release } }
- nitass
Employee
cool!
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