_ZN6YaHTTP6CookieC2Ev:
    5|  6.14k|     Cookie() {
    6|  6.14k|       secure = false;
    7|  6.14k|       httponly = false;
    8|  6.14k|       name = value = "";
    9|  6.14k|       expires = DateTime();
   10|  6.14k|     }; //!< Set the cookie to empty value
_ZN6YaHTTP9CookieJar12keyValuePairERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERS7_SA_:
   75|  11.5k|    void keyValuePair(const std::string &keyvalue, std::string &key, std::string &value) {
   76|  11.5k|      size_t pos;
   77|  11.5k|      pos = keyvalue.find("=");
   78|  11.5k|      if (pos == std::string::npos) throw ParseError("Not a Key-Value pair (cookie)");
  ------------------
  |  Branch (78:11): [True: 57, False: 11.4k]
  ------------------
   79|  11.4k|      key = std::string(keyvalue.begin(), keyvalue.begin()+pos);
   80|  11.4k|      value = std::string(keyvalue.begin()+pos+1, keyvalue.end());
   81|  11.4k|    } //<! key value pair parser
_ZN6YaHTTP9CookieJar17parseCookieHeaderERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   83|  2.08k|    void parseCookieHeader(const std::string &cookiestr) {
   84|  2.08k|      size_t pos, npos;
   85|  2.08k|      std::list<Cookie> lcookies;
   86|  2.08k|      Cookie c;
   87|  2.08k|      pos = 0;
   88|  13.6k|      while(pos < cookiestr.size()) {
  ------------------
  |  Branch (88:13): [True: 11.5k, False: 2.08k]
  ------------------
   89|  11.5k|        if ((npos = cookiestr.find("; ", pos)) == std::string::npos)
  ------------------
  |  Branch (89:13): [True: 1.84k, False: 9.71k]
  ------------------
   90|  1.84k|          npos = cookiestr.size();
   91|  11.5k|        keyValuePair(cookiestr.substr(pos, npos-pos), c.name, c.value);
   92|  11.5k|        c.name = YaHTTP::Utility::decodeURL(c.name);
   93|  11.5k|        c.value = YaHTTP::Utility::decodeURL(c.value);
   94|  11.5k|        lcookies.push_back(c);
   95|  11.5k|        pos = npos+2;
   96|  11.5k|      }
   97|  12.6k|      for(std::list<Cookie>::iterator i = lcookies.begin(); i != lcookies.end(); i++) {
  ------------------
  |  Branch (97:61): [True: 10.5k, False: 2.08k]
  ------------------
   98|  10.5k|        this->cookies[i->name] = *i;
   99|  10.5k|      }
  100|  2.08k|    }

_ZN6YaHTTP5ErrorC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
    9|    372|    Error(const std::string& reason_): reason(reason_) {};
_ZN6YaHTTP5ErrorD2Ev:
   10|    372|    virtual ~Error() throw() {};
_ZN6YaHTTP10ParseErrorC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|    372|    ParseError(const std::string& reason_): Error(reason_) {};

_ZN6YaHTTP7isspaceEc:
    8|  6.73M|  bool isspace(char c) {
    9|  6.73M|    return std::isspace(c) != 0;
   10|  6.73M|  }
_ZN6YaHTTP7isspaceEcRKNSt3__16localeE:
   12|  14.1k|  bool isspace(char c, const std::locale& loc) {
   13|  14.1k|    return std::isspace(c, loc);
   14|  14.1k|  }
