Risposte recenti a Can Firefox unzip, zipped .htm files on the fly ?https://support.mozilla.org/it/questions/12464782019-01-15T05:48:40-08:00Ok, well I need to learn what exactly is python, after doing some other things it seems. Seems as if2019-01-15T05:48:40-08:00mikey777https://support.mozilla.org/it/questions/1246478?page=2#answer-1188902<p>Ok, well I need to learn what exactly is python, after doing some other things it seems. Seems as if FFOX doesn't look at the file Magic Numbers after all, so...maybe I'll go back to writing a C program, who knows. This will end up in the Undone Pile.
</p>mikey777 said
Would it work on bzip2 files also ?
not at the moment but it can be changed
2019-01-14T04:41:40-08:00Franz_von_Suppehttps://support.mozilla.org/it/questions/1246478?page=2#answer-1188552<p><em>mikey777 <a href="#answer-1188530" rel="nofollow">said</a></em>
</p>
<blockquote>
Would it work on bzip2 files also&nbsp;?
</blockquote>
<p>not at the moment but it can be changed
</p>
<blockquote>
Does you program retain the original filename.extension&nbsp;?
</blockquote>
<p>yes
</p>Would it work on bzip2 files also ?
Does you program retain the original filename.extension&nbs2019-01-14T01:59:02-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188530<p>Would it work on bzip2 files also&nbsp;?
</p><p>Does you program retain the original filename.extension&nbsp;?
</p><p>I will try this. I am not sure yet which files are bzip2'd and which are gzip'd.
</p><p>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.
</p><p>I am not familiar with python, maybe it's time to get so&nbsp;:)
</p><p>M
</p>Install Python 3.4: https://www.python.org/downloads/release/python-344/
Download "decompress exampl2019-01-13T21:34:57-08:00Franz_von_Suppehttps://support.mozilla.org/it/questions/1246478#answer-1188472<ol><li>Install Python 3.4: <a href="https://www.python.org/downloads/release/python-344/" rel="nofollow">https://www.python.org/downloads/release/python-344/</a>
</li><li>Download "decompress example.zip" (button top right): <a href="https://drive.google.com/file/d/1U37jcxalUNoRdL2Kcbo2Y2CuOokkGxjr/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/1U37jcxalUNoRdL2Kcbo2Y2CuOokkGxjr/view?usp=sharing</a>
</li><li>Extract "decompress example.zip".
</li><li>Double click on <a href="http://decompress.py" rel="nofollow">decompress.py</a> will decompress all gzipped htm-files that are in the same folder or its subfolders.
</li></ol>I do not understand the reply re double compression.
So I'm terying to figure out why FFOX isn't unz2019-01-13T08:11:09-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188393<p>I do not understand the reply re double compression.
</p><p>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.
</p><p>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.
</p><p>All this makes me wonder why this site:
<a href="https://en.wikipedia.org/wiki/List_of_file_signatures" rel="nofollow">https://en.wikipedia.org/wiki/List_of_file_signatures</a>
</p><p>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&nbsp;?) then maybe there should be a standard, then maybe FFOX wouldn't be confused&nbsp;?
</p><p>Maybe &lt;H would work as a MN for HTML&nbsp;?
&lt;/p&gt;</p><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&nbsp;! Maybe I can learn here...and also keep in mind, that I run XP, no unix here yet.
</p>Franz_von_Suppe said
Maybe someone can write a Python program for this.
Maybe something like this2019-01-13T06:12:03-08:00Franz_von_Suppehttps://support.mozilla.org/it/questions/1246478#answer-1188374<p><em>Franz_von_Suppe <a href="#answer-1188216" rel="nofollow">said</a></em>
</p>
<blockquote>
Maybe someone can write a Python program for this.
</blockquote>
<p>Maybe something like this:
</p><pre>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")
</pre>mikey777 said
You wrote that if FFOX gets a file from a server instead of locally, it will recogniz2019-01-13T05:06:27-08:00jscher2000https://support.mozilla.org/it/questions/1246478#answer-1188367<p><em>mikey777 <a href="#answer-1188360" rel="nofollow">said</a></em>
</p>
<blockquote>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&nbsp;?
</blockquote>
<p>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).
</p>Yes, I know abt 127.
I'd rather not 'fix' it that way, with a virtual drive.
I'm not 100% convinced 2019-01-13T04:39:32-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188360<p>Yes, I know abt 127.
</p><p>I'd rather not 'fix' it that way, with a virtual drive.
</p><p>I'm not 100% convinced yet that cisco sets up a server using the 127 to say 'get files locally'...the reason is below.
</p><p>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.
</p><p>I looked around in FFOX, and is the solution in Applications&nbsp;?
</p><p>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&nbsp;?
</p><p>I will look into the zipped files with a hex editor (or?) and see if I find the header you mentioned.
</p>The Cisco software apparently sets up a web server (http://127.0.0.1 is the loopback address commonl2019-01-13T04:20:19-08:00jscher2000https://support.mozilla.org/it/questions/1246478#answer-1188353<p>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.
</p><p>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?
</p>INTERESTING ! There may be some hope :)
I'm been working on the logic to unzip all the f2019-01-13T03:33:38-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188342<p>INTERESTING&nbsp;! There may be some hope&nbsp;:)
</p><p>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&nbsp;!
</p><p>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'&nbsp;? 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.
</p><p>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'&nbsp;?
</p><p>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)&nbsp;? Sort of like:
</p><p>127.0.0.1:HDD/dir/file
</p><p>instead of:
</p><p>127.0.0.1:CD-/dir/file
</p><p>And, I do have web server(s) here, but it's a PITA to have 2 PCs running just to view the CD normally.
</p><p>This is definitely the most hopeful and informative answer yet&nbsp;:)
</p><p>M
</p>mikey777 said
I learned yesterday while using 7z command line, that 7z recognizes the .htm files as2019-01-13T01:34:58-08:00jscher2000https://support.mozilla.org/it/questions/1246478#answer-1188305<p><em>mikey777 <a href="#answer-1188300" rel="nofollow">said</a></em>
</p>
<blockquote>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&nbsp;?
</blockquote>
<p>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:
</p><p>Content-Encoding: gzip
</p><p>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.
</p><p>I suppose if you had a local webserver, you could work around this problem more easily.
</p>In answer to another reply, yes, all one has to do within 7z is select the file, unzip it, but 7z is2019-01-13T01:22:40-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188301<p>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.
</p><p>Turns out there are about 20,000 of these htm files on this CD so I won't be doing them all command line&nbsp;!
</p><p>I wonder if cisco's newer doc cds are made the same way&nbsp;?
</p><p>The newest I have is 2-2002. Seems cisco started doign this to their Doc CDs right around 1997 when 11-2 came out.
</p>I'm going to write a C program. Back in the early 90's, or was it late 80's, I wrote the fastest fil2019-01-13T01:15:22-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188300<p>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.
</p><p>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&nbsp;?
</p><p>Seems to be, with all the programming expertise at FFOX, they could whip this into FFOX in about 2hrs.
</p><p>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.
</p>Maybe someone can write a Python program for this.
2019-01-12T12:08:42-08:00Franz_von_Suppehttps://support.mozilla.org/it/questions/1246478#answer-1188216<p>Maybe someone can write a Python program for this.
</p>What if you were going to do this by hand, would it be as simple as:
right-click the .zip file
us2019-01-12T11:08:34-08:00jscher2000https://support.mozilla.org/it/questions/1246478#answer-1188210<p>What if you were going to do this by hand, would it be as simple as:
</p>
<ul><li> right-click the .zip file
</li><li> use the "Extract Here" command of 7-zip or other zip program
</li><li> repeat innumerable times
</li></ul>
<p>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.
</p><p>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.
</p>Mozilla doesn't create the plugin or addons that is created by 3rd party developers. And if there is2019-01-12T11:00:09-08:00WestEndhttps://support.mozilla.org/it/questions/1246478#answer-1188209<p>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.
</p>I was looking for a plug-in. A very simple one, one that woudld unzip all the .htm files it sees.
Si2019-01-12T02:47:37-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188110<p>I was looking for a plug-in. A very simple one, one that woudld unzip all the .htm files it sees.
</p><p>Simple enough&nbsp;? Seems so to me&nbsp;!
</p>If the original launch program is able to unzip these archives, why don't you use this to unpack the2019-01-12T02:45:36-08:00cor-elhttps://support.mozilla.org/it/questions/1246478#answer-1188109<p>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?
</p><p>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.
</p>You don't seem to understand 100%.
All the .htm files are ZIPPED.
The issue is NOT where the files 2019-01-12T02:29:50-08:00mikey777https://support.mozilla.org/it/questions/1246478#answer-1188104<p>You don't seem to understand 100%.
</p><p>All the .htm files are ZIPPED.
</p><p>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.
</p><p>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.
</p><p>There are too many to go thru manually and unzip them all manually.
</p>So, the files are accessed via localhost (127.0.0.1, see hosts file) as internet pages.
This should 2019-01-12T02:25:25-08:00cor-elhttps://support.mozilla.org/it/questions/1246478#answer-1188103<p>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.
</p>