From: Jean Privat Date: Wed, 10 Jun 2015 01:47:05 +0000 (-0400) Subject: Merge: Work on the Curl module X-Git-Tag: v0.7.6~52 X-Git-Url: http://nitlanguage.org Merge: Work on the Curl module Changes: * Simplify callbacks so they do not break light FFI only engines. * Remove about 8 classes and 3 C structures. * Remove the custom implementation of NativeFile. * Update style to the latest best practices. Note that it was one of the first large module based on the FFI, a lot has changed since then. * Revamp and rename CurlMail, its API is now nicer to use: ~~~ import curl var mail = new CurlMail("sender@example.org", ["to@example.org"], cc=["bob@example.org"]) mail.subject = "Hello From My Nit Program" mail.body = "

Here you can write HTML stuff.

" mail.headers_body["Content-Type:"] = """text/html; charset="UTF-8"""" mail.headers_body["Content-Transfer-Encoding:"] = "quoted-printable" # Set mail server var error = mail.set_outgoing_server("smtps://smtp.example.org:465", "user@example.org", "mypassword") assert error == null # Send error = mail.execute assert error == null ~~~ Thoughts on what's to do next: * Extract the request API so Curl is only an implementation. The abstract API could also be implemented on Android where we can use Java services instead. * Clean up `CurlHTTPRequest`. * Use `Error` and differentiate between internal Curl errors and normal transfert failures. * Replace the C structure linked to reading data and add tests for its usage. * Add dead simple services: `Text::download: nullable String`, `Text::download_to_file(filepath: Text)`, `Text::download_to_stream(stream: Writer)` or something like that. * Make more classes of native_curl private as we cannot make the module private because it defines the user-customizable callbacks. Some modules (neo4j) use what would be private, so it requires updating them also. --- Should fix #936 and other problems when importing but not using Curl. Also helps #1443 correctly report unsupported programs. Pull-Request: #1445 Reviewed-by: Alexandre Terrasa Reviewed-by: Lucas Bajolet Reviewed-by: Jean Privat --- 573e66758196f02aff14dce91de0041802c183be