Quite often (but not always) my code gets crashed on RHTTPSession::Close().
This happens when I use HTTP POST, which gets an HTTP failure code 500 (it doesn't happen when a good, code 200 response arrives).
I've taken the WebClientEngine class from the YahooImagesSearch example, and modified it a bit.
The most significant modification I made was to close the session each time I cancel the transaction.
The flow of events:
CWebClientEngine::MHFRunL() gets called with following events:
THTTPEvent::EGotResponseHeaders (with HTTP code 500)
This last event leads to my code calling iSession.Close, which sometimes crashes. When it does, any one of the following errors can occur: USER 30, USER 42, KERN-EXEC 3.