def binary_search(http_helper, lsig, minv, maxv, url, method, detection_struct,
                  ch,
                  headers, body=None):
    mid = mid_value(minv, maxv)
    new_url = url
    new_body = body
    new_headers = headers

    if minv > maxv:
        return maxv

    http_client = HTTPClient()
    payload = ch * mid

    if lsig in url:
        new_url = url.replace(lsig, payload)  # warning urlencode and etc
    elif body is not None and lsig in body:
        new_body = body.replace(lsig, payload)
    elif headers is not None and lsig in headers:
        raw_val = str(headers)
        raw_val = raw_val.replace(lsig, payload)
        new_headers = ast.literal_eval(str(raw_val))
    request = http_helper.create_http_request(method,
                                              new_url,
                                              new_body,
                                              new_headers)
    try:
        response = http_client.fetch(request)
    except __HOLE__ as e:
        response = e.response

    for struct in detection_struct:
        if struct["method"](response, struct["arguments"]):
            http_client.close()
            return binary_search(http_helper,
                                 lsig,
                                 minv,
                                 mid - 1,
                                 url,
                                 method,
                                 detection_struct,
                                 ch,
                                 headers,
                                 body)
    http_client.close()
    return binary_search(http_helper,
                         lsig,
                         mid + 1,
                         maxv,
                         url,
                         method,
                         detection_struct,
                         ch,
                         headers,
                         body)
dataset/ETHPy150Open owtf/owtf/framework/http/wafbypasser/core/placeholder_length.py/binary_search