author | Michael Krelin <hacker@klever.net> | 2020-10-07 22:52:19 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2020-10-07 22:52:19 (UTC) |
commit | c561689bf162fb22997bd88f4392f222f151c950 (patch) (side-by-side diff) | |
tree | ce4656e92c379f7089f4bb72a4b10d781b61211e | |
parent | 3a4530372bc95d728dbddbac788f2c1f2d03a030 (diff) | |
download | kingate-master.zip kingate-master.tar.gz kingate-master.tar.bz2 |
-rw-r--r-- | src/cgi_gateway.cc | 1 | ||||
-rw-r--r-- | src/fastcgi.cc | 1 | ||||
-rw-r--r-- | src/plaincgi.cc | 1 | ||||
-rw-r--r-- | src/util.cc | 1 |
4 files changed, 4 insertions, 0 deletions
diff --git a/src/cgi_gateway.cc b/src/cgi_gateway.cc index a2681aa..3763654 100644 --- a/src/cgi_gateway.cc +++ b/src/cgi_gateway.cc @@ -1,27 +1,28 @@ #include <errno.h> #include <ctype.h> #include <sstream> +#include <cstring> #include "kingate/cgi_gateway.h" #include "kingate/util.h" #include "kingate/exception.h" #include "config.h" #ifdef HAVE_MIMETIC # include <mimetic/mimeentity.h> # include <mimetic/parser/itparser.h> #endif /* HAVE_MIMETIC */ namespace kingate { #ifdef HAVE_MIMETIC using mimetic::MimeEntity; struct TornMimeEntity : public MimeEntity { typedef istreambuf_iterator<char> it_type; typedef it_type::iterator_category it_cat; struct IParser : public mimetic::IteratorParser<it_type,it_cat> { typedef mimetic::IteratorParser<it_type,it_cat> BT; IParser(MimeEntity& me) : BT::IteratorParser<it_type,it_cat>(me) { } void loadHeader(it_type bit,it_type eit) { m_bit = bit; m_eit = eit; BT::loadHeader(); diff --git a/src/fastcgi.cc b/src/fastcgi.cc index 8b7668c..5a6c081 100644 --- a/src/fastcgi.cc +++ b/src/fastcgi.cc @@ -1,27 +1,28 @@ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> +#include <cstring> #include "kingate/fastcgi.h" #include "kingate/exception.h" namespace kingate { bool fcgi_socket::_initialized = false; fcgi_socket::fcgi_socket(const char *s,int bl) : sock(-1) { if(!_initialized) { if( FCGX_Init() ) throw exception(CODEPOINT,"failed to FCGX_Init()"); _initialized = true; } sock = FCGX_OpenSocket(s,bl); if(sock<0) throw exception(CODEPOINT,"failed to FCGX_OpenSocket("); // TODO: check if there is a ':', not if it starts with ':' if(*s != ':') if(chmod(s,0777)) // XXX: configurable. throw exception(CODEPOINT,"failed to chmod()"); } fcgi_socket::fcgi_socket(int s) : sock(0) { diff --git a/src/plaincgi.cc b/src/plaincgi.cc index 1cb7dc6..3a82d33 100644 --- a/src/plaincgi.cc +++ b/src/plaincgi.cc @@ -1,27 +1,28 @@ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> +#include <cstring> #include "kingate/plaincgi.h" #include "kingate/exception.h" #include "config.h" #if !HAVE_DECL_ENVIRON extern char **environ; #endif /* HAVE_DECL_ENVIRON */ namespace kingate { plaincgi_interface::plaincgi_interface() { for(char **p = environ; *p; p++) { const char *e = strchr(*p,'='); if(!e){ // XXX: check if we have it already? metavars[*p] = string(0); }else{ int l = e-*p; e++; // XXX: check if we have it already? metavars[string(*p,l)]=e; } } } plaincgi_interface::~plaincgi_interface() { diff --git a/src/util.cc b/src/util.cc index 48e486a..76e684f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1,24 +1,25 @@ +#include <cstring> #include "kingate/util.h" #include "kingate/exception.h" namespace kingate { static const char *safeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "_-" ; string url_encode(const string& str) { string rv = str; string::size_type screwed = 0; for(;;) { screwed = rv.find_first_not_of(safeChars,screwed); if(screwed == string::npos) break; while(screwed<rv.length() && !strchr(safeChars,rv.at(screwed))) { char danger = rv.at(screwed); if(danger==' ') { rv.replace(screwed++,1,1,'+'); }else{ static char tmp[4] = {'%',0,0,0}; |