_ZN6YaHTTP11AsyncLoaderINS_7RequestEE4feedERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   41|  3.23k|  bool AsyncLoader<T>::feed(const std::string& somedata) {
   42|  3.23k|    buffer.append(somedata);
   43|  23.3k|    while(state < 2) {
  ------------------
  |  Branch (43:11): [True: 23.3k, False: 65]
  ------------------
   44|  23.3k|      int cr=0;
   45|  23.3k|      pos = buffer.find_first_of("\n");
   46|       |      // need to find CRLF in buffer
   47|  23.3k|      if (pos == std::string::npos) return false;
  ------------------
  |  Branch (47:11): [True: 2.06k, False: 21.2k]
  ------------------
   48|  21.2k|      if (pos>0 && buffer[pos-1]=='\r')
  ------------------
  |  Branch (48:11): [True: 18.3k, False: 2.92k]
  |  Branch (48:20): [True: 208, False: 18.1k]
  ------------------
   49|    208|        cr=1;
   50|  21.2k|      std::string line(buffer.begin(), buffer.begin()+pos-cr); // exclude CRLF
   51|  21.2k|      buffer.erase(buffer.begin(), buffer.begin()+pos+1); // remove line from buffer including CRLF
   52|       |
   53|  21.2k|      if (state == 0) { // startup line
  ------------------
  |  Branch (53:11): [True: 3.22k, False: 18.0k]
  ------------------
   54|  3.22k|        if (target->kind == YAHTTP_TYPE_REQUEST) {
  ------------------
  |  |   31|  3.22k|#define YAHTTP_TYPE_REQUEST 1
  ------------------
  |  Branch (54:13): [True: 3.22k, False: 0]
  ------------------
   55|  3.22k|          std::string ver;
   56|  3.22k|          std::string tmpurl;
   57|  3.22k|          std::istringstream iss(line);
   58|  3.22k|          iss >> target->method >> tmpurl >> ver;
   59|  3.22k|          if (ver.size() == 0)
  ------------------
  |  Branch (59:15): [True: 3.04k, False: 178]
  ------------------
   60|  3.04k|            target->version = 9;
   61|    178|          else if (ver.find("HTTP/0.9") == 0)
  ------------------
  |  Branch (61:20): [True: 2, False: 176]
  ------------------
   62|      2|            target->version = 9;
   63|    176|          else if (ver.find("HTTP/1.0") == 0)
  ------------------
  |  Branch (63:20): [True: 1, False: 175]
  ------------------
   64|      1|            target->version = 10;
   65|    175|          else if (ver.find("HTTP/1.1") == 0)
  ------------------
  |  Branch (65:20): [True: 2, False: 173]
  ------------------
   66|      2|            target->version = 11;
   67|    173|          else
   68|    173|            throw ParseError("HTTP version not supported");
   69|       |          // uppercase the target method
   70|  3.04k|          std::transform(target->method.begin(), target->method.end(), target->method.begin(), ::toupper);
   71|  3.04k|          target->url.parse(tmpurl);
   72|  3.04k|          target->getvars = Utility::parseUrlParameters(target->url.parameters);
   73|  3.04k|          state = 1;
   74|  3.04k|        } else if(target->kind == YAHTTP_TYPE_RESPONSE) {
  ------------------
  |  |   32|      0|#define YAHTTP_TYPE_RESPONSE 2
  ------------------
  |  Branch (74:19): [True: 0, False: 0]
  ------------------
   75|      0|          std::string ver;
   76|      0|          std::istringstream iss(line);
   77|      0|          std::string::size_type pos1;
   78|      0|          iss >> ver >> target->status;
   79|      0|          std::getline(iss, target->statusText);
   80|      0|          pos1=0;
   81|      0|          while(pos1 < target->statusText.size() && YaHTTP::isspace(target->statusText.at(pos1))) pos1++;
  ------------------
  |  Branch (81:17): [True: 0, False: 0]
  |  Branch (81:53): [True: 0, False: 0]
  ------------------
   82|      0|          target->statusText = target->statusText.substr(pos1); 
   83|      0|          if ((pos1 = target->statusText.find("\r")) != std::string::npos) {
  ------------------
  |  Branch (83:15): [True: 0, False: 0]
  ------------------
   84|      0|            target->statusText = target->statusText.substr(0, pos1-1);
   85|      0|          }
   86|      0|          if (ver.size() == 0) {
  ------------------
  |  Branch (86:15): [True: 0, False: 0]
  ------------------
   87|      0|            target->version = 9;
   88|      0|          } else if (ver.find("HTTP/0.9") == 0)
  ------------------
  |  Branch (88:22): [True: 0, False: 0]
  ------------------
   89|      0|            target->version = 9;
   90|      0|          else if (ver.find("HTTP/1.0") == 0)
  ------------------
  |  Branch (90:20): [True: 0, False: 0]
  ------------------
   91|      0|            target->version = 10;
   92|      0|          else if (ver.find("HTTP/1.1") == 0)
  ------------------
  |  Branch (92:20): [True: 0, False: 0]
  ------------------
   93|      0|            target->version = 11;
   94|      0|          else
   95|      0|            throw ParseError("HTTP version not supported");
   96|      0|          state = 1;
   97|      0|        }
   98|  18.0k|      } else if (state == 1) {
  ------------------
  |  Branch (98:18): [True: 18.0k, False: 0]
  ------------------
   99|  18.0k|        std::string key,value;
  100|  18.0k|        size_t pos1;
  101|  18.0k|        if (line.empty()) {
  ------------------
  |  Branch (101:13): [True: 911, False: 17.1k]
  ------------------
  102|    911|          chunked = (target->headers.find("transfer-encoding") != target->headers.end() && target->headers["transfer-encoding"] == "chunked");
  ------------------
  |  Branch (102:22): [True: 330, False: 581]
  |  Branch (102:92): [True: 292, False: 38]
  ------------------
  103|    911|          state = 2;
  104|    911|          break;
  105|    911|        }
  106|       |        // split headers
  107|  17.1k|        if ((pos1 = line.find(":")) == std::string::npos) {
  ------------------
  |  Branch (107:13): [True: 14, False: 17.1k]
  ------------------
  108|     14|          throw ParseError("Malformed header line");
  109|     14|        }
  110|  17.1k|        key = line.substr(0, pos1);
  111|  17.1k|        value = line.substr(pos1 + 1);
  112|  6.75M|        for(std::string::iterator it=key.begin(); it != key.end(); it++)
  ------------------
  |  Branch (112:51): [True: 6.73M, False: 17.1k]
  ------------------
  113|  6.73M|          if (YaHTTP::isspace(*it))
  ------------------
  |  Branch (113:15): [True: 7, False: 6.73M]
  ------------------
  114|      7|            throw ParseError("Header key contains whitespace which is not allowed by RFC");
  115|       |
  116|  17.1k|        Utility::trim(value);
  117|  17.1k|        std::transform(key.begin(), key.end(), key.begin(), ::tolower);
  118|       |        // is it already defined
  119|       |
  120|  17.1k|        if (key == "set-cookie" && target->kind == YAHTTP_TYPE_RESPONSE) {
  ------------------
  |  |   32|    199|#define YAHTTP_TYPE_RESPONSE 2
  ------------------
  |  Branch (120:13): [True: 199, False: 16.9k]
  |  Branch (120:36): [True: 0, False: 199]
  ------------------
  121|      0|          target->jar.parseSetCookieHeader(value);
  122|  17.1k|        } else if (key == "cookie" && target->kind == YAHTTP_TYPE_REQUEST) {
  ------------------
  |  |   31|  2.08k|#define YAHTTP_TYPE_REQUEST 1
  ------------------
  |  Branch (122:20): [True: 2.08k, False: 15.0k]
  |  Branch (122:39): [True: 2.08k, False: 0]
  ------------------
  123|  2.08k|          target->jar.parseCookieHeader(value);
  124|  15.0k|        } else {
  125|  15.0k|          if (key == "host" && target->kind == YAHTTP_TYPE_REQUEST) {
  ------------------
  |  |   31|  1.13k|#define YAHTTP_TYPE_REQUEST 1
  ------------------
  |  Branch (125:15): [True: 1.13k, False: 13.8k]
  |  Branch (125:32): [True: 1.13k, False: 0]
  ------------------
  126|       |            // maybe it contains port?
  127|  1.13k|            if ((pos1 = value.find(":")) == std::string::npos) {
  ------------------
  |  Branch (127:17): [True: 473, False: 664]
  ------------------
  128|    473|              target->url.host = value;
  129|    664|            } else {
  130|    664|              target->url.host = value.substr(0, pos1);
  131|    664|              target->url.port = ::atoi(value.substr(pos1).c_str());
  132|    664|            }
  133|  1.13k|          }
  134|  15.0k|          if (target->headers.find(key) != target->headers.end()) {
  ------------------
  |  Branch (134:15): [True: 6.36k, False: 8.65k]
  ------------------
  135|  6.36k|            target->headers[key] = target->headers[key] + ";" + value;
  136|  8.65k|          } else {
  137|  8.65k|            target->headers[key] = value;
  138|  8.65k|          }
  139|  15.0k|        }
  140|  17.1k|      }
  141|  21.2k|    }
  142|       |
  143|    976|    minbody = 0;
  144|       |    // check for expected body size
  145|    976|    if (target->kind == YAHTTP_TYPE_REQUEST) maxbody = target->max_request_size;
  ------------------
  |  |   31|    976|#define YAHTTP_TYPE_REQUEST 1
  ------------------
  |  Branch (145:9): [True: 911, False: 65]
  ------------------
  146|     65|    else if (target->kind == YAHTTP_TYPE_RESPONSE) maxbody = target->max_response_size;
  ------------------
  |  |   32|     65|#define YAHTTP_TYPE_RESPONSE 2
  ------------------
  |  Branch (146:14): [True: 0, False: 65]
  ------------------
  147|     65|    else maxbody = 0;
  148|       |
  149|    976|    if (!chunked) {
  ------------------
  |  Branch (149:9): [True: 619, False: 357]
  ------------------
  150|    619|      if (target->headers.find("content-length") != target->headers.end()) {
  ------------------
  |  Branch (150:11): [True: 410, False: 209]
  ------------------
  151|    410|        std::istringstream maxbodyS(target->headers["content-length"]);
  152|    410|        maxbodyS >> minbody;
  153|    410|        maxbody = minbody;
  154|    410|      }
  155|    619|      if (minbody < 1) return true; // guess there isn't anything left.
  ------------------
  |  Branch (155:11): [True: 231, False: 388]
  ------------------
  156|    388|      if (target->kind == YAHTTP_TYPE_REQUEST && static_cast<ssize_t>(minbody) > target->max_request_size) throw ParseError("Max request body size exceeded");
  ------------------
  |  |   31|    776|#define YAHTTP_TYPE_REQUEST 1
  ------------------
  |  Branch (156:11): [True: 388, False: 0]
  |  Branch (156:50): [True: 71, False: 317]
  ------------------
  157|    317|      else if (target->kind == YAHTTP_TYPE_RESPONSE && static_cast<ssize_t>(minbody) > target->max_response_size) throw ParseError("Max response body size exceeded");
  ------------------
  |  |   32|    634|#define YAHTTP_TYPE_RESPONSE 2
  ------------------
  |  Branch (157:16): [True: 0, False: 317]
  |  Branch (157:56): [True: 0, False: 0]
  ------------------
  158|    388|    }
  159|       |
  160|    674|    if (maxbody == 0) hasBody = false;
  ------------------
  |  Branch (160:9): [True: 0, False: 674]
  ------------------
  161|    674|    else hasBody = true;
  162|       |
  163|    674|    if (buffer.size() == 0) return ready();
  ------------------
  |  Branch (163:9): [True: 109, False: 565]
  ------------------
  164|       |
  165|  4.14k|    while(buffer.size() > 0) {
  ------------------
  |  Branch (165:11): [True: 3.80k, False: 340]
  ------------------
  166|  3.80k|      if (chunked) {
  ------------------
  |  Branch (166:11): [True: 3.59k, False: 209]
  ------------------
  167|  3.59k|        if (chunk_size == 0) {
  ------------------
  |  Branch (167:13): [True: 1.86k, False: 1.73k]
  ------------------
  168|  1.86k|          char buf[100];
  169|       |          // read chunk length
  170|  1.86k|          if ((pos = buffer.find('\n')) == std::string::npos) return false;
  ------------------
  |  Branch (170:15): [True: 7, False: 1.85k]
  ------------------
  171|  1.85k|          if (pos > 99)
  ------------------
  |  Branch (171:15): [True: 34, False: 1.82k]
  ------------------
  172|     34|            throw ParseError("Impossible chunk_size");
  173|  1.82k|          buffer.copy(buf, pos);
  174|  1.82k|          buf[pos]=0; // just in case...
  175|  1.82k|          buffer.erase(buffer.begin(), buffer.begin()+pos+1); // remove line from buffer
  176|  1.82k|          if (sscanf(buf, "%x", &chunk_size) != 1) {
  ------------------
  |  Branch (176:15): [True: 16, False: 1.80k]
  ------------------
  177|     16|            throw ParseError("Unable to parse chunk size");
  178|     16|          }
  179|  1.80k|          if (chunk_size == 0) { state = 3; break; } // last chunk
  ------------------
  |  Branch (179:15): [True: 11, False: 1.79k]
  ------------------
  180|  1.80k|        } else {
  181|  1.73k|          int crlf=1;
  182|  1.73k|          if (buffer.size() < static_cast<size_t>(chunk_size+1)) return false; // expect newline
  ------------------
  |  Branch (182:15): [True: 94, False: 1.63k]
  ------------------
  183|  1.63k|          if (buffer.at(chunk_size) == '\r') {
  ------------------
  |  Branch (183:15): [True: 381, False: 1.25k]
  ------------------
  184|    381|            if (buffer.size() < static_cast<size_t>(chunk_size+2) || buffer.at(chunk_size+1) != '\n') return false; // expect newline after carriage return
  ------------------
  |  Branch (184:17): [True: 5, False: 376]
  |  Branch (184:70): [True: 13, False: 363]
  ------------------
  185|    363|            crlf=2;
  186|  1.25k|          } else if (buffer.at(chunk_size) != '\n') return false;
  ------------------
  |  Branch (186:22): [True: 18, False: 1.24k]
  ------------------
  187|  1.60k|          std::string tmp = buffer.substr(0, chunk_size);
  188|  1.60k|          buffer.erase(buffer.begin(), buffer.begin()+chunk_size+crlf);
  189|  1.60k|          bodybuf << tmp;
  190|  1.60k|          chunk_size = 0;
  191|  1.60k|          if (buffer.size() == 0) break; // just in case
  ------------------
  |  Branch (191:15): [True: 27, False: 1.57k]
  ------------------
  192|  1.60k|        }
  193|  3.59k|      } else {
  194|    209|        if (bodybuf.str().length() + buffer.length() > maxbody)
  ------------------
  |  Branch (194:13): [True: 19, False: 190]
  ------------------
  195|     19|          bodybuf << buffer.substr(0, maxbody - bodybuf.str().length());
  196|    190|        else
  197|    190|          bodybuf << buffer;
  198|    209|        buffer = "";
  199|    209|      }
  200|  3.80k|    }
  201|       |
  202|    378|    if (chunk_size!=0) return false; // need more data
  ------------------
  |  Branch (202:9): [True: 65, False: 313]
  ------------------
  203|       |
  204|    313|    return ready();
  205|    378|  };

