Background: The network I'm working on is running an invisible proxy for all HTTP requests.
Attempting to install any plugin through the web configuration interface results in the following error:
Fetching http://twiki.org/p/pub/Plugins/[plugin].tgz...
Warning: I can't install http://twiki.org/p/pub/Plugins/[plugin].tgz because I don't recognise the download as a gzip file.
Warning: Extension may not have been packaged correctly. Trying for a .zip file instead.
Fetching http://twiki.org/p/pub/Plugins/[plugin].zip...
Warning: I can't install http://twiki.org/p/pub/Plugins/[plugin].zip because I don't recognise the download as a zip file.
Error: Please follow the published process for manual installation from the command line.
I've looked at EXTEND.pm, and the issue appears to be that it expects the file to start immediately after the content-type header.
However, my proxy adds a few items after the content-type header, so the headers from the webserver look like this:
HTTP/1.0 200 OK
Date: Fri, 13 Apr 2007 08:58:08 GMT
Server: Apache/2.2.0 (Unix)
Last-Modified: Tue, 10 Apr 2007 22:08:28 GMT
ETag: "13475e-e4f8-64b36f00"
Accept-Ranges: bytes
Content-Length: 58616
Content-Type: application/x-gzip
Age: 528
X-Cache: HIT from flyingmonkey
Proxy-Connection: close
<file starts here>
I've fixed EXTEND.pm so it accepts this by changing the regular expressions on lines 63 and 88, thus:
63c63
< } elsif ($ar !~ s!^.*Content-Type: application/x-gzip\r\n\r\n!!is) {
---
> } elsif ($ar !~ s!^.*Content-Type: application/x-gzip\r\n.*\r\n\r\n!!is) {
88c88
< } elsif ($ar !~ s#^.*Content-Type: application/zip\r\n\r\n##is) {
---
> } elsif ($ar !~ s#^.*Content-Type: application/zip\r\n.*\r\n\r\n##is) {
Seems to work fine. Unfortunately I can't test it properly as my webserver has /tmp on a separate filesystem from where the site itself is served, so I'm affected by Item3748.
--
TWiki:Main/JamesCort
- 13 Apr 2007
I had to modify the patch slightly because it require three =\r\n='s otherwise.
CC