=?ISO-8859-1?B?UmVxdWVzdGluZyBiaW5hcnkgZmlsZXMgKGltYWdlcyBldGMp?=



Hi list!

This is my very first post so if is misdirected and belong somewhere else please let me know.

I'm developing a Linux/GNOME version, in Vala, of an application for a CMS called Roxen CMS. The application - called Roxen Application Launcher - lets you open any file in the CMS, from the web interface, in your preferred desktop application. So the application launcher downloads the file from the CMS, opens it in the preferred desktop application and listens for changes to the local file and uploads it back to the CMS when a change occurs.

Now, everything seems to work ok on textual files but doesn't work very well on binary files like images. I've Googled myself crazy for a solution but I can't find one and that's why I turn to this list.

When trying to download binary data the response body is scrambled - or truncted. The Content-Length header is correct though.

This is the code I'm using:

      var logger  = new Soup.Logger(Soup.LoggerLogLevel.BODY, -1);
      var session = new Soup.SessionAsync();
      var msg     = new Soup.Message.from_uri("GET", new Soup.URI(get_uri()));
      
      session.add_feature = logger;

      msg.request_headers.append("User-Agent",   App.USER_AGENT);
      msg.request_headers.append("Translate",    "f");
      msg.request_headers.append("Cookie",       get_cookie());
      msg.request_headers.append("Connection",   "close");

      session.send_message(msg);

This is the trace when requesting an image

      > GET /news/2006/example-2/alps.jpg HTTP/1.1
      > Soup-Debug-Timestamp: 1260009281
      > Soup-Debug: SoupSessionAsync 1 (0x1bea160), SoupMessage 1 (0x1b98320), SoupSocket 1 (0x1bf28d0)
      > Host: localhost
      > User-Agent: Roxen Application Launcher for Linux (0.1)
      > Translate: f
      > Cookie: RoxenACauth=MjppQjY0TDlqZzFUclNzR29ZRlhBTnh3TTM=; RoxenALparams="tmtlMOEGA2JyX21vZGVmTqZzYuZkZXamd2Em"
      > Connection: close
  
      < HTTP/1.1 200 OK
      < Soup-Debug-Timestamp: 1260009281
      < Soup-Debug: SoupMessage 1 (0x1b98320)
      < Accept-Ranges: bytes
      < Vary: user-agent, cookie
      < Server: Roxen/5.0.403-release2
      < ETag: "3fdc1f290b947cf5c17fbc7c7022be5e"
      < Last-Modified: Sun, 29 Nov 2009 10:14:29 GMT
      < Content-Length: 29004
      < Date: Sat, 05 Dec 2009 10:34:41 GMT
      < Connection: close
      < Content-Type: image/jpeg
      < 
      < &#65533;&#65533;&#65533;

Am I doing something wrong? Have I missed some flags or something that's needed? Or is this a Vala implementation problem? Or am I just a lamer? 

I can add that I've tried using "msg.response_body.set_accumulate(true)" with a "got_chunk" signal handler and that actually gave more data from the images but heavily scrambled. 

# Pontus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]