_ZN6YaHTTP7Utility8trimLeftERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  425|  17.1k|    static void trimLeft(std::string &str) {
  426|  17.1k|       const std::locale &loc = std::locale::classic();
  427|  17.1k|       std::string::iterator iter = str.begin();
  428|  18.9k|       while(iter != str.end() && YaHTTP::isspace(*iter, loc)) iter++;
  ------------------
  |  Branch (428:14): [True: 7.38k, False: 11.5k]
  |  Branch (428:14): [True: 1.88k, False: 17.1k]
  |  Branch (428:35): [True: 1.88k, False: 5.50k]
  ------------------
  429|  17.1k|       str.erase(str.begin(), iter);
  430|  17.1k|    }; //<! removes whitespace from left
_ZN6YaHTTP7Utility9trimRightERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  432|  17.1k|    static void trimRight(std::string &str) {
  433|  17.1k|       const std::locale &loc = std::locale::classic();
  434|  17.1k|       std::string::reverse_iterator iter = str.rbegin();
  435|  18.3k|       while(iter != str.rend() && YaHTTP::isspace(*iter, loc)) iter++;
  ------------------
  |  Branch (435:14): [True: 6.74k, False: 11.5k]
  |  Branch (435:14): [True: 1.23k, False: 17.1k]
  |  Branch (435:36): [True: 1.23k, False: 5.50k]
  ------------------
  436|  17.1k|       str.erase(iter.base(), str.end());
  437|  17.1k|    }; //<! removes whitespace from right
