Declare "sha1_init" statically to avoid naming conflicts if linked statically with other libraries providing a method with the same name (e.g. OpenSSL).
Support empty ping and pong packets.
Added additional LWS_CALLBACK_CLOSED_HTTP callback to just_kill_connection branch of close_and_free_session
add CMake find function for libwebsockets

Signed-off-by: Jiri Hnidek <jiri.hnidek@tul.cz>
Request "send" not to trigger SIGPIPE on errors.
fix http incomplete send handling

Signed-off-by: David Gauchard <gauchard@laas.fr>
change LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION user param usage

Also audit the bail_nuke_ah usage as Daniel Griscom suggested.

Signed-off-by: Andy Green <andy.green@linaro.org>
trac 36 make libwebsocket_set_timeout public

Signed-off-by: Andy Green <andy.green@linaro.org>
cmake fix for osx 64 bit

AG tested on 64-bit Fedora no problems

Signed-off-by: Erland Isaksson <erland@isaksson.info>
trac #39: allow fd 0 for connection

Reported (with fix) by Martijn The http://libwebsockets.org/trac/ticket/39

Signed-off-by: Andy Green <andy.green@linaro.org>
remove bae64 decode and selftest

Signed-off-by: Andy Green <andy.green@linaro.org>
force failed header parse to act

''...Websocket servers return failure responses other than HTTP Status 101 in the case of
mismatches of WebSocket version or additional header data etc...
It seems that libwebsockets shows "WARN: problems parsing header" error in such cases without
calling any callbacks or returning error code. Is this right?
I modified lib/client.c to handle this.''

Signed-off-by: Fujii Bunichiroh <Bunichiroh.Fujii@jp.sony.com>
trac 40 client connection properly nonblocking

As spotted by JM on Trac#40

http://libwebsockets.org/trac/libwebsockets/ticket/40

client connect didn't do anything about being truly nonblocking.  This patch
should hopefully solve that.

Signed-off-by: Andy Green <andy.green@linaro.org>
add explicit error for partial send

This patch adds code to handle the situation that a prepared user buffer could not all be sent on the
socket at once.  There are two kinds of situation to handle

1) User code handles it: The connection only has extensions active that do not rewrite the buffer.
In this case, the patch caused libwebsocket_write() to simply return the amount of user buffer that
was consumed (this is specifically the amount of user buffer used in sending what was accepted,
nothing else).  So user code can just advance its buffer that much and resume sending when the socket
is writable again.  This continues the frame rather than starting a new one or new fragment.

2) The connections has extensions active which actually send something quite different than what the
user buffer contains, for example a compression extension.  In this case, libwebsockets will dynamically
malloc a buffer to contain a copy of the remaining unsent data, request notifiction when writeable again,
and automatically spill and free this buffer with the highest priority before passing on the writable
notification to anything else.  For this situation, the call to write will return that it used the
whole user buffer, even though part is still rebuffered.

This patch should enable libwebsockets to detect the two cases and take the appropriate action.

There are also two choices for user code to deal with partial sends.

1) Leave the no_buffer_all_partial_tx member in the protocol struct at zero.  The library will dyamically
buffer anything you send that did not get completely written to the socket, and automatically spill it next
time the socket is writable.  You can use this method if your sent frames are relatvely small and unlikely to get
truncated anyway.

2) Set the no_buffer_all_partial_tx member in the protocol struct.  User code now needs to take care of the
return value from libwebsocket_write() and deal with resending the remainder if not all of the requested amount
got sent.  You should use this method if you are sending large messages and want to maximize throughput and efficiency.

Since the new member no_buffer_all_partial_tx will be zero by default, this patch will auto-rebuffer any
partial sends by default.  That's good for most cases but if you attempt to send large blocks, make sure you
follow option 2) above.

Signed-off-by: Andy Green <andy.green@linaro.org>
fix clean return path user code handle

Signed-off-by: Andy Green <andy.green@linaro.org>
use compatible_close for sockets

Signed-off-by: Andy Green <andy.green@linaro.org>
fix typo in NO_SERVER case

Reported-by: shyswork via github
Signed-off-by: Andy Green <andy.green@linaro.org>
CMAKE help if cwd not git dir

Hi all,

please consider applying the patch below. The git is called in some
different directory and that is why fails. I'm not sure why it was
called in different directory, maybe because I build libwebsockets
with CMake's ExternalProject.

Best,
Arokux

Signed-off-by: Arokux X <arokux@gmail.com>
manual proxy forcing api

add function to manually setup proxy. Useful on iOS where
 getenv doesn't return proxy settings

Simplified by AG

Signed-off-by: shys <shyswork@zoho.com>
Signed-off-by: Andy Green <andy@warmcat.com>
wait ssl connect completion on client proxy path

Subject: [PATCH] We can ran into situation (at least on iOS) when with openssl
 nonblocking BIO and http proxy we don't perform ssl_connect straight away so
 we need to retry until we finish ssl_connect. If we don't do that we will
 fail in LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY when testing for "HTTP/1.0
 200" successful connection.

Signed-off-by: shys <shyswork@zoho.com>