In most cases the close api will see it should send the CCE because
we are still in the waiting server reply state until the end of the
interpretation. Only if we completed the interpretation and moved
on to ESTABLISHED do we need to handle sending it ourselves.
Signed-off-by: Andy Green <andy.green@linaro.org>
After "rerelease"
https://github.com/warmcat/libwebsockets/issues/392#issuecomment-170003294
Since we introduced partial buffering a long while ago,
user code shold never see partial sends and very few
user callbsck attempt to deal with them.
Let's just eliminate the whole concept of user callback
partial send handling under any circumstances.
Signed-off-by: Andy Green <andy.green@linaro.org>
Remove declarations of callback and extension_callback as these are
functions declared in header but not defined anywhere.
Also rename typedefs callback_function and extension_callback_function
to lws_callback_function and lws_extension_callback_function so all
symbolx exported by header have lws prefix;
Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
Considering we go through it once per incoming char, the tests to see if we
should be checking utf-8 are too expensive... move them to a bit that lives
in the wsi and set them once per frame (except for CLOSE who has to update
after the close code has been skipped).
Signed-off-by: Andy Green <andy.green@linaro.org>
Server side has had immediate RX flow control for quite a while.
But client side made do with RX continuing until what had been received was exhausted.
For what Autobahn tests, that's not enough.
This patch gives clientside RX flow control the same immediate effect as the server
side enjoys, re-using the same code.
Signed-off-by: Andy Green <andy.green@linaro.org>
Because extensions may use them, we didn't reject on reserved opc or bits set,
just ignored. But the standard does say we should, so now we do.
Signed-off-by: Andy Green <andy.green@linaro.org>
We only supported those specific control packet payloads up to 124.
125 is the correct limit.
Lws was consistent about the wrong limit so there are no other
issues. It doesn't affect user ABI correcting it either.
Signed-off-by: Andy Green <andy.green@linaro.org>
If the final message fragment contains a payload that has to be
handled in multiple RX callbacks, until now we reported the ws
fragment header FIN state in lws_is_final_fragment().
That was correct, but it's kind of not useful to hear that the
intermediate bufferloads are "final". So now we delay
reporting the logical ws fragment FIN until the final part of
his payload is delivered.
This gets us Autobahn 1.1.6 working.
Signed-off-by: Andy Green <andy.green@linaro.org>
Again we treat user code sending zero length things as a bug in user code.
But Autobahn insists to be able to do it, so now we allow it.
That buys us a pass on Autobahn test 1.1.1 (the first of a bazillion)
Reproduce with
libwebsockets-test-echo --client localhost --port 9001 -u "/runCase?case=1&agent=libwebsockets" -v -d 65535 -n 1
Signed-off-by: Andy Green <andy.green@linaro.org>
If we enabled libev support, generate a test server variant that uses it.
Libev has sets its face against fixing its warnings and says -Werror is
"stupid". So we work around it for the problems their apis cause in
Travis.
Signed-off-by: Andy Green <andy.green@linaro.org>
This adds an api lws_close_reason() which lets you control what will
be sent in the close frame when the connection is closed by returning
nonzero from the user callback.
The test server demo is extended to prove it works in both directions.
With this, we should have nice close support.
https://github.com/warmcat/libwebsockets/issues/196
Signed-off-by: Andy Green <andy.green@linaro.org>
It saves us ~4KB of lwsl_info / _debug etc strings.
The test app comes in at 114KB then, including 19KB of html, png and ico assets.
Signed-off-by: Andy Green <andy.green@linaro.org>
The only guy who cared about this for a long while
(since I eliminated the pre-standard protocol variants)
was sending a close frame.
- Set it to 0 so old code remains happy. It only affects
user code buffer commit, if there's overcommit no harm
done so no effect directly on user ABI.
- Remove all uses inside the library. The sample apps
don't have it any more and that's the recommendation now.
Signed-off-by: Andy Green <andy.green@linaro.org>
The old google mux thing is long dead
This only affects app buffer sizing, if old apps overcommit, no worries.
Signed-off-by: Andy Green <andy.green@linaro.org>
Further reduces lws size to 512 on x86_64 "for free"
Both this and the last patch only rearrange private struct members.
Also convert win32-specific member from BOOL to bitfield:1.
Signed-off-by: Andy Green <andy.green@linaro.org>
Some of the FreeBSD-specific code in libwebsockets is related to
the FreeBSD kernel, not the general build environment. Thus, it is
important to make this distinction, especially when building on
platforms that have a FreeBSD kernel and a non-FreeBSD userland build
environment, such as Debian GNU/kFreeBSD.
When checking for FreeBSD kernel features, also check for the newly
introduced __FreeBSD_kernel__ preprocessor constant; it is present in
the GNU/kFreeBSD kernel and also in FreeBSD itself since the 9.1 release
about three years ago.
The info struct is too fragile against additions being able to keep soname.
Because if we add something, the library can't count on the user code being
built against latest headers with largest info struct size. Then the user
code may not have zeroed down enough of the struct and give us junk in the
new members.
Add a pool at the end of the info struct that exists so it will be zeroed
down even though no current use for those future members, then later
library versions can compatibly use them without breaking soname if it is
understood 0 means default.
Because keeping sizeof info straight if you add something is now a thing,
also add an lwsl_info letting you confirm it easily.
It's fine if the size of info differs on different platforms. But when
we add things to the struct we need to balance the padding using a scheme
like
short new_member;
unsigned char _padding1[sizeof(void *) - sizeof(short)];
which is immune to differences in platform differences in sizeof void *.
Signed-off-by: Andy Green <andy.green@linaro.org>