_ZN6YaHTTP7Utility4trimERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  439|  17.1k|    static void trim(std::string &str) {
  440|  17.1k|       trimLeft(str);
  441|  17.1k|       trimRight(str);
  442|  17.1k|    }; //<! removes whitespace from left and right

_ZN6YaHTTP9CookieJarC2Ev:
   65|  3.23k|    CookieJar() {}; //<! constructs empty cookie jar
_ZN6YaHTTP9CookieJar5clearEv:
   71|  9.71k|    void clear() {
   72|  9.71k|      this->cookies.clear();
   73|  9.71k|    }
_ZN6YaHTTP6CookieaSERKS0_:
   22|  10.5k|     Cookie& operator=(const Cookie &rhs) {
   23|  10.5k|       name = rhs.name;
   24|  10.5k|       value = rhs.value;
   25|  10.5k|       domain = rhs.domain;
   26|  10.5k|       path = rhs.path;
   27|  10.5k|       secure = rhs.secure;
   28|  10.5k|       httponly = rhs.httponly;
   29|  10.5k|       expires = rhs.expires;
   30|  10.5k|       return *this;
   31|  10.5k|     }
_ZN6YaHTTP6CookieC2ERKS0_:
   12|  11.4k|     Cookie(const Cookie &rhs) {
   13|  11.4k|       name = rhs.name;
   14|  11.4k|       value = rhs.value;
   15|  11.4k|       domain = rhs.domain;
   16|  11.4k|       path = rhs.path;
   17|  11.4k|       secure = rhs.secure;
   18|  11.4k|       httponly = rhs.httponly;
   19|  11.4k|       expires = rhs.expires;
   20|  11.4k|     }; //<! Copy cookie values

_ZN6YaHTTP7RequestC2Ev:
  228|  3.23k|    Request() { Request::initialize(); };
_ZN6YaHTTP8HTTPBaseC2Ev:
   98|  3.23k|    HTTPBase() {
   99|  3.23k|      HTTPBase::initialize();
  100|  3.23k|    };
_ZN6YaHTTP8HTTPBase10initializeEv:
  102|  9.71k|    virtual void initialize() {
  103|  9.71k|      kind = 0;
  104|  9.71k|      status = 0;
  105|  9.71k|#ifdef HAVE_CPP_FUNC_PTR
  106|  9.71k|      renderer = SendBodyRender();
  107|  9.71k|#endif
  108|  9.71k|      max_request_size = YAHTTP_MAX_REQUEST_SIZE;
  ------------------
  |  |   24|  9.71k|#define YAHTTP_MAX_REQUEST_SIZE 2097152
  ------------------
  109|  9.71k|      max_response_size = YAHTTP_MAX_RESPONSE_SIZE;
  ------------------
  |  |   28|  9.71k|#define YAHTTP_MAX_RESPONSE_SIZE 2097152
  ------------------
  110|  9.71k|      url = "";
  111|  9.71k|      method = "";
  112|  9.71k|      statusText = "";
  113|  9.71k|      jar.clear();
  114|  9.71k|      headers.clear();
  115|  9.71k|      parameters.clear();
  116|  9.71k|      getvars.clear();
  117|  9.71k|      postvars.clear();
  118|  9.71k|      body = "";
  119|  9.71k|      routeName = "";
  120|  9.71k|      version = 11; // default to version 1.1
  121|  9.71k|      is_multipart = false;
  122|  9.71k|    }
_ZN6YaHTTP8HTTPBase14SendBodyRenderC2Ev:
   48|  9.71k|      SendBodyRender() {};
