I'm trying to write a "standard" AFTER filter that I will use in lots of
places to stop the event loop. Currently my Put code looks something like:
// Perform a ranged PUT on that anchor.
request = HTRequest_new();
HTRequest_addRange(request, "bytes", rangeStr);
HTRequest_addAfter(request, endRequest, NULL, NULL, HT_ALL,
HT_FILTER_LAST, FALSE);
if (HTPutAbsolute(HTAnchor_parent(anchor), urlStr, request)) {
HTEventList_loop(request);
err = OK;
} else {
err = NO;
}
static int endRequest(HTRequest* req, HTResponse* res, void* param,
int status) {
HTEventList_stopLoop();
return HT_OK;
}
My first question is "Is this an acceptable way to stop the event loop?".
If so, it seems that endRequest() does not handle redirections, and if one
is in progress, this filter will stop the redirection. Is this correct, and
if so, how should the AFTER filter be coded so as to stop the event loop
when the PUT has finished and, at the same time, handle redirections, etc?
regards,
-jim