Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

Can Firefox unzip, zipped .htm files on the fly ?

  • 22 ответа
  • 1 имеет эту проблему
  • 2 просмотра
  • Последний ответ от mikey777

more options

Hello I have some older cisco CDs, where, except for the 1st home.htm, ALL the .htm files on it are zipped. Cisco started doing this, to save space back when a HDD was less than 1GB, back about 1997. After this, all the Documentation CDs had to be run/viewed thru the AUTOPLAY.exe 1st, then 'Launch CD' (which ran LAUNCHIT.EXE I think) which put an unzipper in memory so that whatever browser you chose (on the next screen) woudl have every .htm file unzipped b4 it was passed on to the Browser.

What I want is to copy the ENTIRE CD to my HDD and view it w/o using the CD.

So, what I need is a Plug-in or ? so I can unzip all the .htm's within Firefox.

I've tried posting some messages to 7Z about copying the entire CD to the HDD all the while unzippign .htm's on the fly. I was told 7z can't do it.

I used to program in C, do I have to write a program to do this ?

Seems simple enough... - find all .htm files below a certain Directory, and unzip them, using the same name, appending a unique number or letter (like -old) to the filename as the new unzipped file has to have the same name as the original.

Simple. But I haven't programmed in decades and don't even have a compiler on my PC, yet :)

Hello I have some older cisco CDs, where, except for the 1st home.htm, ALL the .htm files on it are zipped. Cisco started doing this, to save space back when a HDD was less than 1GB, back about 1997. After this, all the Documentation CDs had to be run/viewed thru the AUTOPLAY.exe 1st, then 'Launch CD' (which ran LAUNCHIT.EXE I think) which put an unzipper in memory so that whatever browser you chose (on the next screen) woudl have every .htm file unzipped b4 it was passed on to the Browser. What I want is to copy the ENTIRE CD to my HDD and view it w/o using the CD. So, what I need is a Plug-in or ? so I can unzip all the .htm's within Firefox. I've tried posting some messages to 7Z about copying the entire CD to the HDD all the while unzippign .htm's on the fly. I was told 7z can't do it. I used to program in C, do I have to write a program to do this ? Seems simple enough... - find all .htm files below a certain Directory, and unzip them, using the same name, appending a unique number or letter (like -old) to the filename as the new unzipped file has to have the same name as the original. Simple. But I haven't programmed in decades and don't even have a compiler on my PC, yet :)

Все ответы (20)

more options

Firefox can't do this as well. You will have to use the Windows autorun feature to access that CD. I assume that it creates a RAM disk and copy all data to that drive. Once the files are extracted to this RAM drive then you should be able to access all the files via a drive letter in Windows Explorer as well.

more options

No, no RAMdisk AFAIK. read OP to see what how I think it works.

Another thing I've noticed, is that after going thru AUTOPLAY and the LAUNCHIT.exe, the Browser says it's looking at: httpL\\127.0.0.1:8080/directories and files here instead of what I'd expect to see when Browsing a local file: D:\dir\filename

Sort of odd. But this may have something to do with the fact that it needs to route all files thru the unzipper before the browser sees them so it can unzip all the .htm files, leaving the rest alone.

BTW, there is no plug-in that will unzip all the .htm files ? Can we hack FFOX to use LAUNCHIT.exe as a plug-in ?

Thx

Изменено mikey777

more options

So, the files are accessed via localhost (127.0.0.1, see hosts file) as internet pages. This should map to a folder on the hard drive, so maybe search for these files or simply browse these directories in Firefox via their IP.

more options

You don't seem to understand 100%.

All the .htm files are ZIPPED.

The issue is NOT where the files are, but the fact that they are all zipped and no browser, that I know of, can unzip all the .htm files as it reads them.

The fact that they are on a CD doesn't matter, because I CAN copy the entire CD2 to my HDD, but all those .htm files are STILL zipped.

There are too many to go thru manually and unzip them all manually.

more options

If the original launch program is able to unzip these archives, why don't you use this to unpack these files or did this stop working?

It should be possible to browse all directories via a script (.cmd or .bat) and unpack all the archives, but that is beyond the scope of this forum and and you would have to ask this at a more Windows oriented forum.