_ZN6YaHTTP7Request10initializeEv:
  237|  6.47k|    void initialize() override {
  238|  6.47k|      HTTPBase::initialize();
  239|  6.47k|      this->kind = YAHTTP_TYPE_REQUEST;
  ------------------
  |  |   31|  6.47k|#define YAHTTP_TYPE_REQUEST 1
  ------------------
  240|  6.47k|    }
_ZN6YaHTTP11AsyncLoaderINS_7RequestEE10initializeEPS1_:
  311|  3.23k|    void initialize(T* target_) {
  312|  3.23k|      chunked = false; chunk_size = 0;
  313|  3.23k|      bodybuf.str(""); minbody = 0; maxbody = 0;
  314|  3.23k|      pos = 0; state = 0; this->target = target_;
  315|  3.23k|      hasBody = false;
  316|  3.23k|      buffer = "";
  317|  3.23k|      this->target->initialize();
  318|  3.23k|    }; //<! Initialize the parser for target and clear state
_ZN6YaHTTP11AsyncLoaderINS_7RequestEE8finalizeEv:
  329|    269|    void finalize() {
  330|    269|      bodybuf.flush();
  331|    269|      if (ready()) {
  ------------------
  |  Branch (331:11): [True: 269, False: 0]
  ------------------
  332|    269|        strstr_map_t::iterator cpos = target->headers.find("content-type");
  333|    269|        if (cpos != target->headers.end() && Utility::iequals(cpos->second, "application/x-www-form-urlencoded", 32)) {
  ------------------
  |  Branch (333:13): [True: 21, False: 248]
  |  Branch (333:13): [True: 0, False: 269]
  |  Branch (333:46): [True: 0, False: 21]
  ------------------
  334|      0|          target->postvars = Utility::parseUrlParameters(bodybuf.str());
  335|      0|        }
  336|    269|        target->body = bodybuf.str();
  337|    269|      }
  338|    269|      bodybuf.str("");
  339|    269|      this->target = NULL;
  340|    269|    }; //<! finalize and release target
_ZN6YaHTTP11AsyncLoaderINS_7RequestEE5readyEv:
  320|    625|    bool ready() {
  321|    625|     return (chunked == true && state == 3) || // if it's chunked we get end of data indication
  ------------------
  |  Branch (321:14): [True: 50, False: 575]
  |  Branch (321:33): [True: 22, False: 28]
  ------------------
  322|    625|             (chunked == false && state > 1 &&  
  ------------------
  |  Branch (322:15): [True: 575, False: 28]
  |  Branch (322:35): [True: 575, False: 0]
  ------------------
  323|    603|               (!hasBody || 
  ------------------
  |  Branch (323:17): [True: 231, False: 344]
  ------------------
  324|    575|                 (bodybuf.str().size() <= maxbody && 
  ------------------
  |  Branch (324:19): [True: 344, False: 0]
  ------------------
  325|    344|                  bodybuf.str().size() >= minbody)
  ------------------
  |  Branch (325:19): [True: 54, False: 290]
  ------------------
  326|    575|               )
  327|    603|             ); 
  328|    625|    }; //<! whether we have received enough data

_ZN6YaHTTP3URLC2Ev:
  166|  3.23k|      URL() { initialize(); }; //<! construct empty url
_ZN6YaHTTP3URL10initializeEv:
  116|  16.0k|      void initialize() {
  117|  16.0k|        protocol = ""; host = ""; port = 0; username = ""; password = ""; path = ""; parameters = ""; anchor =""; pathless = true;
  118|  16.0k|      }; //<! initialize to empty URL
_ZN6YaHTTP3URLC2EPKc:
  171|  9.71k|      URL(const char *url) {
  172|  9.71k|        parse(std::string(url));
  173|  9.71k|      }; //<! calls parse with url
_ZN6YaHTTP3URL5parseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  175|  12.7k|      bool parse(const std::string& url) {
  176|       |        // setup
  177|  12.7k|        initialize();
  178|       |
  179|  12.7k|        if (url.size() > YAHTTP_MAX_URL_LENGTH) return false;
  ------------------
  |  |    8|  12.7k|#define YAHTTP_MAX_URL_LENGTH 2048
  ------------------
  |  Branch (179:13): [True: 14, False: 12.7k]
  ------------------
  180|  12.7k|        size_t pos = 0;
  181|  12.7k|        if (*(url.begin()) != '/') { // full url?
  ------------------
  |  Branch (181:13): [True: 12.6k, False: 106]
  ------------------
  182|  12.6k|          if (parseSchema(url, pos) == false) return false;
  ------------------
  |  Branch (182:15): [True: 11.8k, False: 772]
  ------------------
  183|    772|          if (pathless) {
  ------------------
  |  Branch (183:15): [True: 536, False: 236]
  ------------------
  184|    536|            parameters = url.substr(pos);
  185|    536|            return true;
  186|    536|          }
  187|    236|          if (parseUserPass(url, pos) == false) return false;
  ------------------
  |  Branch (187:15): [True: 0, False: 236]
  ------------------
  188|    236|          if (parseHost(url, pos) == false) return false;
  ------------------
  |  Branch (188:15): [True: 27, False: 209]
  ------------------
  189|    236|        }
  190|    315|        if (parsePath(url, pos) == false) return false;
  ------------------
  |  Branch (190:13): [True: 0, False: 315]
  ------------------
  191|    315|        if (parseParameters(url, pos) == false) return false;
  ------------------
  |  Branch (191:13): [True: 0, False: 315]
  ------------------
  192|    315|        return parseAnchor(url, pos);
  193|    315|    }; //<! parse various formats of urls ranging from http://example.com/foo?bar=baz into data:base64:d089swt64wt... 
