If stream.write_all method threw an exception Rygel crashed.
It happened because on_got_body and on_got_chunk signals came after
HTTPPost object transitioned to finished state.
The fix disconnects from these signals after file writing errors occurs
since there is no recovery from such situation which in real
happens only when there is no disk space or max file size is limited.
try {
this.stream.write_all (chunk.data, null, this.cancellable);
} catch (Error error) {
- this.handle_error (error);
+ this.disconnect_message_signals ();
+ this.handle_error (
+ new HTTPRequestError.INTERNAL_SERVER_ERROR (error.message));
this.handle_continue ();
}
}
var queue = ItemRemovalQueue.get_default ();
yield queue.remove_now (this.item, null);
}
+
+ private void disconnect_message_signals () {
+ this.msg.got_body.disconnect (this.on_got_body);
+ this.msg.got_chunk.disconnect (this.on_got_chunk);
+ }
+
}
internal errordomain Rygel.HTTPRequestError {
UNACCEPTABLE = Soup.KnownStatusCode.NOT_ACCEPTABLE,
BAD_REQUEST = Soup.KnownStatusCode.BAD_REQUEST,
- NOT_FOUND = Soup.KnownStatusCode.NOT_FOUND
+ NOT_FOUND = Soup.KnownStatusCode.NOT_FOUND,
+ INTERNAL_SERVER_ERROR = Soup.KnownStatusCode.INTERNAL_SERVER_ERROR
}
/**