You are here:  » Issues with gzip - output file being limited to 1024 KB


Issues with gzip - output file being limited to 1024 KB

Submitted by bizzo on Tue, 2018-01-30 23:52 in

Hi,
I'm having issues with the output of a gzip file seemingly being limited to 1024 KB - instead of the full file being outputed - its being truncated. I'm using gzip automation handler in version 15/10 - when manually extracting the file with winrar ithe full file is there - untruncated.

I'm using a windows server with wamp & have installed windows zip handlers as per https://www.pricetapestry.com/node/4676

I've also tried increasing the gzip read parameter in the function below from 2048 to 10000 but did'nt help.

Any ideas what the issue could be?

Below is the modified gzip function from automation.php

Thanks
Gavin

  function automation_unzip_gzip($tmp)
  {
    global $config_automationUnzipPrograms;
    if (function_exists("gzopen"))
    {
      $gfp = gzopen($tmp,"r");
      if (!is_resource($gfp)) return FALSE;
      $fp = fopen($tmp.".ungzipped","w");
      while(!gzeof($gfp)) fwrite($fp,gzread($gfp,2048));
      fclose($fp);
      gzclose($gfp);
      unlink($tmp);
      rename($tmp.".ungzipped",$tmp);
      return TRUE;
    }
    else
    {
//replaced following line to add -S parameter https://www.pricetapestry.com/node/5911 on windows server
  // $cmd = $config_automationUnzipPrograms["gzip"]." -c -d ".$tmp." > ".$tmp.".ungzipped";
$cmd = $config_automationUnzipPrograms["gzip"]." -S '' -c -d ".$tmp." > ".$tmp.".ungzipped";
      exec($cmd);
      if (filesize($tmp.".ungzipped"))
      {
        unlink($tmp);
        rename($tmp.".ungzipped",$tmp);
        return TRUE;
      }
      else
      {
        unlink($tmp.".ungzipped");
        return FALSE;
      }
    }
  }

Submitted by support on Wed, 2018-01-31 08:57

Hi Gavin,

Try forcing the command line version incase the gzip functions are installed but for some reason not working correctly - so where you have this line:

     if (function_exists("gzopen"))

...REPLACE with:

     if (FALSE)

Cheers,
David.
--
PriceTapestry.com

Submitted by bizzo on Wed, 2018-01-31 09:54

Thanks David,

That mod made a slight difference - but doesn't unzip the full file still - the script now creates a file 1076kb instead of 1024kb

Thanks
Gavin

Submitted by support on Wed, 2018-01-31 10:32

Hi Gavin,

Is the problem affecting all gzipped feeds? Could you perhaps post an example feed URL that's not working (I'll remove the link before posting your reply) and I'll try it out on Windows / gzip...

Cheers,
David.
--
PriceTapestry.com

Submitted by bizzo on Wed, 2018-01-31 10:40

Ok thanks David,

I only have 1 feeds that's zipped - downloadable at {link saved}

Thanks

Submitted by support on Wed, 2018-01-31 12:47

Hi Gavin,

Have followed up by email...

Cheers,
David.
--
PriceTapestry.com