-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all, i'm going on with my works for wallpaper fetcher, and now i'm
testing ecore_con_url features, but i found two problems.

** Problems **
0) downloading of text data: the downloaded data contains garbage
1) downloading of binary data: the downloaded data is smaller than
the original data

** Attachments **
ecore_con.diff : a patch to solve problem 0)
ecore_con_wget.c : my test application that i use to understand how
ecore_con_url works

** How to reproduce **
0) Build ecore_con_wget
1) Fetch a copy of text data 
$ curl -o gpriv.html http://www.google.com/intl/en/privacy.html
2) Fetch the same data using ecore_con_wget
$ ecore_con_wget http://www.google.com/intl/en/privacy.html gpriv1.html
3) Make a diff between gpriv.html and gpriv1.html and see
4) Fetch two copies of binary data, one using whatyouwant and one
using ecore_con_wget
5) ls -l and see sizes 

I think the problem is outside test app.

Bugzilla bugID 386.

Can someone help me?

Massimiliano
- -- 
Massimiliano Calamelli
http://mcalamelli.netsons.org
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)

iD8DBQFHsv1gleGEL56NNP4RAvpOAJ9iIzPnREy7yGAr9YHZ75B/v/hPYgCfYiJ1
nXTbJ3vDflg6G+AJ8N/TH3U=
=5m0C
-----END PGP SIGNATURE-----
Index: ecore_con_url.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_url.c,v
retrieving revision 1.17
diff -u -r1.17 ecore_con_url.c
--- ecore_con_url.c     11 Feb 2008 23:24:11 -0000      1.17
+++ ecore_con_url.c     13 Feb 2008 13:15:58 -0000
@@ -454,6 +454,7 @@
        e->url_con = url_con;
        e->size = real_size;
        memcpy(e->data, buffer, real_size);
+       e->data[e->size]= 0;
        ecore_event_add(ECORE_CON_EVENT_URL_DATA, e,
                        _ecore_con_event_url_free, NULL);
      }
/* Compile: gcc -o ecore_con_wget ecore_con_wget.c `pkg-config --libs --cflags ecore-con` */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Ecore.h>
#include <Ecore_Con.h>

char *urldata;
char *source;
const char *dest;
FILE *fh;

static int _url_complete (void *data, int type, void *event);
static int _url_data (void *data, int type, void *event);

static int
_url_complete (void *data, int ev_type, void *ev)
{
   Ecore_Con_Event_Url_Complete *euc;

   euc = (Ecore_Con_Event_Url_Complete *)ev;
   printf("URL COMPLETE with status: %d\n", euc->status);
   fclose(fh);
   ecore_main_loop_quit();
   return 0;
}

static int
_url_data (void *data, int ev_type, void *ev)
{
   Ecore_Con_Event_Url_Data *eud;
   static int cntr = 0;
   static int fsize = 0;

   eud = (Ecore_Con_Event_Url_Data *)ev;
   fsize = fsize + eud->size;
   printf("### URL DATA received, CHUNK %d (%d), currsize %d ###\n", cntr++, eud->size, fsize);
   fputs(eud->data, fh);
   return 0;
}

int 
main (int argc, char **argv)
{
   Ecore_Con_Url *ecu; 
   char *source;
   char *dest;

   if (argc < 3)
   {
      printf("Usage:\n");
      printf("ecore_con_wget <url> <dest>\n");
      return 1;
   }

   source = argv[1];
   dest = argv[2];

   if (!ecore_con_url_init())
   {
      printf("ERROR: cannot init ecore_con_url\n");
      return 1;
   }

   ecu = ecore_con_url_new(source);
   if(!ecu)
   {
      printf("ecore_con_url_new ERROR.\n");
      return 1;
   }

   ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data, NULL);
   ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete, NULL);

   fh = fopen(dest, "ab+");
   ecore_con_url_send(ecu, NULL, 0, NULL);

   ecore_main_loop_begin();

   ecore_con_url_destroy(ecu);
   ecore_con_url_shutdown();
   return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to