1
0
mirror of https://git.kore.io/kore.git synced 2024-11-11 04:39:00 +01:00
Commit Graph

145 Commits

Author SHA1 Message Date
Joris Vink
31d14d028a add compile-time configurable mime types.
these types are used for the new builtin asset_serve_* functions.

must be defined in conf/build.conf.
2016-12-26 23:37:05 +01:00
Joris Vink
d783a1d22d Add auto generated serving functions for assets.
These functions are created by the cli tool when building
and follow the naming format: asset_serve_<name>_<ext>().

Those serving functions can be used directly in handlers and
callthrough to a http_serveable() function that uses the SHA1
of the asset as its ETag and automatically checks for if-none-match.
2016-12-26 21:15:03 +01:00
Joris Vink
194b575ebf Add SHA1 digests for assets. 2016-12-22 19:44:35 +01:00
Tobias Kortkamp
950977f2be Fix fd leak in cli_buildopt_parse() (#156)
The build.conf file is left open when using kore run.
2016-12-01 09:01:51 +01:00
Joris Vink
43fec8678e kore_buf_create -> kore_buf_alloc. 2016-07-14 12:34:29 +02:00
Joris Vink
4ad50caa29 Large changes to the memory subsystem in kore.
- Change pools to use mmap() for allocating regions.
- Change kore_malloc() to use pools for commonly sized objects.
  (split into multiple of 2 buckets, starting at 8 bytes up to 8192).
- Rename kore_mem_free() to kore_free().

The preallocated pools will hold up to 128K of elements per block size.

In case a larger object is to be allocated kore_malloc() will use
malloc() instead.
2016-07-12 13:54:14 +02:00
Joris Vink
e96ed9ad66 Change default domain for kore create skeleton. 2016-07-07 12:36:08 +02:00
Joris Vink
39a5f21986 Allow "kore build" to produce single binaries.
Producing single binaries can now be done with building with
"kore build". To get started edit your build.conf and add the
following directives:

single_binary = yes
kore_source = /path/to/kore

optionally you can add kore_flavor to instruct how kore should
be built:

kore_flavor = NOTLS=1

When doing this your build.conf must also include the correct
linking options as the linking is now done fully by kore build.

The binary produced will include your configuration and takes
over a few of kore its command line flags (such as -f, -n or -r).
2016-07-06 16:16:15 +02:00
Joris Vink
589c7667be Cleanup cli.c a bit.
- Define CXXFLAGS_MAX as CFLAGS_MAX as we use CFLAGS_MAX usually.
- Fix formatting of a few blocks of code.
2016-06-29 16:25:52 +02:00
Corbin Hughes
91d29a9914 Better name consistency and only print CXXFLAGS if compiling C++ 2016-06-27 22:33:51 -05:00
Corbin Hughes
698b3f374f Compile and link C++ with g++ instead of gcc 2016-06-26 15:49:59 -05:00
Joris Vink
43a726c02d Use sys/types.h instead of sys/param.h for assets. 2016-06-23 16:18:36 +02:00
Joris Vink
2dfd22a79a Change kore_buf_stringify() a bit.
Takes a size_t pointer as its second argument now, if not
NULL this will be populated with the length of the string
that is being returned.
2016-06-02 07:08:19 +02:00
Joris Vink
40f69924bb Move shared file reading code to kore_read_line() 2016-02-01 22:10:10 +01:00
Joris Vink
c8484ee9ab Redo config parsing a bit.
No longer just call kore_string_split() on the line
but separate out the configuration directive and let
the appropriate callbacks parse things on their own.
2016-02-01 21:33:51 +01:00
Joris Vink
f4d00645ed Merge pull request #99 from oneswig/master
Add resource management as part of the kore shutdown process.
2016-02-01 19:51:27 +01:00
Joris Vink
1f5e482b8a Build option changes.
- Build with -O2 unless NOOPT is set to 1.
- Hide -g behind DEBUG instead of always building with it.
- Explicitely set the standard used to c99, use pedantic.
2016-02-01 15:33:40 +01:00
Stig Telfer
bd975541dd Merge branch 'master' into oneswig 2016-02-01 10:04:59 +00:00
Joris Vink
3284265b74 Remove the -v stuff and always show cflags and ldflags. 2016-01-27 21:37:59 +01:00
Joris Vink
b777ea65cd Long day .. actually add the new build flavor code. 2016-01-27 21:32:57 +01:00
Stig Telfer
2ac6e7d41d Merge branch 'master' into oneswig 2016-01-24 13:46:38 +00:00
Stig Telfer
ec73c35952 Add missing C library headers 2016-01-22 11:08:13 +00:00
Joris Vink
07ed037a00 Reduce memory footprint for NOTLS builds. 2016-01-07 09:20:09 +01:00
Dmitrii Golub
ab391df7ff Better CFLAGS and CFLAGS limit 2015-12-04 17:16:56 +03:00
Joris Vink
428802afc8 More cleanup after introducing NOHTTP=1.
* The cli tools must know when building as KORE_NO_HTTP.
* Reshuffle some structs around to avoid forward declarations.
* Move wscbs under !KORE_NO_HTTP as its for websockets.
* Remove unused members from struct connection.

Applications that use the connect callbacks for new connections
must now set the connection state themselves, see nohttp example.
2015-11-30 16:23:34 +01:00
Shih-Yuan Lee (FourDollars)
384ac824ee Fix typos. 2015-11-04 09:54:55 +08:00
Joris Vink
4dff0b57ae Add openssl paths for homebrew/ports for osx.
These are the default paths openssl should be installed under
for both projects. This at least kills the need for user CFLAGS
for a normal build.

Inspired by #70.
2015-06-28 13:43:01 +02:00
Joris Vink
63b0c0a903 Fix typo. 2015-06-14 17:21:16 +02:00
Joris Vink
db198578c6 Allow Kore to function under DragonflyBSD.
From David Carlier
2015-06-14 16:54:44 +02:00
Joris Vink
13795ead63 NetBSD fixes, from David Carlier. 2015-06-14 16:44:37 +02:00
Joris Vink
512e305e20 When building assets, skip empty files. 2015-06-11 19:33:30 +02:00
Joris Vink
81d119ff93 Let kore build pickup any environment CFLAGS. 2015-06-11 19:20:08 +02:00
Geenz
817b916e1f Call it NOTLS instead.
Per @jorisvink's feedback.
2015-05-25 09:42:34 -04:00
Geenz
c44de3f629 Rename BENCHMARK to reflect its actual function.
NO_SSL makes a bit more sense, especially for people who proxy their requests via nginx, apache, or similar.
2015-05-25 09:28:13 -04:00
Thordur Bjornsson
e47df37230 Make runas behave similarly to chroot.
Add new command line knob '-r', that disables runas similar to '-n',
it's implied as well for kore command runs.

Add default runas (nobody) user and chroot (/var/empty) path, if none
are specified, fallback to these.
2015-05-20 10:28:19 +02:00
Quentin PEREZ
e2e5631b8c add noreturn attribute
fix false-positive warning
2015-05-19 09:45:04 +02:00
Thordur I. Bjornsson
dcb0f458e7 set a wee bit saner umask 2015-05-09 12:14:49 +00:00
Thordur I. Bjornsson
bb6e2823a0 fix tyop 2015-05-08 14:53:59 +00:00
Thordur I. Bjornsson
9f823f345e no need to open cert/key files for read 2015-05-08 14:41:48 +00:00
Thordur I. Bjornsson
9418139c76 no need for execute bit in cli_file_open 2015-05-08 14:40:51 +00:00
Joris Vink
384bc8fdd6 Default to only TLSv1.2 from now on.
Add configuration setting tls_version to specify if you
either want TLSv1.2 or TLSv1.0 or both.

The configuration options ssl_cipher and ssl_dhparam
have changed name to tls_cipher and tls_dhparam. There is
no fallback so you might have to update your configs.
2015-05-06 10:59:43 +02:00
Joris Vink
48495feb43 No, I was wrong. The dh params were created in the right place. 2015-05-06 10:21:54 +02:00
Joris Vink
5b462f3ab6 Always attempt to create dh2048.pem if not present 2015-05-06 10:18:54 +02:00
Joris Vink
1fae259603 Use stat(2) to figure out type of directory entry.
readdir(2) might not be able to give back the correct
type in the d_type member and we should properly handle
the DT_UNKNOWN value anyway.

Fixes #39.
2015-04-07 09:27:58 +02:00
Joris Vink
3b7d8b29e6 Initialize has_cpp to 0. 2015-04-02 13:34:51 +02:00
Joris Vink
3a608a99bb Formatting and slight C++ build improvements.
Do not link against libstdc++ when not having any C++ files.
Let the compiler decide what subprocess to use for compiling
certain files, thus killing the CXX need. Can be overwritten
in the same old default in CC.
2015-04-02 13:33:52 +02:00
Geenz
6bd0da171d Always enable C++ support.
Per @jorisvink's suggestion.
2015-04-02 05:43:07 -04:00
Geenz
93fe8e6b42 Update Readmes 2015-04-01 21:39:40 -04:00
Geenz
eab769af6b Add support for selecting C++ dialect and lib.
Otherwise, assume libstdc++ and the compiler's default dialect.
2015-04-01 20:05:09 -04:00
Geenz
ba031d15de Sleep deprived typos are the best typos. 2015-04-01 19:28:26 -04:00
Geenz
5af3411513 Code style cleanup in C++ example. 2015-04-01 09:35:05 -04:00
Geenz
97ec644a9a Explicitly link libstdc++. 2015-04-01 08:32:24 -04:00
Geenz
86daf3f1b0 Add support for setting the C++ compiler.
Also make args a bit bigger.
2015-04-01 08:09:09 -04:00
Geenz
6b7f79f733 Wrap C++ support with KORE_CPP_SUPPORT 2015-04-01 07:02:53 -04:00
Geenz
45e9d26f48 Separate C and C++ files into their own lists. 2015-04-01 03:28:03 -04:00
Geenz
faa1cf60c4 Add a few useful C++ specific warnings. 2015-03-31 23:09:09 -04:00
Geenz
6e52c31d59 Include .cpp files when building.
This probably isn't an ideal way to add support for also compiling C++ in a project, but for now it works for my needs.
2015-03-31 03:17:33 -04:00
Joris Vink
6d90291405 Set rootdir earlier in cli_create(). 2015-02-06 09:02:52 +01:00
Joris Vink
12c07b79e6 Kill a warning when building with BENCHMARK 2015-02-04 19:40:49 +01:00
Joris Vink
2049bc72dc By default Kore now uses ECDH/DHE for TLS key exchanges.
This commit disables RSA key exchanges for TLS completely, while
introducing the requirement for always having DH parameters (ssl_dhparam).

Judging from ciphersuites most modern browsers now prefer this
change should be more than ok.
2015-02-03 13:17:59 +01:00
Andreas Pfohl
24e1d3928d Added ability to set path prefix during make. 2014-12-12 10:15:30 +01:00
Joris Vink
9184257d97 Properly order linker arguments.
Fixes broken linkages with LDFLAGS on certain platforms see #23.
2014-11-19 14:20:31 +01:00
Thordur Bjornsson
e980dcdd5c Simplify environment variables, abide by POLA.
KORE_COMPILER => CC
KORE_LDFLAGS => LDFLAGS
2014-10-22 17:44:43 +02:00
Joris Vink
523bc521c7 Generate certs with sha256 digests from now on. 2014-10-18 01:28:47 +02:00
Joris Vink
0909e6bac1 Write our assets.h with a fixed include guard. 2014-09-26 15:50:56 +02:00
Joris Vink
f73557c545 Use proper error message 2014-09-19 15:01:56 +02:00
Joris Vink
71fb54aab7 Replace - as well when building asset names 2014-08-21 23:06:54 +02:00
Joris Vink
69f98ef158 Add root/src/includes as an include path when building 2014-08-18 18:56:22 +02:00
Joris Vink
68e0697f2e s/appl/rootdir in cli_compile_file 2014-08-18 15:31:10 +02:00
Joris Vink
83a16763c8 Always NUL-terminate an asset its data.
This way developers can cast assets to char * without first
having to convert it to a proper C string.

The NUL character is NOT included in the length of the asset.
2014-08-18 13:57:06 +02:00
Joris Vink
2e7d6a12a9 closedir() when we're ready traversing it 2014-08-13 14:32:57 +02:00
Joris Vink
0b907312ef let kore build generate certs with a more unique issuer
also fix spacing and asset print information.
2014-08-11 16:11:37 +02:00
Joris Vink
d74f039a0c When building assets replace bad characters with an underscore 2014-08-11 13:08:26 +02:00
Joris Vink
b27322933b The default pid file is kore.pid so no need to set that explicitely 2014-08-05 13:11:53 +02:00
Joris Vink
577462379d Deprecate ssl_no_compression config option, its always on. 2014-08-05 13:07:32 +02:00
Joris Vink
d39246e0e2 static.h -> assets.h 2014-08-03 18:22:12 +02:00
Joris Vink
3bb77bbb9f Even if we skip files to be built, they still gotta be linked in 2014-08-03 18:18:48 +02:00
Joris Vink
e906aab445 Be careful that f isn't uninitialized 2014-08-03 17:50:04 +02:00
Joris Vink
f4f8b1e8b0 Allow users to set ldflags via KORE_LDFLAGS 2014-08-03 17:44:29 +02:00
Joris Vink
2b40672ba1 When compiling with PGSQL, note the include dir for "kore build" 2014-08-03 17:33:40 +02:00
Joris Vink
73b0569fe0 Missing fclose() 2014-08-03 17:17:11 +02:00
Joris Vink
93fd33e00e Big changes to how we handle "static" files.
* Rename static files to assets
* static_* has become asset_*
* Always generate asset.h with the right external symbols
2014-08-03 16:55:16 +02:00
Joris Vink
380b7dc1d7 Improvement on the cli commands a bit.
* kore build will now only rebuild what was changed (checking on
  last modified timestamp, not 100% accurate but it'll do).

* introduce kore clean which cleans out object files and the
  resulting .so file
2014-08-03 16:36:16 +02:00
Joris Vink
e74921222c Check if conf/appl.conf exists before continuing with build or run 2014-08-03 15:30:53 +02:00
Joris Vink
f538e92172 Correct typo 2014-08-03 15:22:08 +02:00
Joris Vink
a2897f790c Better sane defaults for kore build (gen certs + ssl_no_compression) 2014-08-03 15:17:03 +02:00
Joris Vink
5b8c880a62 Don't write the static output to a tmp buf, just write it to disk 2014-08-01 20:25:02 +02:00
Joris Vink
23164f636f Sprinkle KORE_BENCHMARK through cli.c 2014-08-01 17:17:34 +02:00
Joris Vink
38edc7d23b Add a warning about the generated certificates 2014-08-01 17:13:38 +02:00
Joris Vink
47ad4fbc28 Have "kore build" generate temp certs as well 2014-08-01 17:10:47 +02:00
Joris Vink
448f1a7912 Don't run cli_cleanup_files() in cli_fatal if theres no rootdir 2014-08-01 16:39:12 +02:00
Joris Vink
67c3bd84ba Make cli compile under freebsd 2014-08-01 16:01:33 +02:00
Joris Vink
e29a5461ca Allow kore build to compile static files 2014-08-01 15:55:09 +02:00
Joris Vink
5d8c29af13 Allow kore build to take compiler via KORE_COMPILER 2014-08-01 14:09:57 +02:00
Joris Vink
ea5b89d20b Move orbit functionality into kore directly.
Makes more sense and reads easier:

kore create myapp
kore build myapp
kore run myapp

Note that kore retains its cli options (if no command was given),
meaning you can still start kore in the traditional way as well.

The command options are simply to make development easier.
2014-08-01 13:59:47 +02:00