Hi, i'm trying to split my sockread into seperate files for header and body. Loki had something that worked but for my application it seemed kind of overly complicated so i came up with this
Code:
on *:sockread:checkName:{
  var %headerfile = $sockname $+ .header.txt
  var %datafile = $sockname $+ . $+ %id $+ .txt
  var %readname
  sockread -f %readname
  var %posname = $pos(%readname, $crlf $crlf)
  write %headerfile $mid(%readname, 1, %posname)
  write %datafile $mid(%readname, %posname)
  write test.txt %readname
}


As you see, my intentions are to find the position of the empty line and write everything before it to the header file, and everything after to the data file.

The problem is, this doesnt work. Im 100% sure i have used this before so i know it CAN work though. Ive been monitoring %posname and it never gets a value so i assume its something i did wrong with $pos but i cant figure out what. (for example using another substring that i can actually SEE is there in the server response doesnt work either)

Also i know that i AM getting a server response because test.txt gets populated just fine smirk

help would be appreciated, thanks in advance ^_^