-
Iustin Pop authored
Currently, the Rapi.getUrl function returns the body without evaluating it, and the other functions (loadData, parseData) do the same. In effect, the top-level structure returned from loadData can be a thunk which depends on the curl operation, thus keeping the curl resources alive even after return from the Rapi module. While this is not a problem in single-threaded programs, it can become an issue with the threaded runtime. So it's better to fully evaluate the HTTP body before returning from the getUrl function, so that at least the curl resources are released. Either "return $! body" or "(code, !body) <- …" works (i.e. avoids the segfaults in my tests), but I think it's cleaner to force full evaluation of the body when returning from the curlGetString function. For this, we also enable the BangPatterns language extension. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Balazs Lecz <leczb@google.com>
c9224fa4