Forum Discussion

crate_17871's avatar
crate_17871
Icon for Nimbostratus rankNimbostratus
Sep 04, 2017

Append characters within Content-Type Header

Hi DevCentral,

 

Is it possible to write an iRule to modify the

 

Content-Type: multipart/form-data; boundary=---------------------------114131096815017 to Content-Type: multipart/form-data; boundary=-----------------------------114131096815017.

 

The modified field has to include two extra "--" since it seems in the request payload each boundary contains the additional two fields.

 

1 Reply

  • Hello Crate,

    Could you try the following irule

    when HTTP_REQUEST {
    
    if { [HTTP::header "Content-Type"] contains "boundary=" } {
        log local0. "Content-Type value BEFORE : [HTTP::header "Content-Type"]"
        set content_type [HTTP::header "Content-Type"]
            if { [scan $content_type {%[^=]=%s} first second] == 2 } { 
                set new_content_type "$first=--$second"
                HTTP::header replace "Content-Type" $new_content_type
                log local0. "Content-Type value AFTER: [HTTP::header "Content-Type"]"
            }
        }
    }
    

    Hope it helps

    Please give me a feedback

    Regards