Gallery Protocol version 2 and Gallery Remote

ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Mon, 2007-01-15 13:14

Hi All,

Not sure if this is a Gallery or Gallery remote issue ... here goes.

Basically if I login using Gallery Remote (latest version) I don't see any albums being fetched. A tweak to the Gallery code and the albums show up but are Read Only. This basically simulates behavior with Gallery Remote and Gallery version 2.0 I think.

Anyway, I trace things a little...

Below is the login sequence, request/response

POST /gallery/main.php HTTP/1.1
Host: www.jussymodeleclub.ch
Connection: Keep-Alive, TE
TE: trailers, deflate, gzip, compress
User-Agent: Gallery Remote 1.5
Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
Content-type: application/x-www-form-urlencoded
Content-length: 151
g2_form%5Bcmd%5D=login&g2_form%5Bprotocol_version%5D=2.3&g2_form%5Buname%5D=test&g2_form%5Bpassword%5D=xxxxxxxxxx&g2_controller=remote.GalleryRemot


HTTP/1.1 200 OK
Date: Mon, 15 Jan 2007 12:53:34 GMT
Server: Apache
X-Powered-By: PHP/4.3.11
Set-Cookie: GALLERYSID=0f183be05af40f034c72863684efa03d; expires=Mon, 05 Feb 2007 12:53:35 GMT; path=/gallery/; domain=.jussymodeleclub.ch; HttpOnly=1
Content-Length: 160
Connection: close
Content-Type: text/plain; charset=UTF-8

#__GR2PROTO__
server_version=2.8
debug_core_version=7,3
debug_module_version=1.0.6
status=0
status_text=Login successful.
debug_user=test
debug_time=0,042s

OK, great I am logged in. Now lets fetch the albums

POST /gallery/main.php HTTP/1.1
Host: www.jussymodeleclub.ch
Connection: Keep-Alive, TE
TE: trailers, deflate, gzip, compress
User-Agent: Gallery Remote 1.5
Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
Content-type: application/x-www-form-urlencoded
Content-length: 104
g2_form%5Bcmd%5D=fetch-albums-prune&g2_form%5Bprotocol_version%5D=2.3&g2_controller=remote.GalleryRemot


HTTP/1.1 200 OK
Date: Mon, 15 Jan 2007 12:53:35 GMT
Server: Apache
X-Powered-By: PHP/4.3.11
Content-Length: 4336
Connection: close
Content-Type: text/plain; charset=UTF-8

#__GR2PROTO__
debug_time_albumids=0,049s
debug_time_entities=0,062s
debug_time_permissions=0,076s
album.name.1=2695
album.title.1=25ans de Versoix
album.summary.1=
album.parent.1=26
album.perms.add.1=false
album.perms.write.1=false
album.perms.del_alb.1=false
album.perms.create_sub.1=false
album.info.extrafields.1=Summary,Description
--- cut ---
debug_time_generate=0,081s
can_create_root=true
album_count=17
status=0
status_text=Fetch-albums successful.
debug_user=guest
debug_time=0,084s

So, what gives.... Now it thinks I am a guest.... obiously the Albums will be Read Only if I am guest, but I just logged in as a registered user.
Anyway I still have to trace this a little more, but if anyone has any quick suggestions that would be cool.
Logging in as this user using the normal web interface works fine.

As a first impression.... I would say that Gallery Remote is not returning the session cookie!

Thanks,
Serge


Gallery version = 2.1.2 core 1.1.0.2
PHP version = 4.3.11 apache2handler
Webserver = Apache
Database = mysql 3.23.58, lock.system=flock
Toolkits = Exif, Gd, ArchiveUpload
Acceleration = none, none
Operating system = Linux
Default theme = matrix
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2007-01-15 15:45

Before we start diagnosing this problem, please upgrade to Gallery 2.2 RC-1 and the latest Gallery Remote version. There have been some changes and bugfixes related to cookie handling and authentication since G2.1.2.

--------------
Enter the Gallery 2 Theme Contest today!

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-16 09:17

Hi,

OK, so I have upgraded to Gallery 2.2 RC1 and Gallery Remote 1.5.1 b30.

Same problem and the protocol trace shows the same thing.

Thanks,
Serge

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2007-01-16 12:39

