]> granicus.if.org Git - pdns/commitdiff
YaHTTP upgrade from upstream. Fixes f.ex. build on Solaris
authorAki Tuomi <cmouse@desteem.org>
Thu, 17 Jul 2014 10:36:11 +0000 (13:36 +0300)
committerAki Tuomi <cmouse@desteem.org>
Thu, 17 Jul 2014 10:36:11 +0000 (13:36 +0300)
pdns/ext/yahttp/yahttp/reqresp.hpp
pdns/ext/yahttp/yahttp/utility.hpp

index a66dcb622f3874587729975a19ef7ab72fdb65a6..29718806b76a46d3e08e78ab3253d8d7eb749fb2 100644 (file)
@@ -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
index 5a42e65ff9db5a04ff92e16babdbde5cc2f91a19..0242fbb8fb001cb2e16bb0a23c064d77ab79279f 100644 (file)
@@ -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)";
        }
      }; //<! parses HTTP Cookie date
 
@@ -168,10 +177,11 @@ namespace YaHTTP {
        tm.tm_hour = hours;
        tm.tm_min = minutes;
        tm.tm_sec = seconds;
+       tm.tm_isdst = 0;
 #ifdef HAVE_TM_GMTOFF
        tm.tm_gmtoff = utc_offset;
 #endif
-       return timelocal(&tm);
+       return mktime(&tm);
      }; //<! returns this datetime as unixtime. will not work for dates before 1970/1/1 00:00:00 GMT
   };