// ------------------------------------------------------------------------ void FskHeaderStructDispose(FskHeaders *headers) { if (headers == NULL) return; FskMemPtrDispose(headers->URI); FskMemPtrDispose(headers->filename); FskMemPtrDispose(headers->method); FskMemPtrDispose(headers->protocol); FskMemPtrDispose(headers->responseReasonPhrase); FskMemPtrDispose(headers->lastName); FskAssociativeArrayDispose(headers->parameters); FskAssociativeArrayDispose(headers->theHeaders); FskMemPtrDispose(headers); }
void KprMessageDispose(KprMessage self) { if (self) { FskListRemove(&gShell->messages, self); if (self->stream && self->stream->dispatch->dispose) (*self->stream->dispatch->dispose)(self->stream); if (self->response.dispose) (*self->response.dispose)(self->response.target); FskMemPtrDispose(self->response.body); FskAssociativeArrayDispose(self->response.headers); if (self->request.dispose) (*self->request.dispose)(self->request.target); FskMemPtrDispose(self->request.body); if (self->request.certs != NULL) FskNetUtilDisposeCertificate(self->request.certs); FskAssociativeArrayDispose(self->request.headers); FskMemPtrDispose(self->url); FskMemPtrDispose(self->method); FskInstrumentedItemDispose(self); FskMemPtrDispose(self); } }
void KprMessageComplete(KprMessage self) { char* url; FskThread thread = KprShellGetThread(gShell); if (!thread) return; // @@ happens on exit if (thread != FskThreadGetCurrent()) { FskThreadPostCallback(thread, (FskThreadCallback)KprMessageComplete, self, NULL, NULL, NULL); return; } FskInstrumentedItemSendMessageDebug(self, kprInstrumentedMessageComplete, self); if (FskListRemove(&gShell->messages, self)) { self->usage--; // message queue self->waiting = false; url = KprMessageGetResponseHeader(self, "location"); if (url && (!FskStrCompareWithLength(self->url, "xkpr", 4)) && ((!self->sniffing) || (!FskStrCompareWithLength(url, "xkpr", 4)))) { FskMemPtrDispose(self->url); self->url = FskStrDoCopy(url); //bailIfNULL(self->url); KprURLSplit(self->url, &self->parts); FskAssociativeArrayDispose(self->response.headers); self->response.headers = NULL; FskMemPtrDispose(self->response.body); self->response.body = NULL; self->response.size = 0; if (self->request.target) self->usage--; // @@ request if (kFskErrNone == KprMessageInvoke(self, self->request.callback, self->request.dispose, self->request.target)) return; } if (self->request.target) { if (self->request.callback) (*self->request.callback)(self, self->request.target); if (self->request.dispose) (*self->request.dispose)(self->request.target); self->request.callback = NULL; self->request.dispose = NULL; self->request.target = NULL; self->usage--; // request } if (!self->usage) KprMessageDispose(self); } }
FskErr KprHTTPClientResetTarget(KprHTTPTarget target) { FskErr err = kFskErrNone; KprMessage message = target->message; KprMessageClearRequestHeader(message, kprHTTPHeaderIfModifiedSince); KprMessageClearRequestHeader(message, kprHTTPHeaderIfNoneMatch); if (target->cached) { target->cached = NULL; } else { FskAssociativeArrayDispose(message->response.headers); KprMemPtrDispose(message->response.body); } message->error = 0; message->response.headers = NULL; message->response.body = NULL; message->response.size = 0; target->responseOffset = 0; FskInstrumentedItemSendMessageDebug(message, kprInstrumentedMessageHTTPContinue, message); //bail: return err; }
void FskUUIDTerminate(void) { FskAssociativeArrayDispose(gUUIDCache); }
void FskEnvironmentTerminate(void) { FskAssociativeArrayDispose(gEnvironment); }