Please post the communication log for the new versions as well.

--------------
Enter the Gallery 2 Theme Contest today!

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-16 12:56

Here you go.

login

POST /gallery/main.php HTTP/1.1
Host: www.jussymodeleclub.ch
Connection: close, TE
TE: trailers, deflate, gzip, compress
User-Agent: Gallery Remote 1.5.1-b30
Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
Content-type: application/x-www-form-urlencoded
Content-length: 151

g2_form%5Bcmd%5D=login&g2_form%5Bprotocol_version%5D=2.3&g2_form%5Buname%5D=test&g2_form%5Bpassword%5D=xxxxxxxxxxxx&g2_controller=remote.GalleryRemot
HTTP/1.1 200 OK
Date: Tue, 16 Jan 2007 12:50:58 GMT
Server: Apache
X-Powered-By: PHP/4.3.11
Set-Cookie: GALLERYSID=5d69803d917919a0275d58a3f20130ab; expires=Tue, 06 Feb 2007 12:50:58 GMT; path=/gallery/; domain=.jussymodeleclub.ch; HttpOnly=1
Content-Length: 162
Connection: close
Content-Type: text/plain; charset=UTF-8

#__GR2PROTO__
server_version=2.11
debug_core_version=7,17
debug_module_version=1.0.8
status=0
status_text=Login successful.
debug_user=test
debug_time=0,216s

fetch

POST /gallery/main.php HTTP/1.1
Host: www.jussymodeleclub.ch
Connection: close, TE
TE: trailers, deflate, gzip, compress
User-Agent: Gallery Remote 1.5.1-b30
Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
Content-type: application/x-www-form-urlencoded
Content-length: 104

g2_form%5Bcmd%5D=fetch-albums-prune&g2_form%5Bprotocol_version%5D=2.3&g2_controller=remote.GalleryRemot
HTTP/1.1 200 OK
Date: Tue, 16 Jan 2007 12:50:59 GMT
Server: Apache
X-Powered-By: PHP/4.3.11
Content-Length: 130
Connection: close
Content-Type: text/plain; charset=UTF-8

#__GR2PROTO__
debug_time_albumids=0,098s
status=0
album_count=0
status_text=No viewable albums.
debug_user=guest
debug_time=0,098s

Serge

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2007-01-16 14:51

Can you please attach the whole log as forum file attachement?
Thanks

--------------
Enter the Gallery 2 Theme Contest today!

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-16 15:14

Hi Valiant,

You have lost me now. This is not from a log file, its a trace using a protocol sniffer. This is pretty much all there is to it except that before the login there is the test by Gallery Remote to figure out which protocol to use.

Are you looking for the debug file from Gallery Remote? What sort of info are you looking for?

I tried to check out the source for Gallery Remote to try and debug, but there are so many branches and tags in there that I don't know where to begin. I checked out TRUNK but it does not seem to correspond at all the Gallery Remote 1.5.1 b30

On top of that the java package names are mixed case (which is a real no no)..... guess how that messes with Windows!

Regards,
Serge

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2007-01-16 15:20

- you can start Gallery_Remote_Debug instead of Gallery_Remote
- you can set the log level to detailled in your GR -> settings dialog
- GR logs to GalleryRemoteLog.txt in your temp folder, e.g. on Windows XP it's in your c:\documents and settings\username\local settings\temp\

--------------
Enter the Gallery 2 Theme Contest today!

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-16 15:46

Here you go.

Regards,
Serge

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2007-01-16 16:03

Thanks.

But I can't see why it's not including the cookie in the fetch-album response.
The cookie path / domain seem to match, thus it should include it...but it doesn't. Which explains why you're no longer logged in in the fetch-album request.

Moving the topic to the GR forums. Maybe paour has some more insight.

--------------
Enter the Gallery 2 Theme Contest today!

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-16 17:16

I agree and thats why I wanted to get the Gallery Remote code up and running in my dev environment so I could debug this issue.

I will try again with different source.

Thanks,
Serge

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Wed, 2007-01-17 14:54

Hey Valiant,

Do you anything about an "auth_token" parameter GR should be (but is not) getting back from Gallery during the login process?

Thanks,
Serge

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Wed, 2007-01-17 15:29

OK,

