Skip to content

Commit

Permalink
2005-06-29 Pierre-Luc Paour <gallery@paour.com> (1.4.2-b21)
Browse files Browse the repository at this point in the history
	* Fixed downloading secured images for slideshow with G2.
  • Loading branch information
Pierre-Luc Paour committed Jun 29, 2005
1 parent 37ed346 commit 39056c6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
2005-06-29 Pierre-Luc Paour <gallery@paour.com> (1.4.2-b21)

* Fixed downloading secured images for slideshow with G2.

2005-05-20 Pierre-Luc Paour <gallery@paour.com> (1.4.2-b20)

* Added ability to force the Gallery version to avoid problems with
Expand Down
4 changes: 4 additions & 0 deletions com/gallery/GalleryRemote/GalleryComm.java
Expand Up @@ -265,6 +265,10 @@ public static GalleryComm getCommInstance(StatusUpdate su, URL url, Gallery g) {
// create a connection
HTTPConnection mConnection = new HTTPConnection(url);
addUserInfo(mConnection, url);
String userAgent = g.getUserAgent();
if (userAgent != null) {
mConnection.setDefaultHeaders(new NVPair[] { new NVPair("User-Agent", userAgent) });
}

if (g.getType() == Gallery.TYPE_STANDALONE) {
// assemble the URL
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/model/Gallery.java
Expand Up @@ -58,7 +58,7 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc
String username;
String password;
String alias;
String userAgent = null;
String userAgent = "Gallery Remote " + GalleryRemote._().properties.getProperty("version");
int type = TYPE_STANDALONE;

transient GalleryComm comm = null;
Expand Down
12 changes: 10 additions & 2 deletions com/gallery/GalleryRemote/util/ImageUtils.java
Expand Up @@ -44,6 +44,8 @@

import org.w3c.dom.Node;
import org.w3c.dom.NamedNodeMap;
import HTTPClient.CookieModule;
import HTTPClient.Cookie;

/**
* Interface to common image manipulation routines
Expand Down Expand Up @@ -712,11 +714,17 @@ public static File download(Picture p, Dimension d, StatusUpdate su, Cancellable
long start = System.currentTimeMillis();

URLConnection conn = pictureUrl.openConnection();
//conn.addRequestProperty("Connection", "Dont-keep-alive");
String userAgent = p.getAlbumOnServer().getGallery().getUserAgent();
if (userAgent != null) {
conn.addRequestProperty("User-Agent", userAgent);
}
conn.addRequestProperty("Referer", p.getAlbumOnServer().getGallery().getGalleryUrl("").toString());
Cookie[] cookies = CookieModule.listAllCookies();
for (int i = 0; i < cookies.length; i++) {
conn.addRequestProperty("Cookie", cookies[i].toString());
}

int size = conn.getContentLength();

su.startProgress(StatusUpdate.LEVEL_BACKGROUND, 0, size,
Expand Down Expand Up @@ -1056,8 +1064,8 @@ public static java.util.List listFilesRecursive(File dir)
ArrayList ret = new ArrayList();

/* File.listFiles: stupid call returns null if there's an
i/o exception *or* if the file is not a directory, making a mess.
http://java.sun.com/j2se/1.4/docs/api/java/io/File.html#listFiles() */
i/o exception *or* if the file is not a directory, making a mess.
http://java.sun.com/j2se/1.4/docs/api/java/io/File.html#listFiles() */
File[] fileArray = dir.listFiles();
if (fileArray == null) {
if (dir.isDirectory()) {
Expand Down
4 changes: 2 additions & 2 deletions defaults.properties
Expand Up @@ -245,6 +245,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p
#
# --- Do not edit below this line ---
#
version=1.4.2-b20
releaseDate=2005/05/20
version=1.4.2-b21
releaseDate=2005/06/29
aboutText=Gallery Remote\n \n \nA part of the Gallery Open-Source Project\nhttp://gallery.sourceforge.net\n \n \nMaintained by:\n \nPierre-Luc Paour\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\nAmedeo Paglione\nChris Schwerdt\nSeth Ladd\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor

0 comments on commit 39056c6

Please sign in to comment.