Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pike pike
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 107
    • Issues 107
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pikelang
  • pikepike
  • Issues
  • #4773

Protocols.HTTP.Query doesn't always remove timeout callback properly

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=4773

Reported by Tobias Liin liin@roxen.com

When using Protocols.HTTP.Query()->timed_async_fetch() both the ok callback and the fail callback will be called, after a successful fetch.

### example: ###

object o;

int main() {
  o = Protocols.HTTP.Query();
  o->data_timeout = 4;
  o->set_callbacks(req_ok, req_fail);
  o->async_request("www.roxen.com", 80, "GET /index.xml HTTP/1.0");
  return -1;
}

void req_ok() {
  werror("req_ok(): %O\n", o);
  o->timed_async_fetch(data_ok, data_fail);
}

void req_fail() {
  werror("req_fail: %O()\n", o);
}

void data_ok() {
  werror("data_ok: %O()\n", o);
}

void data_fail() {
  werror("data_fail: %O()\n", o);
}

###############

The following patch for Query.pike v1.101 will fix it (I don't know if its the best way though):

@@ -376,6 +376,7 @@
    if (!zero_type (headers["content-length"]) &&
        sizeof(buf)-datapos>=(int)headers["content-length"])
    {
+      remove_call_out(async_timeout);
       con->set_nonblocking(0,0,0);
       request_ok(@extra_args);
    }

It adds remove_call_out(async_timeout); in async_fetch_read() in the case of all data having been received.

Assignee
Assign to
Time tracking