Originally Posted By: Knoeki
that won't work either, some sites really really want you to accept gzip encoding.


OK, I see.

Here is how to patch mirc.exe 6.35
- make a backup copy of mirc.exe
- with an hex editor (you can find a free one here: http://frhed.sourceforge.net/ ) edit mirc.exe (must not be running).
- change byte at position 6354C: from 85 to 33 (context: C4 1C 33 C9 85 C0 0F 95)
- change byte at position 1D6752: from 74 to EB (context: 46 18 74 09 C7 41 18 90)
- save file

How to use the new gzip capability?
I have a remote script that handles http requests (as many concurrent requests as you like). Each socket has its own name and its own hash table (same name). The hash table is populated with a binvar item ('headers') for the headers, and another one ('ret') for the body.
When the socket is closed, here is how decompression looks like:

Code:

"if no (http or socket) error" : $hget($sockname,headers,&tmphead)

    if ($bfind(&tmphead,1,Content-Encoding: deflate)) && ($hget($sockname,ret,&_dec)) {
      if ($decompress(&_dec,b)) hadd -b $sockname ret &_dec
    }
    elseif ($bfind(&tmphead,1,Content-Encoding: gzip)) && ($hget($sockname,ret,&_dec)) {
      var %crc = $bvar(&_dec, $calc($ifmatch -7) ,4), %i = 4, %crc2
      while %i { %crc2 = %crc2 $+ $base( $gettok(%crc,%i,32) ,10,16,2) | dec %i }
      if (%crc2) {
        bcopy &_dec 3 &_dec 11 -1
        bset &_dec 1 120 156
        if ($decompress(&_dec,b)) && ($crc(&_dec,1) == %crc2) hadd -b $sockname ret &_dec
      }
      else hadd $sockname ret
    }
    bunset &_dec


Notes:
- gzip compressed data has to be dressed as deflate data. crc32 is extracted and verified after decompression.
- standard deflate ($compress()) format has lost its CRC capability on decompression.