For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

gamm_31377's avatar
gamm_31377
Icon for Nimbostratus rankNimbostratus
Jun 18, 2014

iRule STREAM:expression problem

Hello, I try to modify the payload of a HTTP SOAP Request by an iRule. I try to use STREAM::expressions to modify. The first expression works. The second expression works. But a combination of both didn't works, see below. I tried also to implement it in 2 iRules, but only the last iRule in the chain was used.

 

Any idea ?

 

HTTP Request: panzer@system 0815

 

expression1 works: STREAM::expression {@id=.*?>@xmlns:n0="http://osmc.services.osmc.synium.com">@} Result:

 

expression2 works: STREAM::expression {@:i=@:xsi=@} Result:

 

a combination of (expression1 + expression2) fails. the expression will cut the message STREAM::expression {@id=.*?>@xmlns:n0="http://osmc.services.osmc.synium.com">@ @:i=@:xsi=@} Result:

 

3 Replies

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    Looks good as in terms of syntax and logic. Able to provide a sample string stream that's failing for you.

     

  • I fixed the bug it was a masquerading problem, but I still get an error: Malformed document Document has no root element

    The HTTP Request looks good, but I'm missing the element content-legth. STREAM profile and HTTP_Rechunk are added to the virtual server.

    POST /axis/services/OSMCService HTTP/1.1 User-Agent: kSOAP/2.0 SOAPAction: login Content-Type: text/xml Connection: close Host: 172.30.245.13 Accept-Encoding: gzip

    panzer@system01*Test!BwAAAAAKVC1Nb2JpbGUgRAEAAAAQU2Ftc3VuZyBHVC1JOTAwMQIAAAAGSkRR
    MzlFAwAAAAdBbmRyb2lkBAAAAAU0LjIuMgUAAAART3BlblNjYXBlIE1vYmls
    ZSAGAAAABTcyMzkw0+491754392793
    
    
    when RULE_INIT {
      set static::debug 1
    }
    
    when HTTP_REQUEST {
        if { [HTTP::header Content-Type] contains "text/xml" } {
        if {$static::debug}{log local0. "payload before: [HTTP::payload]"}
    
         switch -glob [HTTP::uri] {      
        "*OSMCService" {STREAM::expression {@id=.*?OSMCService">@xmlns:n0="http://osmc.services.osmc.synium.com">@ @:i=@:xsi=@ @i:@xsi:@ @:d=@:xsd=@ @d:@xsd:@ @:c=@:soapenc=@ @ c:@ soapenc:@ @:v@:soapenv@ @v:@soapenv:@}}
        }
           STREAM::enable
        } else {
            STREAM::disable
        }
    }
    when HTTP_RESPONSE {
        STREAM::disable
    }