more options

I was looking for a plug-in. A very simple one, one that woudld unzip all the .htm files it sees.

Simple enough ? Seems so to me !

more options

Mozilla doesn't create the plugin or addons that is created by 3rd party developers. And if there isn't one then you won't find it. So as said you will have to use a 3rd party software to unzip those zip files.

more options

What if you were going to do this by hand, would it be as simple as:

  • right-click the .zip file
  • use the "Extract Here" command of 7-zip or other zip program
  • repeat innumerable times

Do you know whether the files contain just a single HTML file, or a whole collection of bits and pieces of a page? The more files, the more likely there would be a name collision. Of course, on the other hand, there may be a lot of duplication.

Since Firefox 57, extensions no longer have the "read/write anywhere" capability that legacy extensions had, so you can stop looking for an add-on for this on the Mozilla Add-ons site. I don't know how you would find a legacy extension for this on another site. You may find it easier to write a batch file for this job.

more options

Maybe someone can write a Python program for this.

more options

I'm going to write a C program. Back in the early 90's, or was it late 80's, I wrote the fastest filefinder there ever was, FINDIT,exe i called it. It was faster than Norton's too. Querying the directory structure for files is what it did of course, and unzipping all the .htm's will be what this next program will do.

I was hoping that Firefox, being the best Browser out there, could do something as simple as this via a plug-in. 7Z, and others, already do the hard part of unzipping, I'm not sure why FFOX can't integrate 7z as a Plug-in. I learned yesterday while using 7z command line, that 7z recognizes the .htm files as beign zipped with gzip, so, I ask again in a theoretical way, why can't FFOX see this fact, and unzip any files it needs to ?

Seems to be, with all the programming expertise at FFOX, they could whip this into FFOX in about 2hrs.

It will take me 2 months to remember how to code in C and get this done. Normally I'm a cisco CCNP so I don't write code often.

more options

In answer to another reply, yes, all one has to do within 7z is select the file, unzip it, but 7z is sort of messed up. It seems to be UNABLE to unzip a file.htm and rename it the same thing. it seems to do everything but. it will even create directories with the name of the file (without the extension) and then put the unzipped file in that directory. Seems that it cannot deal with an 'archive' with an extension. So, what Ihave been doing to see the Cisco docs on my CD, is, copy filename.htm to filename.old, then, unzip the filename.htm to filename (7z loses the extension as mentioned above) then rename the filename to filename.htm and all is well.

Turns out there are about 20,000 of these htm files on this CD so I won't be doing them all command line !

I wonder if cisco's newer doc cds are made the same way ?

The newest I have is 2-2002. Seems cisco started doign this to their Doc CDs right around 1997 when 11-2 came out.

more options

mikey777 said

I learned yesterday while using 7z command line, that 7z recognizes the .htm files as beign zipped with gzip, so, I ask again in a theoretical way, why can't FFOX see this fact, and unzip any files it needs to ?

Well, Firefox includes code to decompress files served with gzip compression. When a server sends Firefox a compressed file, it includes a header similar to:

Content-Encoding: gzip

so that Firefox knows how to interpret it. However, with local files, Firefox looks at the file extension and doesn't examine its internals to assess whether it has an unusual encoding. I don't expect that Firefox will change in that regard.

I suppose if you had a local webserver, you could work around this problem more easily.

more options

INTERESTING ! There may be some hope :)

I'm been working on the logic to unzip all the files after I copied them to a HDD, but maybe I won't need it !

Is what you say, the reason that after going thru the Cisco-docs-install, in FFOX's URL line (I tried other Browsers too but they act the same) it says 'http://127.0.0.1:8080/directory/filename' (or similar) INSTEAD OF: 'D:\directory\filename' ? This is when the CD has to be in D (cd). I'm not sure how the 127-etc tells the PC that it's the CD and not the HDD.

So it seems this means that the cisco-doc-install 'tricks' Firefox into seeing the files as if they came from a web server, which means 'unzip what you recognize as gzip'd and then view it' ?

Do you think there's a way I can trick FFOX into thinking the files are being served by a web server (via 127.0.0.1 etc) but have them come from C (HDD) instead of D (CD) ? Sort of like:

127.0.0.1:HDD/dir/file

instead of:

127.0.0.1:CD-/dir/file

And, I do have web server(s) here, but it's a PITA to have 2 PCs running just to view the CD normally.

This is definitely the most hopeful and informative answer yet :)

M

more options

The Cisco software apparently sets up a web server (http://127.0.0.1 is the loopback address commonly called localhost). file:// URLs would bypass the server.

Do you have any kind of software to create a virtual "D" or "E" or "F" drive on your C drive, so you could launch the existing setup from there without having to rewrite everything?

more options

Yes, I know abt 127.

I'd rather not 'fix' it that way, with a virtual drive.

I'm not 100% convinced yet that cisco sets up a server using the 127 to say 'get files locally'...the reason is below.

In the last 15 min I set up a server, with a copy of the CD in the right place, and FFOX does -not- unzip the .htm files on the fly.

I looked around in FFOX, and is the solution in Applications ?

You wrote that if FFOX gets a file from a server instead of locally, it will recognize it as beign zipped, and unzip it, right ?

I will look into the zipped files with a hex editor (or?) and see if I find the header you mentioned.

more options

mikey777 said

You wrote that if FFOX gets a file from a server instead of locally, it will recognize it as beign zipped, and unzip it, right ?

No, I said if the web server sends a file with a header indicating it is compressed with gzip compression, then Firefox will decompress it. Your web server needs to do something unusual, which is send Firefox a header indicating it has applied gzip compression, but just send the file WITHOUT compressing it again (double-compression defeats the purpose).

more options

Franz_von_Suppe said

Maybe someone can write a Python program for this.

Maybe something like this:

import gzip, os
c=0
def f(directory):
    with os.scandir(directory) as it:
        for entry in it:
            if entry.is_file():
                if entry.name.endswith(".htm"):
                    try:
                        with gzip.open(entry.path, 'rb') as f_in:
                            data=f_in.read()
                        new_name=entry.path+"2"
                        with open(new_name, 'wb') as f_out:
                            f_out.write(data)
                        old=entry.path[:-4]+".old"
                        os.rename(entry.path,old)
                        os.rename(new_name,entry.path)
                        global c
                        c+=1
                    except:
                        pass
            elif entry.is_dir():
                f(entry.path)

f(os.getcwd())
print(c,"files decompressed")

Изменено Franz_von_Suppe

more options

I do not understand the reply re double compression.

So I'm terying to figure out why FFOX isn't unzipping the files, and I looked on the Net, and found a list of Magic-Number re file types.

Seems to me, the files that are the issue, DO have the '41 5A' MN in them. But, FFOX is not decoding them (unzipping) on the fly, even when they are sent via a server.

All this makes me wonder why this site: https://en.wikipedia.org/wiki/List_of_file_signatures

Does not list a magic-number for HTML (plain-txt) files. Seems to me (in this case at least) FFOX is confused as it does see the MN for bzip2 but is not unzipping them. But then if there are no MNs for HTML (.htm or ?) then maybe there should be a standard, then maybe FFOX wouldn't be confused ?

Maybe <H would work as a MN for HTML ? </p>

Also, re the Python code...I'm not a real HTML guy, just a HTML newbie, only a cisco/network guy, so I don't know what to do with that code. Thx though ! Maybe I can learn here...and also keep in mind, that I run XP, no unix here yet.

more options
  1. Install Python 3.4: https://www.python.org/downloads/release/python-344/
  2. Download "decompress example.zip" (button top right): https://drive.google.com/file/d/1U37jcxalUNoRdL2Kcbo2Y2CuOokkGxjr/view?usp=sharing
  3. Extract "decompress example.zip".
  4. Double click on decompress.py will decompress all gzipped htm-files that are in the same folder or its subfolders.
more options

Would it work on bzip2 files also ?

Does you program retain the original filename.extension ?

I will try this. I am not sure yet which files are bzip2'd and which are gzip'd.

I have mulitple CDs , and it is possible all the files on one set of CDs are gzip'd. and another CD of CDs are bzip2'd...not sure yet.

I am not familiar with python, maybe it's time to get so :)

M

  1. 1
  2. 2