_ZN6YaHTTP3URL11parseSchemaERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERm:
   15|  12.6k|      bool parseSchema(const std::string& url, size_t &pos) {
   16|  12.6k|          size_t pos1;
   17|  12.6k|          if (pos >= url.size()) return false; // no data
  ------------------
  |  Branch (17:15): [True: 11.8k, False: 804]
  ------------------
   18|    804|          if ( (pos1 = url.find_first_of(":",pos)) == std::string::npos ) return false; // schema is mandatory
  ------------------
  |  Branch (18:16): [True: 32, False: 772]
  ------------------
   19|    772|          protocol = url.substr(pos, pos1-pos);
   20|    772|          if (protocol == "http") port = 80;
  ------------------
  |  Branch (20:15): [True: 1, False: 771]
  ------------------
   21|    772|          if (protocol == "https") port = 443;
  ------------------
  |  Branch (21:15): [True: 1, False: 771]
  ------------------
   22|    772|          pos = pos1+1; // after :
   23|    772|          if (url.compare(pos, 2, "//") == 0) {
  ------------------
  |  Branch (23:15): [True: 236, False: 536]
  ------------------
   24|    236|             pathless = false; // if this is true we put rest into parameters
   25|    236|             pos += 2;
   26|    236|          }
   27|    772|          return true;
   28|    804|      }; //<! parse schema/protocol part 
_ZN6YaHTTP3URL13parseUserPassERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERm:
   60|    236|      bool parseUserPass(const std::string& url, size_t &pos) {
   61|    236|          size_t pos1,pos2;
   62|    236|          if (pos >= url.size()) return true; // no data
  ------------------
  |  Branch (62:15): [True: 1, False: 235]
  ------------------
   63|       |
   64|    235|          if ( (pos1 = url.find_first_of("@",pos)) == std::string::npos ) return true; // no userinfo
  ------------------
  |  Branch (64:16): [True: 167, False: 68]
  ------------------
   65|     68|          pos2 = url.find_first_of(":",pos);
   66|       |
   67|     68|          if (pos2 != std::string::npos) { // comes with password
  ------------------
  |  Branch (67:15): [True: 31, False: 37]
  ------------------
   68|     31|             username = url.substr(pos, pos2 - pos);
   69|     31|             password = url.substr(pos2+1, pos1 - pos2 - 1);
   70|     31|             password = Utility::decodeURL(password);
   71|     37|          } else {
   72|     37|             username = url.substr(pos, pos1 - pos);
   73|     37|          }
   74|     68|          pos = pos1+1;
   75|     68|          username = Utility::decodeURL(username);
   76|     68|          return true;
   77|    235|      }; //<! parse possible username and password
_ZN6YaHTTP3URL9parseHostERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERm:
   30|    236|      bool parseHost(const std::string& url, size_t &pos) {
   31|    236|          size_t pos1;
   32|    236|          if (pos >= url.size()) return true; // no data
  ------------------
  |  Branch (32:15): [True: 18, False: 218]
  ------------------
   33|    218|          if ( (pos1 = url.find_first_of("/", pos)) == std::string::npos ) {
  ------------------
  |  Branch (33:16): [True: 177, False: 41]
  ------------------
   34|    177|             host = url.substr(pos);
   35|    177|             path = "/";
   36|    177|             pos = url.size();
   37|    177|          } else {
   38|     41|             host = url.substr(pos, pos1-pos);
   39|     41|             pos = pos1;
   40|     41|          }
   41|    218|          if (host.at(0) == '[') { // IPv6
  ------------------
  |  Branch (41:15): [True: 90, False: 128]
  ------------------
   42|     90|            if ((pos1 = host.find_first_of("]")) == std::string::npos) {
  ------------------
  |  Branch (42:17): [True: 27, False: 63]
  ------------------
   43|       |              // incomplete address
   44|     27|              return false;
   45|     27|            }
   46|     63|            size_t pos2;
   47|     63|            if ((pos2 = host.find_first_of(":", pos1)) != std::string::npos) {
  ------------------
  |  Branch (47:17): [True: 21, False: 42]
  ------------------
   48|     21|              std::istringstream tmp(host.substr(pos2 + 1));
   49|     21|              tmp >> port;
   50|     21|            }
   51|     63|            host = host.substr(1, pos1 - 1);
   52|    128|          } else if ( (pos1 = host.find_first_of(":")) != std::string::npos ) {
  ------------------
  |  Branch (52:23): [True: 40, False: 88]
  ------------------
   53|     40|             std::istringstream tmp(host.substr(pos1+1));
   54|     40|             tmp >> port;
   55|     40|             host = host.substr(0, pos1);
   56|     40|          }
   57|    191|          return true;
   58|    218|      }; //<! parse host and port
_ZN6YaHTTP3URL9parsePathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERm:
   79|    307|      bool parsePath(const std::string& url, size_t &pos) {
   80|    307|          size_t pos1;
   81|    307|          if (pos >= url.size()) return true; // no data
  ------------------
  |  Branch (81:15): [True: 169, False: 138]
  ------------------
   82|    138|          if (url[pos] != '/') return false; // not an url
  ------------------
  |  Branch (82:15): [True: 0, False: 138]
  ------------------
   83|    138|          if ( (pos1 = url.find_first_of("?", pos)) == std::string::npos ) {
  ------------------
  |  Branch (83:16): [True: 44, False: 94]
  ------------------
   84|     44|             path = url.substr(pos);
   85|     44|             pos = url.size();
   86|     94|          } else {
   87|     94|             path = url.substr(pos, pos1-pos);
   88|     94|             pos = pos1;
   89|     94|          }
   90|    138|          return true;
   91|    138|      }; //<! parse path component
