davidmoreno / onion Goto Github PK
View Code? Open in Web Editor NEWC library to create simple HTTP servers and Web Applications.
Home Page: http://www.coralbits.com/libonion/
License: Other
C library to create simple HTTP servers and Web Applications.
Home Page: http://www.coralbits.com/libonion/
License: Other
cmake
-- Using libev as poller
Gnutls not found. SSL support is not compiled in.
-- pthreads found. Threading support is compiled in.
-- libxml2 found. WebDAV support is compiled in.
-- pam found. PAM support is compiled in in handlers.
-- libpng found. png support is compiled in at extras.
-- libcairo found. Adding cairo examples. /usr/local/lib/libcairo.dylib
-- curl found. Some extra test are compiled.
librt not found. Systemd support is not compiled in.
-- Prepared for packaging
-- libev found at /usr/local/lib/libev.dylib
-- Compiling WebDAV support
-- Found include files static.h;exportlocal.h;auth_pam.h;opack.h;path.h;webdav.h;internal_status.h
-- Found include files png.h
-- Found include files block.h;codecs.h;dict.h;handler.h;http.h;https.h;listen_point.h;log.h;mime.h;onion.h;poller.h;request.h;response.h;sd-daemon.h;server.h;sessions.h;shortcuts.h;types.h;types_internal.h;url.h;websocket.h
-- Found include files onion.hpp;dict.hpp;request.hpp;response.hpp;url.hpp;handler.hpp;extrahandlers.hpp
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jdonat/onion/build
make
Scanning dependencies of target onion
[ 1%] Building C object src/onion/CMakeFiles/onion.dir/onion.c.o
[ 2%] Building C object src/onion/CMakeFiles/onion.dir/codecs.c.o
[ 2%] Building C object src/onion/CMakeFiles/onion.dir/dict.c.o
/Users/jdonat/onion/src/onion/dict.c:84:15: error: implicitly declaring library function 'strcasecmp' with
type 'int (const char *, const char *)' [-Werror]
dict->cmp=strcasecmp;
^
/Users/jdonat/onion/src/onion/dict.c:84:15: note: please include the header <strings.h> or explicitly provide
a declaration for 'strcasecmp'
1 error generated.
make[2]: *** [src/onion/CMakeFiles/onion.dir/dict.c.o] Error 1
make[1]: *** [src/onion/CMakeFiles/onion.dir/all] Error 2
make: *** [all] Error 2
mime.h is not copied in the installation directory when "make install" is executed.
The oterm binary is outdated at the web page. State clearly that its better to download the github source and compile, but also create deb package.
Hi,
I am trying to use the userver example under OSX 10.9.2. I am using the branch "darwin".
But compiling with libev I get:
Assertion failed: (("libev: ev_lAssertion failed: (("libev: ev_loop recursion during release detected", loop_done != EVBREAK_RECURSE)), function ev_run, file ev.c, line 3247.
Abort trap: 6
and compiling with libevent I get an infinite loop of:
[warn] event_base_loop: reentrant invocation. Only one event_base_loop can run on each event_base at once.
I am compiling on:
Linux localhost 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8)
I am getting the following error:
CMakeFiles/wdserver.dir/wdserver.c.o: In function `main':
wdserver.c:(.text.startup+0x28): undefined reference to `onion_handler_webdav'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/09-webdav/wdserver] Error 1
make[1]: *** [tests/09-webdav/CMakeFiles/wdserver.dir/all] Error 2
make: *** [all] Error 2
Hi,
I successfully built the library on Arch Linux (here is the PKGBUILD: https://aur.archlinux.org/packages/libonion-git/), but I had to fix three things:
Then it works. Maybe I did something wrong? Or you should fix it.
I have 06-onion.c test failed with
[ERROR https.c:208] Handshake has failed (An unexpected TLS packet was received.)
I am not sure whose fault is it. I will try to investigate it
By the way I have not all gnutls tests passed about X.509
FAIL: x509self
FAIL: x509dn
@rudimeier I create a new issue for this problem.
Just some context:
This is a split of bug #62.
The errors are on the line of:
bl_0.7_CentOS_CentOS-6_i586- 13 - internal-websockets (Failed)
bl_0.7_CentOS_CentOS-6_i586- 17 - listen_stop (Failed)
bl_0.7_CentOS_CentOS-6_x86_64- 13 - internal-websockets (Failed)
bl_0.7_CentOS_CentOS-6_x86_64- 17 - listen_stop (Failed)
Full packaging info is at https://build.opensuse.org/package/show/home:rudi_m/onion .
On my F20, they all work, except 06-server occasionally. Is it possible to see a log of the compilation/tests on the failing distro/machines?
On some servers I found it fails because it needs some specific ports open to create a server listening there. Can you check if ports 8000, 8081 and 8082 are available?
Regards,
David.
I would like to point out that identifiers like "__BLOCK_H__
" and "__ONION_MIME_H__
" do not fit to the expected naming convention of the C language standard.
Would you like to adjust your selection for unique names?
I think it would be a good idea to list the dependencies that are required to compile.
I have this issue probably because of cmake-3.0.0:
CMake Error: Error in cmake code at
onion-0.7/tests/CMakeLists.txt:18:
Parse error. Function missing ending ")". Instead found bad character with text "[".
-- Configuring incomplete, errors occurred!
Trying to compile onion, hit this error:
zoobab@trogir /home/zoobab/soft/onion/onion/build [138]$ make
[ 1%] Building C object src/onion/CMakeFiles/onion.dir/onion.c.o
[ 2%] Building C object src/onion/CMakeFiles/onion.dir/codecs.c.o
[ 3%] Building C object src/onion/CMakeFiles/onion.dir/dict.c.o
[ 3%] Building C object src/onion/CMakeFiles/onion.dir/request.c.o
[ 4%] Building C object src/onion/CMakeFiles/onion.dir/request_parser.c.o
[ 5%] Building C object src/onion/CMakeFiles/onion.dir/response.c.o
[ 6%] Building C object src/onion/CMakeFiles/onion.dir/handler.c.o
[ 7%] Building C object src/onion/CMakeFiles/onion.dir/server.c.o
[ 8%] Building C object src/onion/CMakeFiles/onion.dir/log.c.o
[ 9%] Building C object src/onion/CMakeFiles/onion.dir/sessions.c.o
[ 9%] Building C object src/onion/CMakeFiles/onion.dir/shortcuts.c.o
[ 10%] Building C object src/onion/CMakeFiles/onion.dir/block.c.o
[ 11%] Building C object src/onion/CMakeFiles/onion.dir/mime.c.o
[ 12%] Building C object src/onion/CMakeFiles/onion.dir/url.c.o
[ 13%] Building C object src/onion/CMakeFiles/onion.dir/sd-daemon.c.o
[ 14%] Building C object src/onion/CMakeFiles/onion.dir/poller.c.o
/home/zoobab/soft/onion/onion/src/onion/poller.c: In function ‘onion_poller_stop’:
/home/zoobab/soft/onion/onion/src/onion/poller.c:453:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [src/onion/CMakeFiles/onion.dir/poller.c.o] Error 1
make[1]: *** [src/onion/CMakeFiles/onion.dir/all] Error 2
make: *** [all] Error 2
Also on opera mobile, i get [ERROR websocket.c:405] Error reading websocket header
They are both now included in supporting packages for distributions, as libsystemd-daemon-dev and systemd-devel.
For example:
{% for i in global.local %}
{{i}}
{% endfor %}
does not work because it does not do rget over "global.local".
See https://github.com/davidmoreno/onion/blob/master/tools/otemplate/tag_builtins.c#L86 .
Hi, I've built example/hello successfully on Ubuntu 10.04. However, when I invoke
./hello
there prints
[-1210722624] [2013-10-15 13:47:21] [ERROR poller.c:106] Trying to add an invalid file descriptor to the poller. Please check.
Segmentation fault. (core dumped)
Please tell me how to execute the onion apps correctly. Thanks!
Here are some feedback:
My env: docker (linux/amd64) with ubuntu 12.10, no ssl, no pam
Dockerfile:
FROM ubuntu:12.10
MAINTAINER Guillaume J. Charmes <[email protected]>
RUN apt-get update
# Install deps
RUN apt-get install -y wget libgnutls-dev
# Install tools
RUN apt-get install -y tmux htop
# Download oterm
RUN wget http://www.coralbits.com/oterm/oterm-amd64/ -O /oterm && chmod +x /oterm
RUN adduser creack && echo "creack:1234" | chpasswd
# Create an user, set password and add to sudoer
RUN usermod -a -G sudo creack && sed -i -E 's/^%sudo\tALL=\(ALL:ALL\) ALL$/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers
# Support UTF8
ENV LANG C.UTF-8
ENV TERM screen-256color
EXPOSE 8080
ENTRYPOINT ["/oterm", "--no-ssl", "--no-pam"]
Everything works as expected when using xterm or iTerm2.
I don't know if it is a bug but when I run oterm as user, I can't login, I need to be root and then I can login as user.
For the record, some of the error message:
unknown code <[2B>
unknown code <[3B>
unknown code <[4B>
unknown code <[5B>
unknown code <[6B>
unknown code <[7B>
unknown code <[8B>
unknown code <[9B>
unknown code <[10B>
unknown code <[11B>
unknown code <[12B>
unknown code <[13B>
unknown code <[14B>
unknown code <[15B>
unknown code <[16B>
unknown code <[17B>
unknown code <[18B>
unknown code <[19B>
unknown code <[20B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
unknown code <[1B>
Currently there is only a memory session backend, so each time the server reboots all sessions are lost. It need a permanent session store, at least sqlite.
Ideally it should be easy to change.
Seasons Greetings,
I'd like to build a sapi module for PHP to use onion as it's HTTP server, http://github.com/krakjoe/ponion initial testing proves this is worth my time and effort, since the first version I can think of kicks the ass out of apache, which is nice 👍
Not because I'm lazy, but because I think it will make integration easier, could I ask that you expose some kind of common interface, right now, I'm not sure how to get query strings, paths, translated paths or any of the normal things you need to make some kind of sane HTTP request, I understand the aim of the project is not to be a server but a library, however, these are the existing needs of many many projects that require http functionality.
Alright, so I'm a bit lazy, I don't mind having to do all of the above by hand, worth a try tho right ??
Some specific stuff that would be super handy:
/path/to/example.php?query=1&test=two&other=three
const char* onion_request_get_version(onion_request_) # return 1.0/1.1
const char * onion_request_get_method(onion_request_); # return GET|POST|PATCH|WHATEVER
const char* onion_request_get_query_string(onion_request_); # return query=1&blah blah
const char_ onion_request_get_file(onion_request*); # return example.php
// would also be nice:
const char* onion_request_get_basepath(onion_request*); # return /path/to
what might also be nice, is an onion_context_t of onion , onion_request, onion_response*, since this seems like something we'll have to create a lot else, just defining the type would be enough I think, no need for utility functions like ctor/dtor etc ...
Cheers
Although normally POST is via application/x-www-form-urlencoded or multipart/form-data, there are other options as content-type:application/json.
In this case the content should be inserted verbatim into the POST dict, as the "data" key. Other options should be considered.
Right now, CMakeLists.txt will check if the user setted some dependency for TRUE (all dependencies are true by default), and if it is TRUE CMakeLists.txt will search the dependency and if it is not found will issue a warning.
My suggestion is, if the user specified that he wants some dependency, it is a fatal error not to find it. Also, if some dependencie's variable is unsetted, Cmake will search the dependency and if it is found the variable is default to true, if it is not found, the variable is default to false.
Hi,
My application hangs in destructor Onion::Onion. It's happens when I have one active websocket client.
Backtrace (after kill -SIGABRT):
(gdb) bt
#0 0x00007f9085ce9e75 in pthread_join (threadid=140258655704832, thread_return=0x0) at pthread_join.c:89
#1 0x00000000004d206d in onion_free ()
#2 0x000000000046f367 in Onion::Onion::~Onion (this=0x1ac1710, __in_chrg=<optimized out>) at /home/qf/package/onion/git/x86_64-linux-gnu/include/onion/onion.hpp:96
#3 0x000000000046ef10 in gate::Context::~Context (this=0x1ac1710, __in_chrg=<optimized out>) at /home/kovalevich/dev/gate/src/context.cpp:43
#4 0x0000000000462d9a in std::default_delete<gate::Context>::operator() (this=0x1abab40, __ptr=0x1ac1710) at /usr/include/c++/4.7/bits/unique_ptr.h:63
#5 0x00000000004627de in std::unique_ptr<gate::Context, std::default_delete<gate::Context> >::reset (this=0x1abab40, __p=0x1ac1710)
at /usr/include/c++/4.7/bits/unique_ptr.h:251
#6 0x000000000046018c in gate::Process::~Process (this=0x1abab40, __in_chrg=<optimized out>) at /home/kovalevich/dev/gate/src/process.cpp:55
#7 0x00000000004647d0 in std::default_delete<gate::Process>::operator() (this=0x721bc8, __ptr=0x1abab40) at /usr/include/c++/4.7/bits/unique_ptr.h:63
#8 0x000000000046394a in std::unique_ptr<gate::Process, std::default_delete<gate::Process> >::reset (this=0x721bc8, __p=0x1abab40)
at /usr/include/c++/4.7/bits/unique_ptr.h:251
#9 0x000000000046d5e7 in operator() (__closure=0x7fff17a707a0) at /home/qf/package/framework/0.1.6/x86_64-linux-gnu/include/framework/application.hpp:151
#10 0x000000000046e75c in framework::detail::ScopeExit<framework::Application<gate::Process>::exec(int, char**)::{lambda()#1}>::~ScopeExit() (this=0x7fff17a707a0,
__in_chrg=<optimized out>) at /home/qf/package/framework/0.1.6/x86_64-linux-gnu/include/framework/detail/scope_exit.hpp:51
#11 0x000000000046de76 in framework::Application<gate::Process>::exec (this=0x721bc0, argc=2, argv=0x7fff17a70ac8)
at /home/qf/package/framework/0.1.6/x86_64-linux-gnu/include/framework/application.hpp:160
#12 0x000000000046d4d9 in main (argc=2, argv=0x7fff17a70ac8) at /home/kovalevich/dev/gate/src/main.cpp:35
Onion constructor flags is O_DETACH_LISTEN | O_DETACH_LISTEN
Could you please help?
I tried it on current Firefox and Chromium. Firefox works without problems, but on Chromium, I get:
[ERROR websocket.c:405] Error reading websocket header
When sending the data, the generated opack handlers should set the proper mime type based on the original file extension.
I have looked at a few source files for your current software. I have noticed that some checks for return codes are missing.
Would you like to add more error handling for return values from functions like the following?
A basic:
<form method="POST">
<input type="submit">
</form>
blocks the petition until timeout.
When I build the library, all examples are built also. There should be a CMake variable disabling it, or am I missing something?
At onion_set_user we enforce a given user, but we do not initialize additional groups properly, only gid.
When I try to connect, I get this:
[0B76] [2013-12-20 17:24:18] [WARNING auth_pam.c:167] NOT authenticated user 'creack', code 7
I did not find anything else. How could I troubleshoot?
Currently there are non-trivial problems to use otemplate from C++, based specially on onion_dict ownership.
C++ RAII will remove the pointer to the dict, and otemplate assumes the dict needs to be feed as well, resulting on double free.
A possible solution is create C++ methods for otemplate, if not at compiling the htmls, some functions to wrap the resulting C functions.
Hi!
Currently, LGPLv3 forbids static linking. Unless you want to ensure that a user can always rebuild an application with a modified version of onion, it would be convenient to allow static linking as an exception (for people embedding onion statically without modifying it).
I don't have examples of static linking exception for LGPLv3 but there exists some examples for LGPLv2. There is Ogre (but they switched to a more liberal license later), WxWidgets, 0mq. I cannot say for which reasons the exception was added but I believe this is because of "legit" uses of static linking: easier embedding, platforms where dynamic linking is not available (like iOS), platforms lacking descent package management, easier version management.
This color should be avoided.
Url handling is not yet explained properly anywhere and is a crucial point in creating a proper http app.
One command was all I needed to break oterm: cmatrix. This command will spit out every imaginable character that can occur in a terminal, and with a pace that oterm just can't seem to keep up with (even with a reduced refresh rate). Might want to add it to your test suite?
I really like oterm otherwise! Keep up the good work!
Hi, there
I'm wondering if some one have met this situation before. Here comes the sample code based on examples/hello
:
#include <stdlib.h>
#include <string.h>
int hello(void *p, onion_request *req, onion_response *res) {
onion_response_set_header(res, "Content-type", "text/plain; charset=utf-8");
const char *s = "The English with Chinese in UTF-8. 英文和中文. \n";
char buf[8196] = { 0 };
int i;
for(i=0; i<50; ++i)
sprintf(buf, "%s%s", buf, s);
printf("%d\n", strlen(buf));
onion_response_printf(res, "%s", buf);
return OCS_PROCESSED;
}
The source code is saved in UTF-8. When the program is running, the output to the browsers would look something like:
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English with Chinese in UTF-8. 英文和中文.
The English wit����f��t�����#��]���8��
So I use curl
and od
to check inside of the output, and there is something strange around 0002000, what does \0 \b \0 \b
come from?
0001720 s e i n U T F - 8 . 350 213 261
0001740 346 226 207 345 222 214 344 270 255 346 226 207 . \n T
0001760 h e E n g l i s h w i t \0 \b
0002000 \0 \b W % X } 377 277 \0 \0 \0 \0 \r 222 377 277
0002020 ] 246 004 \b G 333 \t e b 005 \b X } 377 277
0002040 257 V 005 \b X } 377 277 310 V 005 \b \0 \0 \0 \0
0002060 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 T h e
0002100 E n g l i s h w i t h C h i
Hello,
if I try to compile (no cross compiling) onion on my igep board (ARMv7, beagleboard clone) calls of 'otemplate' do not return. It's seems to me that some loop did not end.
[ 91%] Built target hello
[ 91%] Built target fo_es
[ 91%] Built target fo_fr
[ 91%] Built target fo_pl
[ 91%] Built target fo_zh
[ 92%] Generating fileserver_html.c
^Cmake[2]: *** [examples/ofileserver/fileserver_html.c] Interrupt
make[1]: *** [examples/ofileserver/CMakeFiles/ofileserver.dir/all] Interrupt
make: *** [all] Interrupt
Did you need any further information?
Regards,
Olaf
My system is Ubuntu 12.04, kernel 3.5.0-37-generic #58~precise1-Ubuntu.
My system is inside a VirtualBox virtual machine, with a shared folder to the host system. The mount command shows this: gvfs-fuse-daemon on /home/victor/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=victor)
When onion uses sendfile to get a file from this folder, it doesn't read the file properly and sends rubbish at the end of the file, without showing the changes in the file.
URL C++ binding lacks C handler to give access to the url pointer
Hello,
At least on Debian, it's possible to have gnutls library installed (libgnutls-dev
package) but not the usr/bin/certtool
binary (from gnutls-bin
pacakge).
And so, cmake detects gnutls and enables SSL - but the build later fails with the following:
$ make
<...>
[ 77%] Generating mycert.pem
/bin/sh: certtool: command not found
make[2]: *** [tests/01-internal/mycert.pem] Error 127
make[1]: *** [tests/01-internal/CMakeFiles/06-onion.dir/all] Error 2
make: *** [all] Error 2
Perhaps add a check in CMakeLists.txt
for certool
(either as a requirement for SSL or as a prerequisite for SSL tests) ? or, mention certtool
as a requirement?
After installing gnutls-bin
, everything builds fine and works great.
Regards,
-gordon
All the tags in onion git repo are not "annotated", so that "git describe" does not work unless you are using option "--tags".
Could you please re-create the tags for example by doing
for i in 0.2 0.3 0.4 0.5 0.7; do git tag --force -a -m "Release onion ${i}." "${i}" "${i}" ; done
Note there is one downside. People who have a clone already wouldn't get pulled your updated tags automatically. Maybe not too bad but you could also simply use another tag pattern "v0.7" instead of "0.7" (This pattern is quasi standard for git repos and many existing tools and scripts would like it.):
for i in 0.2 0.3 0.4 0.5 0.7; do git tag -a -m "Release onion ${i}." "v${i}" "${i}" ; done
Just now there are two non related classes, but internally the Url is a Handler, so it makes sense, and helps in many cases, to make Url a subclass of Handler.
I am building out the validation for the next round of benchmarks and came across the fortunes test for Ninja. The problem is that the apostrophe isn't escaped while quotes, amps, and lts/gts are. We are trying to stick with web-decided best practices and apostrophes are considered "should escape".
Example:
<a href='${untrustedData}'>Click Me!</a>
Since apostrophes can replace quotes for hrefs in this way, this if valid html but the following is an attacking input: untrustedData = "' onclick='while(true){alert(\"hahaha\");}"
Currently there is support for tags, but support for filters, specially "|safe" is necesary as well.
Greetings,
I had to comment out part of line 43 of "./tests/CMakeFiles/auto.sh.dir/build.make" to get it to compile
cd /home/hynese/Desktop/onion/tests #&& cp /home/hynese/Desktop/onion/tests/auto.sh /home/hynese/Desktop/onion/tests/auto.sh
Write some documenation lines about tipical usages, as the onion_handler_export_local_new helper.
https://github.com/davidmoreno/onion/blob/master/src/onion/sessions.c#L34-L55
https://github.com/davidmoreno/onion/blob/master/src/onion/sessions.c#L65
It should use a well proven number generator or if not available use /dev/random for initializing the random number generator .
I'm really looking forward to using onion, I just wanted to compile this sample from here (http://coralbits.com/static/onion/)
#include <onion/onion.h>
#include <onion/handlers/exportlocal.h>
#include <onion/handlers/auth_pam.h>
int main(int argc, char **argv){
onion *o=onion_new(O_THREADED);
onion_set_certificate(o, O_SSL_CERTIFICATE_KEY, "cert.pem", "cert.key", O_SSL_NONE);
onion_set_root_handler(o, onion_handler_auth_pam("Onion Example", "login", onion_handler_export_local_new(".")));
onion_listen(o);
onion_free(o);
return 0;
}
The instructions say do this:
gcc -o a a.c -I$ONION_DIR/src/ -L$ONION_DIR/src/onion/ -L$ONION_DIR/src/handlers/ -lonion_handlers -lonion_static -lpam -lgnutls -lgcrypt -lpthread
But this is what happens on my machine:
$ gcc -o a a.c -I$ONION_DIR/src/ -L$ONION_DIR/src/onion/ -L$ONION_DIR/src/handlers/ -L/usr/share -lonion_handlers -lonion_static -lpam -L/usr/lib64/libgnutls.so -L/usr/lib64/libgcrypt.so -lpthread
/usr/bin/ld: /usr/local/lib/libonion_static.a(sd-daemon.c.o): undefined reference to symbol 'mq_getattr@@GLIBC_2.3.4'
/usr/bin/ld: note: 'mq_getattr@@GLIBC_2.3.4' is defined in DSO /lib64/librt.so.1 so try adding it to the linker command line
/lib64/librt.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
Any help will really be appreciated!
Hi,
I'm using otemplate to parse a html file. Unfortunately I can not extend the index.html to arbitrary length! Onion version is the current master branch.
My cmake script snippet:
add_custom_command( OUTPUT index_html.c COMMAND ${OTEMPLATE} ${CMAKE_SOURCE_DIR}/html/index.html ${CMAKE_CURRENT_BINARY_DIR}/index_html.c DEPENDS ${OTEMPLATE} ${CMAKE_SOURCE_DIR}/html/index.html )
Produce
``
[...]
tmp=onion_dict_get(context, "LAST_SETTING_FILENAME");
if (tmp)
onion_response_write0(res, tmp);
}
onion_response_write(res, "" />\n\t\t\t<input type="button" value="Save Config" onclick="saveConfig()"/>\n\t\t\t\n\t\t
\n\t\t<input style="padding-top:1em;padding-bottom:1em" type="button" id="printButton" onclick="jobManagerCmd('toggle','printButton','abortButton')" value="Print (Init)" />\n\t\t<input style="padding-top:1em;padding-bottom:1em" type="button" id="abortButton" onclick="jobManagerCmd('abort','printButton','abortButton')" value="Abort" />
\n\t\t
\n\t\t<div class="prop" id="jobState">Job Manager State: \n\t\t
The preview shows the exact copy of the displayed beamer image and require that the display is on.
\n\t\t<span style="padding-left:3em"
[...]``
Thus, to many html lines are combined to one line and the argument list of onion_respose_write is not completed anymore.
As workarround I will add an other {{}}-Tag, to force a splitting of the line. I assume, the issue is easy to fix for you.
Regards Yggdrasil.
P.S. I used Onion in two of my Github projects: TinyPrint and KinectGrid.
The readme states that the binaries are statically linked, however they are not. ( at leat linux/amd64):
$> ldd oterm
linux-vdso.so.1 => (0x00007fff713c0000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f9805bbb000)
libpam.so.0 => /lib/x86_64-linux-gnu/libpam.so.0 (0x00007f98059ad000)
libpam_misc.so.0 => /lib/x86_64-linux-gnu/libpam_misc.so.0 (0x00007f98057a8000)
libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007f98054ec000)
libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007f980526e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9805050000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9804c91000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9804a8d000)
libtasn1.so.3 => /usr/lib/x86_64-linux-gnu/libtasn1.so.3 (0x00007f980487b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9804664000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f9804450000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f980424b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9805dc4000)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.