plugins/alarm_curl: turn on SMTP protocol

Compiler ignores SMTP support because enums CURLOPT_MAIL_RCPT and
CURLPROTO_SMTP are misused as macros for conditional compilation.

Replace the enums with real macro CURLPROTO_SMTP so compiler can
detect them.
plugins/alarm_curl: exit when requested protocol is not support

When SMTP is not supported by libcurl, or user doesn't provide
required URL for libcurl, throw an error message and then exit.
plugins/alarm_curl: free memory used during parsing args
plugins/alarm_curl: use CRLF instead of LF for line break in MIME

Though most programs accept LF, MIME RFC explicitly requires CRLF.
plugins/alarm_curl: add SSL option to skip certificate verification

The new option ssl_insecure is equivalent to curl command line
option --insecure or -k, which is useful for posting alarms via
HTTPS to a server with self-generated certificate installed.
plugins/alarm_curl: fix read callback function for libcurl

The read callback for libcurl shouldn't return size that is larger
than the requested size when it's too small to hold email header.
Otherwise curl will abort the operation. And we shouldn't return
1 (which is the current behavior) while there is no header at all.

The expected size of the infile set by option CURLOPT_INFILESIZE
or CURLOPT_INFILESIZE_LARGE should include both header and body
sizes. The infile size is used when server supports the optional
"SIZE" parameter of "MAIL FROM" command. libcurl hangs when wrong
size is passed in.

Since email header remains unchanged for each alarm_curl instance,
we don't have to generate it per alarm request. Based on this, the
solution is quite simple: we generate the header once during
initialization and use it for all alarms.
plugins/{airbrake,alarm_curl,alarm_xmpp}: fix race condition

A thread may run immediately after it's created. Trying to pass
parameter to thread using uwsgi_thread->data without preventing
the thread from accessing it first is a race condition. If the
thread accesses uwsgi_thread->data first, uwsgi gets killed by
SIGSEGV.

This patch creates a new function uwsgi_thread_new_with_data()
to assign user provided data to uwsgi_thread->data before the
thread is created.
plugins/alarm_curl: refactor code

No need to calloc struct uwsgi_alarm_curl_config because all data
we need is populated and stored in struct uwsgi_alarm_curl.

Save some memory when there are hundreds of curl-based alarms.
plugins/alarm_curl: option for disabling dedicated alarm threads

A new global option alarm-cheap allows users to disable creating
thread per curl-based alarm. This option can be extended to other
alarm plugins like xmpp.
Merge pull request #606 from getcwd/master

plugins/alarm_curl ehancement
do not explode on milliseconds wait
fixed sharedarea waiting
fixed json escaper
fixed fastcgi parser
t/perl/test_hello.psgi: perl test file that does nothing but hello, world

To test a bare-minimal Perl program that does almost nothing at all.
Merge pull request #612 from avar/add-perl-hello-world-test-file

t/perl/test_hello.psgi: perl test file that does nothing but hello, worl...
t/perl/test_sleepy.psgi: perl test file that sleeps a bit

This is to test non-CPU bound servers that are waiting on
something (e.g. a database), expecting that we can have a lot more than
num CPU cores of these and not see performance degration.
t/perl/hello_benchmark.pl: silly benchmark for CPU count + thunder lock

This is to test how the number of processes and using thunder-lock or
not affects response times.
Merge pull request #613 from avar/more-perl-tests-and-benchmarks

More perl tests and benchmarks
core/routing: add "return" action

The new action will allow users to write simplified "break" clause.
For example, "return:403" is equivalent to "break:403 Forbidden",
with response body "Forbidden". The response body is quite useful
for telling end users what goes wrong.