Narrowing this down to what might be a cookie parsing error in GR.

Serge

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Wed, 2007-01-17 16:26

OK,

The problem seems to lie around line 427 of Cookie.java (from svn Trunk)

paour, I am not exactly sure what your domain parsing logic is doing but its not working in my case.

The Cookie.domain is being set from the req.getConntection().getHost(). In my case this is www.jussymodeleclub.ch
You then append a "." to this and store it as the cookie domain.

The domain being set for the cookie is jussymodeleclub.ch which gets prefixed with a "." as well.

You then compare these and here is where the problem lies...... I will keep digging.

Thanks,
Serge

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Thu, 2007-01-18 11:24

I now have a Gallery Remote working properly with my Albums showing up properly.

paour, I changed line 427 of Cookie.java like follows

cookie.domain.substring(1, dl-vl).indexOf('.') != -1)

since you seem to always (almost) be appending a "." leading to the domain.
see line 384

I am sure this is not a perfect fix but should work fine, I would be happy to discuss this further.

Thanks,
Serge

 
blackhole

Joined: 2007-01-23
Posts: 25
Posted: Tue, 2007-01-23 13:55

I'm seeing the exact same problem. The cookie reads ".www.blackholeofphotography.com", i.e. it has the leading ".". Gallery 2.2 rc 1, Gallery Remote beta 30.

I wonder if this is a Gallery problem though, and not a Gallery Remote problem. Did it used to be that Gallery only sent the domain, without the machine name?

I'm really hoping for a fix soon. I don't have a Java development env. set up, and doing so right now is not acceptable. Pity, since Gallery Remote is why I went with Gallery to begin with, and I've got a bunch of uploads to do.

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-23 14:08

Hi,

From what I saw of the code in Gallery Remote I would still flag it as a GR issue.

I have attached my working Jar file to this thread. You should simply be able to unzip it and replace the old Jar file by this new one in your Gallery Install Dir.
Make a backup of the old Jar file of course in case things go bad.

Let me know if this works for you.

Serge

 
blackhole

Joined: 2007-01-23
Posts: 25
Posted: Tue, 2007-01-23 15:29

Hi Serge,

Thanks for the JAR file, but in the intervening hour I found a different solution. Upgrading the Gallery Remote Interface plugin to 1.0.8 fixes it. IIRC, you have to pull down the list of experimental plugins to get this option. (Site Admin-Plugins-Get Updated list and so on) GR still has the leading ".", but it all functions.

At this point, I think both sides were buggy, and fixing either one makes it all work.

Thanks again,
Kevin

 
ssozonoff

Joined: 2007-01-14
Posts: 14
Posted: Tue, 2007-01-23 16:10

Hi,

Great, in your case this has worked.
In my case I still had the same problem using Gallery Remote Interface plugin to 1.0.8 so I still think there is a bug.
The real bummer about this bug from what I have seen is that it manifests itself as galleries being "Read Only" with older versions of GR and with the latest version of the GR the galleries simply do not show up at all.
This is because dispite correct login you still become a guest user because the cookie is not maintained...

Serge

 
carmosin

Joined: 2003-11-18
Posts: 15
Posted: Thu, 2007-02-08 20:26

I am having this exact problem. I am running 1.5.1b30 and gallery remote plugin 1.0.8 in gallery-2.2-rc-1. I can log in and there are no error messages except that I see in the console output that gr can't see any albums on the url. It also tells me that I am a guest user even though I have successfully logged in as admin.

 
slackPingu

Joined: 2008-04-08
Posts: 3
Posted: Tue, 2008-04-08 20:04

I'm getting what I think is the same problem. I can successfully log into Gallery, but am getting no albums back. The debug log clearly shows that the guest user was the one the query was performed with.

I've tried dropping in the .jar from above, but it crashes.

I've attached the log from running Gallery Remote Debug.exe. Really really love remote - makes uploading a large number of pictures really easy, so would be great to get it working again.

If there's anything else I can do or add that would help - please let me know.

 
slackPingu

Joined: 2008-04-08
Posts: 3
Posted: Mon, 2008-05-26 20:15

I've removed Gallery Remote and reinstalled the latest version (1.5.1-b36) and everything is now working. Got no idea what was wrong - but the main thing is that things are working again.