I’m currently looking into correcting a HTTP incomming flow that is not following the standard and specifications.
i’m very close but have stumbled up on some problems and was looking for some feedback.
the incomming data:
POST /mmsc/mm7/MMSServiceSOAPPort630 HTTP/1.1
Content-Type: multipart/related; type=“text/xml”;
.boundary=“----=_Part_223_4923934.1195556277522”
Content-Length: 28770
Host: null.site1:60042
SOAPAction: “”
------=_Part_223_4923934.1195556277522
Content-Type: text/xml; charset=UTF-8
MMS_59_200711201157573176.3.0
Testtest345678123451Informational
P0Y0M0DT24H0M0StruefalseNormalNy talemeldingSender
------=_Part_223_4923934.1195556277522
Content-Type: multipart/related; type=“application/smil”;
.boundary=“----=_Part_221_1544168.1195556277196”; start=“”
Content-Id: comverse.cid
------=_Part_221_1544168.1195556277196
Content-Type: image/gif; name=Attach.gif
Content-Transfer-Encoding: base64
…
from this I have created the following iRule:
when HTTP_REQUEST {
if {([HTTP::path] starts_with “/mmsc/mm7”) and ([HTTP::method] eq “POST”)}{
read out boundry
set tblength [string first “Content-Type” [HTTP::payload]]
set blength [expr {$tblength - 4}]
set bdary [substr [HTTP::payload] 2 $blength]
Insert Missing HTTP tag.
set olddata [HTTP::header value “Content-Type”]
set missing “start=\”\“;”
HTTP::header replace “Content-Type” “$olddata boundary=\”$bdary\“; $missing”
Add missing pdu content
insert Content-ID
set tmp [string first “Content-Type” [HTTP::payload] ]
set bypass [expr {$tmp + 37}]
HTTP::payload replace $bypass 0 "\r\nContent-ID: "
insert CID:
set bypass2 [string first “comverse.cid” [HTTP::payload] ]
HTTP::payload replace $bypass2 0 “cid:”
fix boundry in payload
set tbypass3 [string first “.boundary=” [HTTP::payload] ]
log local0. “$tbypass3”
set bypass3 [expr {$tbypass3 - 2}]
if {$bypass3 > 0}{
HTTP::payload replace $bypass3 3 " "
}
}
}
the part that is not working is the last one… the fix boundary in payload - the string search returns -1. the idea with the last one is to replace /r/n. with 3 spaces to correct the field.
the only difference with the working part and the non working part is the fact that it’s outside the soap header element - but does the HTTP::payload function only return the data in the first boundary part?
any help is higly apreaciated!
br
Toby