From: Aki Tuomi Date: Thu, 17 Jul 2014 10:36:11 +0000 (+0300) Subject: YaHTTP upgrade from upstream. Fixes f.ex. build on Solaris X-Git-Tag: auth-3.4.0-rc1~72^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=084c477242b1dc58aed2bf9dcf513e223052cd42;p=pdns YaHTTP upgrade from upstream. Fixes f.ex. build on Solaris --- diff --git a/pdns/ext/yahttp/yahttp/reqresp.hpp b/pdns/ext/yahttp/yahttp/reqresp.hpp index a66dcb622..29718806b 100644 --- a/pdns/ext/yahttp/yahttp/reqresp.hpp +++ b/pdns/ext/yahttp/yahttp/reqresp.hpp @@ -97,7 +97,8 @@ protected: this->method = rhs.method; this->headers = rhs.headers; this->jar = rhs.jar; this->postvars = rhs.postvars; this->parameters = rhs.parameters; this->getvars = rhs.getvars; - this->body = rhs.body; + this->body = rhs.body; this->max_request_size = rhs.max_request_size; + this->max_response_size = rhs.max_response_size; #ifdef HAVE_CPP_FUNC_PTR this->renderer = rhs.renderer; #endif @@ -108,7 +109,8 @@ protected: this->method = rhs.method; this->headers = rhs.headers; this->jar = rhs.jar; this->postvars = rhs.postvars; this->parameters = rhs.parameters; this->getvars = rhs.getvars; - this->body = rhs.body; + this->body = rhs.body; this->max_request_size = rhs.max_request_size; + this->max_response_size = rhs.max_response_size; #ifdef HAVE_CPP_FUNC_PTR this->renderer = rhs.renderer; #endif diff --git a/pdns/ext/yahttp/yahttp/utility.hpp b/pdns/ext/yahttp/yahttp/utility.hpp index 5a42e65ff..0242fbb8f 100644 --- a/pdns/ext/yahttp/yahttp/utility.hpp +++ b/pdns/ext/yahttp/yahttp/utility.hpp @@ -45,16 +45,20 @@ namespace YaHTTP { struct tm tm; localtime_r(&t, &tm); fromTm(&tm); -#ifndef HAVE_TM_GMTOFF - time_t t2 = timegm(&tm); -#endif #else struct tm *tm; tm = localtime(&t); fromTm(tm); -#ifndef HAVE_TM_GMTOFF - time_t t2 = timegm(tm); -#endif +# ifndef HAVE_TM_GMTOFF + time_t t2; +# ifdef HAVE_LOCALTIME_R + gmtime_r(&t, &tm); + t2 = mktime(&tm); +# else + tm = gmtime(&t); + t2 = mktime(tm); +# endif +# endif #endif #ifndef HAVE_TM_GMTOFF this->utc_offset = ((t2-t)/10)*10; // removes any possible differences. @@ -153,10 +157,15 @@ namespace YaHTTP { void parseCookie(const std::string &cookie_date) { struct tm tm; - if ( (strptime(cookie_date.c_str(), "%d-%b-%Y %T %Z", &tm)) != NULL) { + const char *ptr; + if ( (ptr = strptime(cookie_date.c_str(), "%d-%b-%Y %T", &tm)) != NULL) { + while(*ptr && ( ::isspace(*ptr) || ::isalnum(*ptr) )) ptr++; + std::cerr << ptr << std::endl; + if (*ptr) throw "Unparseable date (non-final)"; // must be final. fromTm(&tm); + this->utc_offset = 0; } else { - throw "Unparseable date"; + throw "Unparseable date (did not match pattern cookie)"; } }; //