Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 437864

Summary: download.php script with &format=xml now downloads "archive" (instead of empty XML list)
Product: Community Reporter: David Williams <david_williams>
Component: ServersAssignee: Eclipse Webmaster <webmaster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: denis.roy
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description David Williams CLA 2014-06-21 16:21:06 EDT
I have a script that checks for "number of mirrors" for a particular directory or file. 

I noticed recently that for a file (recently moved to "archives") the script takes "forever" to get "0 mirrors". 

I first noticed a week or three ago, but might have existed before ... since until recently didn't "test" for files in "archives" (and did now, just by accident). 

At the heart of my script is a call similar to 

nMirrors=$(wget -q -O - "http://www.eclipse.org/downloads/download.php?file=${mirrorURL}&format=xml${protocolarg}" | grep \<mirror\ | wc -l)

My removing the "-q" I discovered that a call for a file on archives actually downloads the file, instead of returning an empty XML file of mirrors. 

It still "works" for directories. 

For some examples, 

wget -O mirrorList.xml http://www.eclipse.org/downloads/download.php\?file=/releases/staging/\&format=xml

results in an empty xml file. That is, an xml file that contains only 
<mirrors></mirrors>

But, a call such as that below, downloads the WHOLE archived file to mirrorList.xml, instead of producing just an empty xml file.  

wget -O mirrorList.xml http://www.eclipse.org/downloads/download.php\?file=/eclipse/downloads/drops4/R-4.3-201306052000/eclipse-SDK-4.3-linux-gtk-x86_64.tar.gz\&format=xml
Comment 1 David Williams CLA 2014-06-21 16:27:04 EDT
If this was "just my script" I might think not that bad ... but, I'm not sure of impact for functions such as p2 which I believe depend on always getting an XML file, even if empty. 

but, I think, normally, the "call" in "p2 metadata" always uses a directory for input (as far as I know) so perhaps no impact?
Comment 2 David Williams CLA 2014-06-21 16:34:42 EDT
Plus, by chance, noticed that 

http://www.eclipse.org/downloads/download.php?file=/&format=xml

returns a list of "all mirrors". 

I'm not sure what "/" means to this download.php script, but almost seems like that should be an error condition? 

From a browser, if I use 
http://www.eclipse.org/downloads/download.php?file=/

It shows me all the mirrors, and the few I spot checked return a "directory list" of that mirror -- not sure "we" want to expose that to the world? (I realize it's sort of up to the mirror if that's a good or bad thing (that is, up to their configuration) ... but, just saying not sure that's the function of "download.php".
Comment 3 Denis Roy CLA 2014-06-26 14:47:58 EDT
> nMirrors=$(wget -q -O -
> "http://www.eclipse.org/downloads/download.
> php?file=${mirrorURL}&format=xml${protocolarg}" | grep \<mirror\ | wc -l)
> 
> My removing the "-q" I discovered that a call for a file on archives
> actually downloads the file, instead of returning an empty XML file of
> mirrors. 

That could be a regression... 

> For some examples, 
> 
> wget -O mirrorList.xml
> http://www.eclipse.org/downloads/download.php\?file=/releases/staging/
> \&format=xml
> 
> results in an empty xml file. That is, an xml file that contains only 
> <mirrors></mirrors>

FWIW, /releases/staging is in the exclusion list, so there are never ant mirrors.

Fixed > http://git.eclipse.org/c/www.eclipse.org/downloads.git/commit/?id=33884fab73b0340d456ca64c6b015c74c3b16e6c