Skip to content

Commit

Permalink
Added basic hello program. Added wiki information at README.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoreno committed May 9, 2011
1 parent feb060c commit f4b4da5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.rst
Expand Up @@ -15,6 +15,9 @@ Its not a web server per se, as it is not an executable.
If you want to compare to a web server, a web server would use a module or plugin to add
some functionality. With libonion you have the functionality and add the webserver as a plugin.

There is a wiki available at https://github.com/davidmoreno/onion/wiki, with many useful
information on how to start and internal workings.

API documentation is at http://coralbits.com/staticc/libonion/html/.

SSL Support
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Expand Up @@ -11,3 +11,4 @@ endif (PAM_ENABLED)
add_subdirectory(userver)
add_subdirectory(interactive)
add_subdirectory(fileserver_otemplate)
add_subdirectory(hello)
Binary file added examples/basic/basic
Binary file not shown.
7 changes: 7 additions & 0 deletions examples/hello/CMakeLists.txt
@@ -0,0 +1,7 @@

add_executable(hello hello.c)
target_link_libraries(hello onion)




19 changes: 19 additions & 0 deletions examples/hello/hello.c
@@ -0,0 +1,19 @@
/** Licensed under AGPL 3.0. (C) 2010 David Moreno Montero. http://coralbits.com */
#include <onion/onion.h>

int hello(void *p, onion_request *req){
onion_response *res=onion_response_new(req);
onion_response_set_length(res,11);
onion_response_set_header(res, "Content-Type", "text/html");
onion_response_write_headers(res);
onion_response_write(res,"Hello world",11);
return onion_response_free(res);
}

int main(int argc, char **argv){
onion *o=onion_new(O_ONE_LOOP);
onion_set_root_handler(o, onion_handler_new((void*)hello, NULL, NULL));
onion_listen(o);
onion_free(o);
return 0;
}

0 comments on commit f4b4da5

Please sign in to comment.