this.msg.response_body.set_accumulate (false);
- this.server.request_aborted += on_request_aborted;
-
if (this.cancellable != null) {
this.cancellable.cancelled += this.on_cancelled;
}
this.end (true, Soup.KnownStatusCode.CANCELLED);
}
- private void on_request_aborted (Soup.Server server,
- Soup.Message msg,
- Soup.ClientContext client) {
- // Ignore if message isn't ours
- if (msg == this.msg)
- this.end (true, Soup.KnownStatusCode.NONE);
- }
-
public void push_data (void *data, size_t length) {
this.msg.response_body.append (Soup.MemoryUse.COPY,
data,
public async void run () {
context.server.add_handler (this.path_root, server_handler);
+ context.server.request_aborted.connect (this.on_request_aborted);
if (this.cancellable != null) {
this.cancellable.cancelled += this.on_cancelled;
request.run.begin ();
}
+
+ private void on_request_aborted (Soup.Server server,
+ Soup.Message message,
+ Soup.ClientContext client) {
+ foreach (var request in this.requests) {
+ if (request.msg == message) {
+ request.cancellable.cancel ();
+ debug ("HTTP client aborted %s request for URI '%s'.",
+ request.msg.method,
+ request.msg.get_uri ().to_string (false));
+
+ break;
+ }
+ }
+ }
}