commit - b20335632804754482ef930b97f325c08c4ac8fc
commit + bce8f2740bc3c255439257893c9c6f724feb4689
blob - 8931ba4f492fc02e35c0967addd746637eaa662b
blob + acdaaf481179d4a060644166f0198c5d07b1e9d2
--- Makefile
+++ Makefile
${MAKE} -C vostokd
run_server: server
- ./vostokd/vostokd -c cert/server.crt -k cert/server.key -f static/
+ ./vostokd/vostokd -c cert/server.crt -k cert/server.key -f ./
blob - e124e72c5414367ddacc70318254ba0945a59634
blob + 2b7e140a4af8327c021ece421a7e4c429784072e
--- shared/cut_null
+++ shared/cut_null
/** Remove null terminating character */
+#include "span"
#pragma once
/** Remove null terminating character and return as span */
-template <size_t N>
+template <std::size_t N>
constexpr span<const char> cut_null(const char (&arr)[N])
{
static_assert(N > 0, "!(N > 0)");
blob - 611e231ad28b76cc73de58ba46028d9a0be60ff0
blob + 5ce2750cbb1b144ccd61629648a261139e086a47
--- shared/span
+++ shared/span
constexpr span() : m_p{nullptr}, m_count{0} {}
- constexpr span(element_type *p, size_t count) : m_p{count ? p : nullptr}, m_count{count} {}
- template <size_t N>
+ constexpr span(element_type *p, std::size_t count) : m_p{count ? p : nullptr}, m_count{count} {}
+ template <std::size_t N>
constexpr span(element_type (&arr)[N]) : m_p{arr}, m_count{N} {}
- template <size_t N>
+ template <std::size_t N>
constexpr span(std::array<element_type, N> &arr) : m_p{arr.data()}, m_count{N} {}
- constexpr size_t size() const {return m_count;}
+ constexpr std::size_t size() const {return m_count;}
constexpr iterator begin() const noexcept { return m_p; }
constexpr iterator end() const noexcept { return m_p + size(); }
- span<element_type> first(size_t count) const
+ span<element_type> first(std::size_t count) const
{
assert(count <= m_count);
return span<element_type>{m_p, count};
}
- span<element_type> subspan(size_t offset) const
+ span<element_type> subspan(std::size_t offset) const
{
assert(offset <= m_count);
return (offset < m_count) ? span<element_type>{m_p + offset, m_count - offset} : span<element_type>{};
}
- element_type &operator[](size_t idx) const
+ element_type &operator[](std::size_t idx) const
{
assert(idx < m_count);
return m_p[idx];
private:
element_type *m_p;
- size_t m_count;
+ std::size_t m_count;
};
} // namespace vostok
blob - c842f06d2f8051e40b5b6eafeeb763195a489e99
blob + f235e457c38976fd348742488c27f7759fb7dc42
--- shared/transport.h
+++ shared/transport.h
#include "span"
#include "gemini.h"
+#include <memory>
#include <tls.h>
#pragma once
blob - /dev/null
blob + cdb10cb45e220ca09bf2a04fb0a76a8425c2333b (mode 644)
--- /dev/null
+++ reports/0.0.1.gmi
+# vostokd: gemini-сервер статического контента
+
+...work-in-progress...
+
+
+```
+$ mkdir cert && cd cert
+cert$ openssl req -newkey rsa:4096 -nodes -keyout server.key -x509 -days 36500 -out server.crt
+```
blob - 7f0db3126308ca3ba1c2e678fd46892699271d92 (mode 644)
blob + /dev/null
--- static/reports/0.0.1.gmi
+++ /dev/null
-# vostokd: gemini-сервер статического контента
-
-...work-in-progress...
blob - 673540d1db66509e57e5ec76656eeadd308f3a3f
blob + 057a3719306c47d8e9a791269e7d309159e70709
--- vostokd/Makefile
+++ vostokd/Makefile
-CXXFLAGS = -Wall -Wextra -std=c++11
-CXXFLAGS += -I${.CURDIR}/../shared
-CXXFLAGS += -ltls
+CXXFLAGS = -Wall -Wextra -std=c++11 -I../shared
+LIBS = -ltls
CXXFILES = vostokd.cc
-HXXFILES = ${.PATH}../shared/not_null
-HXXFILES += ${.PATH}../shared/zstring
-HXXFILES += ${.PATH}../shared/unique_fd
-HXXFILES += ${.PATH}../shared/non_copiable
-HXXFILES += ${.PATH}../shared/unique_fd
-HXXFILES += ${.PATH}../shared/span
-HXXFILES += ${.PATH}../shared/cut_null
-CXXFILES += ${.PATH}../shared/transport.cc
-HXXFILES += ${.PATH}../shared/transport.h
-CXXFILES += ${.PATH}../shared/error.cc
-HXXFILES += ${.PATH}../shared/error.h
-CXXFILES += ${.PATH}../shared/gemini.cc
-HXXFILES += ${.PATH}../shared/gemini.h
+HXXFILES = ../shared/not_null
+HXXFILES += ../shared/zstring
+HXXFILES += ../shared/unique_fd
+HXXFILES += ../shared/non_copiable
+HXXFILES += ../shared/unique_fd
+HXXFILES += ../shared/span
+HXXFILES += ../shared/cut_null
+CXXFILES += ../shared/transport.cc
+HXXFILES += ../shared/transport.h
+CXXFILES += ../shared/error.cc
+HXXFILES += ../shared/error.h
+CXXFILES += ../shared/gemini.cc
+HXXFILES += ../shared/gemini.h
CXXFILES += command_line_arguments.cc
HXXFILES += command_line_arguments.h
CXXFILES += url_normalization.cc
HXXFILES += url_normalization.h
vostokd: ${CXXFILES} ${HXXFILES}
- ${CXX} ${CXXFLAGS} ${CXXFILES} -o vostokd
+ ${CXX} ${CXXFLAGS} ${CXXFILES} ${LIBS} -o vostokd