.exe package is corrupted

Hi,

First, I wasn't sure if my question is appropriate for this forum. Still, I post here as I have a great respect for the knowledge that flows here.

Below are the details of my web application
File Server - Windows NT (End user files are stored)
Storage type - SAN (Storage area network)
Web server - Apache 2.0.58. on HPUX
Coding - Perl (Uses LWP download for http access)
Note: The files are first downloaded to web server and then users download the same from web server to local machine.

As the upload of user file is through a different tool, there is no visibility on its architecture. My application is used by users to download those files.

I use file <filename> to get the file attributes. I check for types cpio, gz or compress and take appropriate action. If the file is of type .pkg then I do nothing before download.

With the above state, the .exe files that are downloaded are corrupted. I mean they are not the same as the ones that are uploaded. Please help, I can explain more.

Regads

It could be possible that your application is downloading files in ascii format instead of binary format.

This is a common mistake while using a ftp client for example.

No luck :frowning: My suspision was exactly that; below is the code that I changed to see if that was the cause. I am not very sure what happens with the LWP download (LWP is a perl module). I am not very good in Perl. I learnt Perl for this application.

  open\(DLFILE, "&lt;$files\_location$_[0]"\) || Error\('open', 'file'\);
  @fileholder = &lt;DLFILE&gt;;
  close \(DLFILE\) || Error \('close', 'file'\);

  print "Content-length: $filesize\\n";

# print "Content-Type:application/x-download\n";
print "Content-Type:application/binary\n";
print "Content-Disposition:attachment;filename=$_[0]\n\n";
print @fileholder;

Well, we are in two :smiley:

I'm sure that someone else in these forums could give you much more help than me on Perl :slight_smile:

Are you really supposed to add headers like that smack dab in the file itself? It's a thing commonly done by a server so it might be perfectly okay but if you are adding headers where you're not supposed to, that's pretty sure to destroy the file.

Thanks Era,

At least to my knowledge there is no redundant header. Not sure if there is any check point or debug for that kind of an issue. Again, I appear dumb when there is a challenge with Perl or HTML. Regards.

Can you tell what the difference is between the original file and the corrupted one? That would be a good way to troubleshoot this.

Does this only happen to .EXE files, or any type of file?

I don't think there is any issue with your Perl code per se; but if it's running in the wrong context, it's modifying the file itself, rather than adding metainformation into the headers.

Hi,

Yes, it is happening with .exe files as per the current stand point. I have tried .doc, .pdf, .zip and other files that have no issues.

I don't have a clue to find the difference. Visible difference is that they have different set of information in file properties.

My file download application is hosted on HPUX, so the file comes from file area to HPUX web server and then it is downloaded to local machine from HPUX box to local machine through browser.

The working client is a Windows utility, it downloads the file from file area to local machine and there is no OS difference as per my understanding.

Does the OS flavors difference harm the .exe file while transfer? Sorry, if I am too dumb with this question. In fact I am. This thing has started to prick a little more than anticipated.

I have attached a jpg that has the snapshots of both the property windows.

Thanks again for all the help.

Screen shots don't help much to find out where the difference is coming from. Are, say, the first five bytes identical? What about the last five?

Hi Era,

No solution but I am happy that I could find the problem. The one file that I called faulty is correct but it has lost its feature of MSI (Microsoft soft self-extracting installable). I tried opening the file using WinRAR which is similar to Winzip. It gave me the unzipped contents and I found one exe within that which works like a charm. The difference to users now is that they see all the individual components instead of a self extracting single executable.

Any idea that makes it a MSI in HPUX environment will be great. Anyway, the users won't be unhappy with the current solution.

I got that idea when I used the file command to check the attributes - It was indicating ASCII cpio archive. Am I close to any solution here?

Special thanks to Era; you are wonderful.

Regards,