Commit graph

26 commits

Author SHA1 Message Date
Andy Green
4219a3281d server-name: add_server_header add LWSAHH_FLAG_NO_SERVER_NAME
Also clean up usage of status code defines in lws
2017-03-08 07:51:47 +08:00
Andy Green
b9dd61bb6f server-name: default to no server name unless set in context 2017-03-08 07:35:27 +08:00
Andy Green
e35d91a860 per-vhost headers and lwsws conf support
This l;ets you add per-vhost arbitrary headers on served files, eg

     "headers": [{
        "X-Content-Type-Options": "nosniff",
        "X-XSS-Protection": "1; mode=block",
        "x-frame-options": "SAMEORIGIN"
        }],
2016-08-27 17:07:06 +08:00
Andy Green
7acf76cd3d esp8266 initial support 2016-08-10 21:20:23 +08:00
Andy Green
014481e912 documentation convert to doxygen
Signed-off-by: Andy Green <andy@warmcat.com>
2016-07-14 08:57:27 +08:00
Andy Green
e7c1c757cd replace LWS_MAX_SOCKET_IO_BUF with context creation info pt_serv_buf_size
This makes it easy for user code to choose the size of the per-thread
buffer used by various things in lws, including file transfer chunking.

Previously it was 4096, if you leave info.pt_serv_buf_size as zero that
is still the default.

With some caveats, you can increase transfer efficiency by increasing it
to, eg, 128KiB, if that makes sense for your memory situation.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-05-19 12:34:35 +08:00
Andy Green
f79534e0a4 post example in test server
https://github.com/warmcat/libwebsockets/issues/501

This demonstrates how to do a 303 redirect on POST and provide
the results there, in both libwebsockets-test-server and the
plugin version.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-25 10:04:49 +08:00
Andy Green
42e8b189dc http cache policy
This allows mounts to define the caching policy of the files inside them.

Support is added in lwsws for controlling it from the config files.

The api for serializing a mount struct opaquely is removed and lws_http_mount struct
made public... it was getting out of control trying to hide the options.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-22 08:53:49 +08:00
Andy Green
7e2c3851bf redirects need fake content metadata
Chrome deals with it without on desktop, but Android chrome
waits for the connection to time out before actioning the
redirect, since it feels there might be html payload coming.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 20:09:36 +08:00
Andy Green
b21c20b5ff context settable server string
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:58:24 +08:00
Andy Green
cec2fd55a8 lws normalize http response
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:58:24 +08:00
Andy Green
2f0bc93d46 lws access log option and lwsws conf
This adds the ability to store apache-compatible logs to a file given at
vhost-creation time.

lwsws conf can set it per-vhost using "access-log": "<filepath>"

The feature defaults to disabled at cmake, it can be set independently but
LWS_WITH_LWSWS set it on.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-15 13:58:24 +08:00
Andy Green
868b9f2ecb strict transport security vhost option flag and lwsws conf support
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-14 21:27:38 +08:00
Andy Green
c6b0b607d4 lws_return_http_status send content length
If we're sending content, we must do so with a
content-length on http/1.1

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-20 07:53:24 +08:00
Andy Green
d3a5505542 multithreaded service
This adds support for multithreaded service to lws without adding any
threading or locking code in the library.

At context creation time you can request split the service part of the
context into n service domains, which are load-balanced so that the most
idle one gets the next listen socket accept.

There's a single listen socket on one port still.

User code may then spawn n threads doing n service loops / poll()s
simultaneously.  Locking is only required (I think) in the existing
FD lock callbacks already handled by the pthreads server example,
and that locking takes place in user code.  So the library remains
completely agnostic about the threading / locking scheme.

And by default, it's completely compatible with one service thread
so no changes are required by people uninterested in multithreaded
service.

However for people interested in extremely lightweight mass http[s]/
ws[s] service with minimum provisioning, the library can now do
everything out of the box.

To test it, just try

$ libwebsockets-test-server-pthreads -j 8

where -j controls the number of service threads

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-19 20:02:36 +08:00
Andy Green
6711266a50 extension permessage deflate
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-11 11:34:01 +08:00
Andy Green
6d64539fcb lws_get_context not _ctx
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 18:25:25 +08:00
Andy Green
54806b1541 clean internal refactor
- Mainly symbol length reduction
 - Whitespace clean
 - Code refactor for linear flow
 - Audit @Context for API docs vs changes

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 17:03:59 +08:00
Andy Green
11c05bfa09 public api remove superfluous context params API BREAK
Extend the cleanout caused by wsi having a context pointer
into the public api.

There's no point keeping the 1.5 compatibility work,
we have changed the api in several places and
rebuilt wasn't going to be enough a while ago.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-16 18:19:08 +08:00
Andy Green
4eb36373d7 http uri arguments process in fragments
This makes the URI argument processing split each parameter into
a "fragment".  Processing header content as fragments already exists
in lws, because it's legal to deliver header content by repeating
the header.

Now there's an api to access individual fragments, also add the
code to the test server to print each URI argument separately.

Adapt attack.sh to parse the fragments.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 23:07:31 +08:00
Andy Green
d478fb8c38 clean more whitespace 3
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-06 08:40:00 +08:00
Andy Green
cef609df80 fix Uri Args header name
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-04 11:57:48 +08:00
Andy Green
4b85c1d4ac api rationalization: eliminate all libwebsocket[s]_ prefixes
This nukes all the oldstyle prefixes except in the compatibility code.

struct libwebsockets becomes struct lws too.

The api docs are updated accordingly as are the READMEs that mention
those apis.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-04 11:08:32 +08:00
Andy Green
6230476455 api rationalization use new names internally
Change all internal uses of rationalized public apis to reflect the
new names.

Theer are a few things that got changed as side effect of search/replace
matches, but these are almost all internal.  I added a compatibility define
for the public enum that got renamed.

Theoretically existing code should not notice the difference from these
two patches.  And new code will find the new names.

https://github.com/warmcat/libwebsockets/issues/357

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-04 08:43:54 +08:00
Andy Green
2cd3074746 mbed3 warning cleaning
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-11-14 16:31:01 +08:00
wonder-mice
0c5aa2f484 Subject: [PATCH] Add missing lib/header.c file
File was lost during merge to upstream.
2015-04-24 07:22:52 +08:00