Re: [Vala] LibSoup set_response with binary data?



On Wednesday 13 April 2011 18:56:15 Joseph Montanez wrote:

I am having issues send binary data via libsoup server. When I read
the file, it has the correct byte length, but its getting cut off when
I send it through libsoup. I tried escaping the string as well as
flatten () on the message body, mainly setting the message body, but
it results in the same output.

Maybe having a look on how it's done in Meiga could give you some ideas. I'm 
serving binary files with it without problems, but I use void* buffers read 
with the Posix API (tweaked by me) and a slightly more complex iterated output 
using ServerContext:

http://git.igalia.com/cgi-
bin/gitweb.cgi?p=meiga.git;a=blob;f=src/server/MeigaServer.vala;h=241036753afd2992a7d40e2f30b8d403b66750ae;hb=HEAD#l451

http://git.igalia.com/cgi-
bin/gitweb.cgi?p=meiga.git;a=blob;f=src/server/ServerContext.vala;h=06e5674aaac2c2170b2548b451c32ac4228aff6f;hb=HEAD#l61

http://git.igalia.com/cgi-
bin/gitweb.cgi?p=meiga.git;a=blob;f=src/config.vapi;h=34da0d40ae719068f9e99007fce25e8b39730df5;hb=HEAD#l35

Note that this code is made to compile in Vala 0.8.1. I don't know what would 
happen if it's compiled with a more recent Vala version.

-- 
Enrique Ocaña



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