+ if (z_pdu && z_pdu->which == Z_GDU_HTTP_Request)
+ {
+ Z_HTTP_Request *hreq = z_pdu->u.HTTP_Request;
+ std::string peername = p->origin().get_address();
+
+ m_limit_http_req.cleanup(false);
+ int con_sz = m_limit_http_req.get_total(peername.c_str());
+ std::list<IP_Pattern>::const_iterator it = m_p->http_req_max.begin();
+ for (; it != m_p->http_req_max.end(); it++)
+ {
+ if (mp::util::match_ip(it->pattern, peername))
+ {
+ if (it->verbose > 1 ||
+ (it->value && con_sz >= it->value && it->verbose > 0))
+ yaz_log(YLOG_LOG, "http-req-max pattern=%s ip=%s con_sz=%d value=%d", it->pattern.c_str(), peername.c_str(), con_sz, it->value);
+ if (it->value == 0 || con_sz < it->value)
+ break;
+ mp::odr o;
+ Z_GDU *gdu_res = o.create_HTTP_Response(m_session, hreq, 500);
+ int len;
+ send_GDU(gdu_res, &len);
+ delete p;
+ return;
+ }
+ }
+ m_limit_http_req.add_connect(peername.c_str());
+ }
+ ThreadPoolPackage *tp = new ThreadPoolPackage(p, this, m_p);