snprintf use here is incorrect due to inconsistent behavior of snprintf, so we can lazily fall back to strlen since this is just a simple example
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@61421
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
"Server: Ecore_Con custom server\r\n"
"Content-Length: %zd\r\n"
"Content-Type: text/html; charset=UTF-8\r\n"
"Server: Ecore_Con custom server\r\n"
"Content-Length: %zd\r\n"
"Content-Type: text/html; charset=UTF-8\r\n"
-"Set-Cookie: MYCOOKIE=1; path=/; expires=%s"
+"Set-Cookie: MYCOOKIE=1; path=/; expires=%s\r\n"
"Set-Cookie: SESSIONCOOKIE=1; path=/\r\n"
"\r\n"
"Set-Cookie: SESSIONCOOKIE=1; path=/\r\n"
"\r\n"
struct _Client {
int sdata;
struct _Client {
int sdata;
client->sdata = 0;
static char buf[4096];
char welcome[] = "Welcome to Ecore_Con server!";
client->sdata = 0;
static char buf[4096];
char welcome[] = "Welcome to Ecore_Con server!";
time_t t;
printf("Client with ip %s, port %d, connected = %d!\n",
time_t t;
printf("Client with ip %s, port %d, connected = %d!\n",
t = time(NULL);
t += 60 * 60 * 24;
t = time(NULL);
t += 60 * 60 * 24;
- nbytes = snprintf(buf, sizeof(buf), response_template, sizeof(welcome), ctime(&t), welcome);
+ snprintf(buf, sizeof(buf), response_template, sizeof(welcome) - 1, ctime(&t), welcome);
- ecore_con_client_send(ev->client, buf, nbytes);
+ ecore_con_client_send(ev->client, buf, strlen(buf));
ecore_con_client_flush(ev->client);
ecore_con_client_flush(ev->client);