From d2c445f5d7cf21606c9878bff3e4046c283944df Mon Sep 17 00:00:00 2001 From: snowdrop Date: Sun, 19 Sep 2004 07:05:01 +0000 Subject: Added http stream feature (only input stream yet) Added DIME "client" support (very experimental) --- examples/nanohttp/postserver.c | 63 +++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 13 deletions(-) (limited to 'examples/nanohttp/postserver.c') diff --git a/examples/nanohttp/postserver.c b/examples/nanohttp/postserver.c index 2a813b5..a28dc20 100644 --- a/examples/nanohttp/postserver.c +++ b/examples/nanohttp/postserver.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: postserver.c,v 1.2 2004/08/26 17:02:24 rans Exp $ +* $Id: postserver.c,v 1.3 2004/09/19 07:05:03 snowdrop Exp $ * * CSOAP Project: A http client/server library in C (example) * Copyright (C) 2003 Ferhat Ayaz @@ -23,29 +23,70 @@ ******************************************************************/ #include -#ifdef WIN32 -#include -#include -#else #include -#endif + +static +void _print_binary_ascii(int n) +{ + int i,c=0; + char ascii[36]; + + for (i=0;i<32;i++) { + ascii[34-i-c] = (n & (1<sock, ""); - hsocket_send(conn->sock, "

You Posted:


"); + hsocket_send(conn->sock, "\n"); + hsocket_send(conn->sock, "

You Posted:


\n"); hsocket_nsend(conn->sock, postdata, received); + hsocket_send(conn->sock, "

Received size


\n"); + sprintf(buffer, "%d", received); + hsocket_send(conn->sock, buffer); hsocket_send(conn->sock, ""); + + _print_binary_ascii2(postdata[0]); + _print_binary_ascii2(postdata[1]); + _print_binary_ascii2(postdata[2]); + _print_binary_ascii2(postdata[3]); free(postdata); } else { @@ -62,11 +103,7 @@ void post_service(httpd_conn_t *conn, hrequest_t *req) } -#ifdef WIN32 -int _tmain(int argc, _TCHAR* argv[]) -#else int main(int argc, char *argv[]) -#endif { log_set_level(HLOG_VERBOSE); -- cgit v1.1-32-gdbae