mirror of https://git.kore.io/kore.git
Move task_curl example to tasks and into the new build framework
This commit is contained in:
parent
f4f8b1e8b0
commit
ab592d2a59
|
@ -1,50 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2013 Joris Vink <joris@coders.se>
|
||||
#
|
||||
# Kore module build script, use this as a base for building
|
||||
# your own modules for kore.
|
||||
|
||||
# The name of the module you will be building
|
||||
MODULE=task_curl.so
|
||||
|
||||
# The directory containing your module source.
|
||||
SOURCE_DIR=.
|
||||
|
||||
# Compiler settings.
|
||||
CC=gcc
|
||||
CFLAGS="-I. -I/usr/local/include -Wall -Wstrict-prototypes \
|
||||
-Wmissing-prototypes -Wmissing-declarations -Wshadow \
|
||||
-Wpointer-arith -Wcast-qual -Wsign-compare -g"
|
||||
|
||||
OSNAME=$(uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
|
||||
if [ "${OSNAME}" = "darwin" ]; then
|
||||
LDFLAGS="-dynamiclib -undefined suppress -flat_namespace -lcurl"
|
||||
else
|
||||
LDFLAGS="-L/usr/local/lib -shared -lcurl"
|
||||
fi
|
||||
|
||||
MODULE_BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
### Begin building ####
|
||||
echo "Building module ${MODULE}..."
|
||||
rm -f ${MODULE}
|
||||
|
||||
if [ ! -d .objs ]; then
|
||||
mkdir .objs;
|
||||
fi
|
||||
rm -f .objs/*
|
||||
|
||||
for src in `find ${SOURCE_DIR} -type f -name \*.c`; do
|
||||
base=`basename $src`;
|
||||
${CC} ${CFLAGS} -fPIC -c $src -o .objs/${base}.o
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Build error, check above messages for clues.";
|
||||
exit 1;
|
||||
fi
|
||||
done
|
||||
|
||||
${CC} ${LDFLAGS} `find .objs -name \*.o -type f` -o ${MODULE}
|
||||
echo "Building completed!"
|
||||
|
||||
rm -rf .objs
|
|
@ -1,31 +0,0 @@
|
|||
# Configuration for the contrib/examples/task_curl example.
|
||||
|
||||
bind 127.0.0.1 4443
|
||||
chroot # configure this (ex: /home/joris/src/kore)
|
||||
runas # configure this (ex: joris)
|
||||
|
||||
workers 1
|
||||
pidfile kore.pid
|
||||
|
||||
load ./task_curl.so
|
||||
|
||||
ssl_no_compression
|
||||
|
||||
validator v_user regex ^[a-z]*$
|
||||
|
||||
domain 127.0.0.1 {
|
||||
certfile # configure this (ex: cert/server.crt)
|
||||
certkey # configure this (ex: cert/server.key)
|
||||
accesslog kore_access.log
|
||||
|
||||
static / page_handler
|
||||
static /post_back post_back
|
||||
|
||||
params get / {
|
||||
validate user v_user
|
||||
}
|
||||
|
||||
params post /post_back {
|
||||
validate user v_user
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Compile this example using:
|
||||
|
||||
# env KORE_LDFLAGS="-I/path/to/libcurl -lcurl"
|
|
@ -0,0 +1,27 @@
|
|||
# Kore config for tasks example
|
||||
|
||||
bind 127.0.0.1 8888
|
||||
pidfile kore.pid
|
||||
|
||||
load ./tasks.so
|
||||
|
||||
ssl_no_compression
|
||||
|
||||
validator v_user regex ^[a-z]*$
|
||||
|
||||
domain 127.0.0.1 {
|
||||
certfile cert/server.crt
|
||||
certkey cert/server.key
|
||||
accesslog kore_access.log
|
||||
|
||||
static / page_handler
|
||||
static /post_back post_back
|
||||
|
||||
params get / {
|
||||
validate user v_user
|
||||
}
|
||||
|
||||
params post /post_back {
|
||||
validate user v_user
|
||||
}
|
||||
}
|
|
@ -195,7 +195,7 @@ run_curl(struct kore_task *t)
|
|||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, fields);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write_cb);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://127.0.0.1:4443/post_back");
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://127.0.0.1:8888/post_back");
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if (res != CURLE_OK) {
|
Loading…
Reference in New Issue