_ZN6YaHTTP3URL15parseParametersERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERm:
   93|    307|      bool parseParameters(const std::string& url, size_t &pos) {
   94|    307|          size_t pos1;
   95|    307|          if (pos >= url.size()) return true; // no data
  ------------------
  |  Branch (95:15): [True: 213, False: 94]
  ------------------
   96|     94|          if (url[pos] == '#') return true; // anchor starts here
  ------------------
  |  Branch (96:15): [True: 0, False: 94]
  ------------------
   97|     94|          if (url[pos] != '?') return false; // not a parameter
  ------------------
  |  Branch (97:15): [True: 0, False: 94]
  ------------------
   98|     94|          if ( (pos1 = url.find_first_of("#", pos)) == std::string::npos ) {
  ------------------
  |  Branch (98:16): [True: 76, False: 18]
  ------------------
   99|     76|             parameters = url.substr(pos+1);;
  100|     76|             pos = url.size();
  101|     76|          } else {
  102|     18|             parameters = url.substr(pos+1, pos1-pos-1);
  103|     18|             pos = pos1;
  104|     18|          }
  105|     94|          if (parameters.size()>0 && *(parameters.end()-1) == '&') parameters.resize(parameters.size()-1);
  ------------------
  |  Branch (105:15): [True: 76, False: 18]
  |  Branch (105:15): [True: 3, False: 91]
  |  Branch (105:38): [True: 3, False: 73]
  ------------------
  106|     94|          return true;
  107|     94|      }; //<! parse url parameters
_ZN6YaHTTP3URL11parseAnchorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERm:
  109|    307|      bool parseAnchor(const std::string& url, size_t &pos) {
  110|    307|          if (pos >= url.size()) return true; // no data
  ------------------
  |  Branch (110:15): [True: 289, False: 18]
  ------------------
  111|     18|          if (url[pos] != '#') return false; // not anchor
  ------------------
  |  Branch (111:15): [True: 0, False: 18]
  ------------------
  112|     18|          anchor = url.substr(pos+1);
  113|     18|          return true;
  114|     18|      }; //<! parse anchor

_ZN6YaHTTP7Utility9decodeURLERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  220|  48.0k|    static std::string decodeURL(const std::string& component) {
  221|  48.0k|        std::string result = component;
  222|  48.0k|        size_t pos1,pos2;
  223|  48.0k|        pos2 = 0;
  224|   158k|        while((pos1 = result.find_first_of("%", pos2))!=std::string::npos) {
  ------------------
  |  Branch (224:15): [True: 112k, False: 45.9k]
  ------------------
  225|   112k|           std::string code;
  226|   112k|           char a,b,c;
  227|   112k|           if (pos1 + 2 > result.length()) return result; // end of result
  ------------------
  |  Branch (227:16): [True: 2.03k, False: 110k]
  ------------------
  228|   110k|           code = result.substr(pos1+1, 2);
  229|   110k|           a = std::tolower(code[0]); b = std::tolower(code[1]);
  230|       |
  231|   110k|           if ((( '0' > a || a > '9') && ('a' > a || a > 'f')) ||
  ------------------
  |  Branch (231:19): [True: 77.3k, False: 32.6k]
  |  Branch (231:30): [True: 29.6k, False: 3.01k]
  |  Branch (231:43): [True: 79.7k, False: 27.2k]
  |  Branch (231:54): [True: 15.3k, False: 11.9k]
  ------------------
  232|   110k|              (( '0' > b || b > '9') && ('a' > b || b > 'f'))) {
  ------------------
  |  Branch (232:18): [True: 11.0k, False: 3.83k]
  |  Branch (232:29): [True: 2.82k, False: 1.00k]
  |  Branch (232:42): [True: 11.1k, False: 2.74k]
  |  Branch (232:53): [True: 1.51k, False: 1.23k]
  ------------------
  233|   107k|              pos2 = pos1+3;
  234|   107k|              continue;
  235|   107k|           }
  236|       |
  237|  2.24k|           if ('0' <= a && a <= '9') a = a - '0';
  ------------------
  |  Branch (237:16): [True: 2.24k, False: 0]
  |  Branch (237:28): [True: 1.03k, False: 1.20k]
  ------------------
  238|  1.20k|           else if ('a' <= a && a <= 'f') a = a - 'a' + 0x0a;
  ------------------
  |  Branch (238:21): [True: 1.20k, False: 0]
  |  Branch (238:33): [True: 1.20k, False: 0]
  ------------------
  239|  2.24k|           if ('0' <= b && b <= '9') b = b - '0';
  ------------------
  |  Branch (239:16): [True: 2.24k, False: 0]
  |  Branch (239:28): [True: 1.00k, False: 1.23k]
  ------------------
  240|  1.23k|           else if ('a' <= b && b <= 'f') b = b - 'a' + 0x0a;
  ------------------
  |  Branch (240:21): [True: 1.23k, False: 0]
  |  Branch (240:33): [True: 1.23k, False: 0]
  ------------------
  241|       |
  242|  2.24k|           c = (a<<4)+b;
  243|  2.24k|           result = result.replace(pos1,3,1,c);
  244|  2.24k|           pos2=pos1;
  245|  2.24k|        }
  246|  45.9k|        return result;
  247|  48.0k|    }; //<! Decodes %xx from string into bytes
_ZNK6YaHTTP25ASCIICINullSafeComparatorclERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
   17|   313k|    bool operator() (const std::string& lhs, const std::string& rhs) const {
   18|   313k|      int v;
   19|   313k|      std::string::const_iterator lhi = lhs.begin();
   20|   313k|      std::string::const_iterator rhi = rhs.begin();
   21|   790k|      for(;lhi != lhs.end() && rhi != rhs.end(); lhi++, rhi++)
  ------------------
  |  Branch (21:12): [True: 713k, False: 76.8k]
  |  Branch (21:12): [True: 705k, False: 85.7k]
  |  Branch (21:32): [True: 705k, False: 8.89k]
  ------------------
   22|   705k|        if ((v = ::tolower(*lhi) - ::tolower(*rhi)) != 0) return v<0; 
  ------------------
  |  Branch (22:13): [True: 228k, False: 476k]
  ------------------
   23|  85.7k|      if (lhi == lhs.end() && rhi != rhs.end()) return true;
  ------------------
  |  Branch (23:11): [True: 76.8k, False: 8.89k]
  |  Branch (23:11): [True: 17.7k, False: 68.0k]
  |  Branch (23:31): [True: 17.7k, False: 59.1k]
  ------------------
   24|  68.0k|      if (lhi != lhs.end() && rhi == rhs.end()) return false;
  ------------------
  |  Branch (24:11): [True: 8.89k, False: 59.1k]
  |  Branch (24:11): [True: 8.89k, False: 59.1k]
  |  Branch (24:31): [True: 8.89k, False: 0]
  ------------------
   25|  59.1k|      return false; // they are equal
   26|  68.0k|    }
