pike.git / lib / modules / Web.pmod / Api.pmod / Api.pike

version» Context lines:

pike.git/lib/modules/Web.pmod/Api.pmod/Api.pike:264:    params = 0;    }    }    else {    params = (mapping) p;    }       Protocols.HTTP.Query req = Protocols.HTTP.Query();       if (http_request_timeout) { +  if (has_index(req, "maxtime")) { +  req->maxtime = http_request_timeout; +  } +  else {    req->timeout = http_request_timeout;    } -  +  }      #ifdef SOCIAL_REQUEST_DEBUG    TRACE("\n> Request: %s %s?%s\n", http_method, api_method, (string) p);    if (data) {    if (sizeof(data) > 100) {    TRACE("> data: %s\n", data[0..100]);    }    else {    TRACE("> data: %s\n", data);    }    }   #endif       if (cb) {    int myid = ++_call_id;    _query_objects[myid] = ({ req, cb });       req->set_callbacks( -  lambda (Protocols.HTTP.Query qq, mixed ... args) { +  lambda (Protocols.HTTP.Query qq, int cid) {    if (qq->status == 200) { -  cb(handle_response(qq), qq); +  qq->timed_async_fetch( +  lambda (Protocols.HTTP.Query qa) { +  cb(handle_response(qa), qa); +  m_delete(_query_objects, cid); +  }, +  lambda (Protocols.HTTP.Query qa) { +  cb(0, qa); +  m_delete(_query_objects, cid); +  });    }    else if ((< 301, 302 >)[qq->status]) {    cb(qq->headers, qq); -  +  m_delete(_query_objects, cid);    }    else {    cb(0, qq); -  +  m_delete(_query_objects, cid);    } -  -  m_delete(_query_objects, myid); +     }, -  lambda (Protocols.HTTP.Query qq, mixed ... args) { +  lambda (Protocols.HTTP.Query qq, int cid) {    cb(0, qq); -  m_delete(_query_objects, myid); -  } -  ); +  m_delete(_query_objects, cid); +  }, +  myid);       Protocols.HTTP.do_async_method(http_method, api_method, params,    request_headers, req, data);       return 0;    }       req = Protocols.HTTP.do_method(http_method, api_method, params,    request_headers, req, data);