_ZN6YaHTTP8DateTimeC2Ev:
   48|  23.7k|     DateTime() { 
   49|  23.7k|       initialize();
   50|  23.7k|     }; //<! Construct and initialize
_ZN6YaHTTP8DateTime10initializeEv:
   52|  23.7k|     void initialize() {
   53|  23.7k|       isSet = false; 
   54|  23.7k|       year = month = day = wday = hours = minutes = seconds = utc_offset = 0;
   55|  23.7k|       month = 1; // it's invalid otherwise
   56|  23.7k|     }; //<! Creates year 0 date
_ZN6YaHTTP7Utility7iequalsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_m:
  406|     21|    static bool iequals(const std::string& a, const std::string& b, size_t length) {
  407|     21|      std::string::const_iterator ai, bi;
  408|     21|      size_t i;
  409|     62|      for(ai = a.begin(), bi = b.begin(), i = 0; ai != a.end() && bi != b.end() && i < length; ai++,bi++,i++) {
  ------------------
  |  Branch (409:50): [True: 48, False: 14]
  |  Branch (409:50): [True: 48, False: 14]
  |  Branch (409:67): [True: 48, False: 0]
  |  Branch (409:84): [True: 48, False: 0]
  ------------------
  410|     48|        if (::toupper(*ai) != ::toupper(*bi)) return false;
  ------------------
  |  Branch (410:13): [True: 7, False: 41]
  ------------------
  411|     48|      }
  412|       |
  413|     14|      if (ai == a.end() && bi == b.end()) return true;
  ------------------
  |  Branch (413:11): [True: 14, False: 0]
  |  Branch (413:11): [True: 0, False: 14]
  |  Branch (413:28): [True: 0, False: 14]
  ------------------
  414|     14|      if ((ai == a.end() && bi != b.end()) ||
  ------------------
  |  Branch (414:11): [True: 14, False: 0]
  |  Branch (414:12): [True: 14, False: 0]
  |  Branch (414:29): [True: 14, False: 0]
  ------------------
  415|     14|          (ai != a.end() && bi == b.end())) return false;
  ------------------
  |  Branch (415:12): [True: 0, False: 0]
  |  Branch (415:29): [True: 0, False: 0]
  ------------------
  416|       |      
  417|      0|      return ::toupper(*ai) == ::toupper(*bi);
  418|     14|    }; //<! case-insensitive comparison with length
_ZN6YaHTTP7Utility18parseUrlParametersENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  367|  3.04k|    static strstr_map_t parseUrlParameters(std::string parameters) {
  368|  3.04k|      std::string::size_type pos = 0;
  369|  3.04k|      strstr_map_t parameter_map;
  370|  15.0k|      while (pos != std::string::npos) {
  ------------------
  |  Branch (370:14): [True: 15.0k, False: 0]
  ------------------
  371|       |        // find next parameter start
  372|  15.0k|        std::string::size_type nextpos = parameters.find("&", pos);
  373|  15.0k|        std::string::size_type delim = parameters.find("=", pos);
  374|  15.0k|        if (delim > nextpos) {
  ------------------
  |  Branch (374:13): [True: 11.4k, False: 3.58k]
  ------------------
  375|  11.4k|          delim = nextpos;
  376|  11.4k|        }
  377|  15.0k|        std::string key;
  378|  15.0k|        std::string value;
  379|  15.0k|        if (delim == std::string::npos) {
  ------------------
  |  Branch (379:13): [True: 2.99k, False: 12.0k]
  ------------------
  380|  2.99k|          key = parameters.substr(pos);
  381|  12.0k|        } else {
  382|  12.0k|          key = parameters.substr(pos, delim-pos);
  383|  12.0k|          if (nextpos == std::string::npos) {
  ------------------
  |  Branch (383:15): [True: 21, False: 12.0k]
  ------------------
  384|     21|            value = parameters.substr(delim+1);
  385|  12.0k|          } else {
  386|  12.0k|            value = parameters.substr(delim+1, nextpos-delim-1);
  387|  12.0k|          }
  388|  12.0k|        }
  389|  15.0k|        if (key.empty()) {
  ------------------
  |  Branch (389:13): [True: 2.55k, False: 12.4k]
  ------------------
  390|       |          // no parameters at all
  391|  2.55k|          break;
  392|  2.55k|        }
  393|  12.4k|        key = decodeURL(key);
  394|  12.4k|        value = decodeURL(value);
  395|  12.4k|        parameter_map[key] = value;
  396|  12.4k|        if (nextpos == std::string::npos) {
  ------------------
  |  Branch (396:13): [True: 490, False: 11.9k]
  ------------------
  397|       |          // no more parameters left
  398|    490|          break;
  399|    490|        }
  400|       |
  401|  11.9k|        pos = nextpos+1;
  402|  11.9k|      }
  403|  3.04k|      return parameter_map;
  404|  3.04k|    }; //<! parses URL parameters into string map 

LLVMFuzzerTestOneInput:
   28|  3.23k|{
   29|  3.23k|  try {
   30|  3.23k|    YaHTTP::AsyncRequestLoader yarl;
   31|  3.23k|    YaHTTP::Request req;
   32|       |
   33|  3.23k|    yarl.initialize(&req);
   34|  3.23k|    bool finished = yarl.feed(std::string(reinterpret_cast<const char*>(data), size));
   35|  3.23k|    if (finished) {
  ------------------
  |  Branch (35:9): [True: 269, False: 2.96k]
  ------------------
   36|    269|      yarl.finalize();
   37|    269|    }
   38|  3.23k|  }
   39|  3.23k|  catch (const YaHTTP::ParseError& e) {
   40|    372|  }
   41|  3.23k|  catch (const std::exception& e) {
   42|      9|  }
   43|  3.23k|  catch (...) {
   44|      0|  }
   45|       |
   46|  3.23k|  return 0;
   47|  3.23k|}

