Commit Graph

233 Commits

Author SHA1 Message Date
Florian Behrens
0e8a2ce3ed Fix typo in example javadoc
fix #706
2017-07-31 09:07:07 -07:00
Vinnie Falco
a5917c9044 Don't use program_options 2017-07-26 15:18:25 -07:00
Eliott Paris
73871cfb7f Fix Deferred Body Type Example inconsistencies
Fix issue #675
2017-07-25 06:49:48 -07:00
Vinnie Falco
8578f3cf76 Update copyrights 2017-07-24 09:42:51 -07:00
Vinnie Falco
982f4c3b70 Update documentation for boost 2017-07-24 09:41:27 -07:00
Vinnie Falco
198846d7bd Update CMakeLists.txt for boost 2017-07-23 20:04:07 -07:00
Vinnie Falco
b97586b318 Remove use of lexical_cast 2017-07-23 17:34:41 -07:00
Vinnie Falco
7139dd639a Boost prep 2017-07-23 17:34:13 -07:00
Vinnie Falco
cb501a07c8 WebSocket optimizations (API Change):
The websocket stream is optimized to contain a small
circular static buffer, reducing the number of I/O calls when
reading data. The size of the buffer is tuned for maximum
performance with TCP/IP and no long needs configuration:

* read_some replaces read_frame
* write_some replaces write_Frame
* async_read_some replaces async_read_frame
* async_write_some replaces async_write_frame

* websocket::stream::read_buffer_size is removed

Actions Required:

* Remove calls websocket::stream::read_buffer_size

* Use read_some and write_some instead of read_frame and write_frame
2017-07-20 08:15:32 -07:00
Vinnie Falco
04887c49e0 Documentation work 2017-07-20 08:15:32 -07:00
Vinnie Falco
bd5ab6ffd0 Add wstest benchmark tool 2017-07-20 08:15:32 -07:00
Vinnie Falco
94e92e75b7 Rename to flat_static_buffer and flat_static_buffer_base (API Change):
Actions Required:

* Rename static_buffer to flat_static_buffer_base
* Rename static_buffer_n to flat_static_buffer
2017-07-20 08:15:31 -07:00
Vinnie Falco
1d7d7445d5 Add session_alloc to example/common 2017-07-20 08:15:31 -07:00
Vinnie Falco
4b71aa67e0 Refactor chunked parsing (API Change):
* parser now has a callback feature for intercepting chunk headers
  and chunk bodies

* The names for basic_parser derived class callbacks have been
  refactored

* basic_parser offers an additional callback for distinguishing
  chunk body data.

Actions Required:

* Adjust signatures for required members of user-defined
  subclasses of basic_parser

* Use the new basic_parser chunk callbacks for accessing
  chunk extensions and chunk bodies.
2017-07-20 08:15:31 -07:00
Vinnie Falco
ff15cf8688 Refactor chunked-encoding serialization:
New buffer sequence classes are provided to allow full
control over the serialization of chunk-encoded message
payloads:

* chunk_header

    A ConstBufferSequence representing the chunk header.
    It includes a hexadecimal-encoded size, an optional
    set of chunk extensions, and the trailing CRLF
    required to denote the end of the chunk header.

    This allows the caller to manually serialize the chunk
    body in one or more calls to a stream output function.
    The caller must also output an object of type `chunk_crlf`
    to the stream to indicate the end of the chunk body.

* chunk_crlf

    A small ConstBufferSequence that simply represents
    the two character sequence "\r\n" (CRLF). This is needed
    for the case where the caller wants to output a chunk
    body as a series of buffers (i.e. "chunking a chunk").

* chunk_body

    A ConstBufferSequence representing a complete chunk.
    This includes the size, an optional set of chunk extensions,
    a caller provided buffer containing the body, and the
    required CRLF that follows.

* chunk_final

    A ConstBufferSequence representing a final chunk. It
    includes an optional set of caller-provided field trailers

* chunk_extensions

    A container for building a set of chunk extensions to use
    during serialization. The use of the container is optional,
    callers may provide their own buffer containing a correctly
    formatted set of chunk extensions, or they may use their
    own convenience container which meets the requirements.

The basic_fields container is modified to allow construction
outside the context of a message. The container can be used
to provide trailers to `chunk_final`.

Actions Required:

* Remove references to ChunkDecorators. Use the new chunk-encoding
  buffer sequences to manually produce a chunked payload body in
  the case where control over the chunk-extensions and/or trailers
  is required.
2017-07-20 08:15:31 -07:00
Vinnie Falco
30ea9bf668 Fix warning in root ca declaration 2017-07-20 08:15:30 -07:00
Vinnie Falco
f34d4f7204 span, string, vector bodies are public 2017-07-20 08:15:30 -07:00
Vinnie Falco
37110f2d04 Add span_body 2017-07-20 08:15:30 -07:00
Vinnie Falco
cc198db10e serializing file_body is not const 2017-07-20 08:15:30 -07:00
Vinnie Falco
e06a055503 BodyReader, BodyWriter use two-phase init (API Change):
These types now perform error-based initialization in
a separate init() functions instead of in the constructor.

Actions Required:

* Modify instances of user-defined BodyReader and BodyWriter
  types to perfrom two-phase initialization, as per the
  updated documented type requirements.
2017-07-20 08:15:30 -07:00
Christopher Kohlhoff
8179019590 Use file_body for valid requests, string_body otherwise. 2017-07-20 08:15:30 -07:00
Andrzej Krzemieński
d6bac17bff remove redundant flush() from example:
`<<std::endl` already flushes the stream; no need for a separate call.
2017-07-20 08:15:30 -07:00
Vinnie Falco
e81026614a Remove common/file_body.hpp 2017-07-20 08:15:30 -07:00
Vinnie Falco
37461a1c4c Fixes for gcc-4.8 2017-07-20 08:15:30 -07:00
Vinnie Falco
c01dddc4ac Verify certificates in SSL clients 2017-07-20 08:15:30 -07:00
Vinnie Falco
f5ae60613f serializer::next replaces serializer::get (API Change):
Actions Required:

* Use serializer::next instead of serializer::get at call sites
2017-07-20 08:15:29 -07:00
Vinnie Falco
b0e52dd246 Refactor header and message constructors:
fix #581

* request and response headers now have convenience
  constructors so important fields like method, target,
  result, and version may be set upon construction.

Actions Required:

* Evaluate each message constructor call site and
  adjust the constructor argument list as needed.
2017-07-20 08:15:29 -07:00
chriskohlhoff
7e61a48607 Various improvements to http_server_fast.cpp:
fix #578

- Receive request in a single read
- Use fields_alloc for response
- Fix command line usage information
- Add command line option to spin the io_service
2017-07-20 08:15:29 -07:00
Vinnie Falco
a281ca5384 Documentation tidying 2017-07-20 08:15:29 -07:00
Vinnie Falco
6b6c2e0f93 Add websocket-server-async example 2017-07-20 08:15:29 -07:00
Vinnie Falco
c12ded9abc Add http-server-threaded example 2017-07-20 08:15:29 -07:00
Vinnie Falco
09df24ec62 Refactor file_body for best practices 2017-07-20 08:15:29 -07:00
Vinnie Falco
a2ca4e41ca Tidy up set payload in http-server-fast 2017-07-20 08:15:29 -07:00
Vinnie Falco
8910ab44ae Tidy up http_sync_port error check 2017-07-20 08:15:29 -07:00
octopus-prime
ebfc3f4537 Fix buffer overflow handling for string_body and mutable_body
fix #553, fix #558
2017-07-20 08:15:29 -07:00
Vinnie Falco
c149321013 Return std::size_t from Body::writer::put (API Change)
`put` returns the number of bytes actually transferred
from the input buffers.

Actions Required:

* Return the number of bytes actually transferred from the
  input buffers in user defined `Body::writer::put` functions.
2017-07-20 08:15:29 -07:00
Vinnie Falco
2878b38b64 Call prepare_payload in HTTP example 2017-07-20 08:15:29 -07:00
Vinnie Falco
2843a497a0 Documentation revision
fix #567, fix #572
2017-07-20 08:15:29 -07:00
octopus-prime
9fe7f6e415 Fix HEAD response in file_service 2017-07-20 08:15:29 -07:00
octopus-prime
b5b1295d0c Add const_body, mutable_body to examples 2017-07-20 08:15:29 -07:00
Vinnie Falco
8207a53113 Adjust buffer size in fast server 2017-07-20 08:15:29 -07:00
Vinnie Falco
beead1a297 Split common tests to a new project 2017-07-20 08:15:29 -07:00
Vinnie Falco
edeb44617b Remove BodyReader::is_deferred (API Change):
The is_deferred nested type is removed from the BodyReader
requirements.

Performance for sending messages with `file_body` was cut
almost in half with is_deferred as `std::true_type` since
it caused double the number of socket writes. If the
deferred behavior is absolutely necessary, callers can get
the same effect by manually sending the headers first.

Actions Required:

* Callers who need the behavior of is_deferred as `std::true_type`
  should manually construct a serializer and serialize the header
  first, followed by the body.
2017-07-20 08:15:29 -07:00
Vinnie Falco
bf59634bc2 Change BodyReader, BodyWriter requirements (API Change):
Actions Required:

* Change user defined instances of BodyReader and BodyWriter
  to meet the new requirements.
2017-07-20 08:15:29 -07:00
Vinnie Falco
bb1dd72638 Group common example headers 2017-07-20 08:15:29 -07:00
Vinnie Falco
84d7601bdf Rename to http-server-fast 2017-07-20 08:15:29 -07:00
Vinnie Falco
fc15f5e0b2 Add http-server-small example 2017-07-20 08:15:28 -07:00
Vinnie Falco
e5f1d4d010 Add http-server example 2017-07-20 08:15:28 -07:00
Vinnie Falco
86244c8dcf Add serializer request/response aliases 2017-07-20 08:15:28 -07:00
Vinnie Falco
8f4e7fd0a0 Fix unused variable warnings 2017-07-20 08:15:28 -07:00
Vinnie Falco
d70a78bbda Fix integer warnings 2017-07-20 08:15:28 -07:00
Vinnie Falco
e477574681 Remove make_serializer (API Change):
Actions Required:

* Replace calls to make_serializer with variable declarations
2017-07-20 08:15:28 -07:00
Vinnie Falco
b2ab40f09c Doc tidying
fix #521, fix #524
2017-07-20 08:15:28 -07:00
Vinnie Falco
77a4c36aeb Better User-Agent in examples
fix #523
2017-07-20 08:15:28 -07:00
Vinnie Falco
65b127d2e6 Tidy up Jamfiles 2017-07-20 08:15:28 -07:00
Vinnie Falco
26b5e91725 Tidy up CMakeLists.txt 2017-07-20 08:15:28 -07:00
Vinnie Falco
9c4b3ed2a7 Only build and run tests in variant=coverage 2017-07-20 08:15:27 -07:00
Vinnie Falco
e5f0774687 Use std::to_string instead of lexical_cast
fix #518
2017-07-20 08:15:27 -07:00
Vinnie Falco
f4c65a5ba6 Squelch harmless not_connected errors 2017-07-20 08:15:27 -07:00
Vinnie Falco
56a561da9a message::prepare_payload replaces message::prepare (API Change):
Actions Required:

* Change calls to msg.prepare to msg.prepare_payload. For messages
  with a user-defined Fields, provide the function prepare_payload_impl
  in the fields type according to the Fields requirements.
2017-07-20 08:15:27 -07:00
Vinnie Falco
087844c487 Narrow the use of Fields parameters:
Every interface or implementation which operates on a templated
type Fields is evaluated to determine if basic_fields<Allocator>
is more appropriate, and changed if so.
2017-07-20 08:15:27 -07:00
Vinnie Falco
50902c3938 parser requires basic_fields (API Change):
* `parser` is now templated on Allocator

* `parser` only produces messages using `basic_fields<Allocator>`
  as the Fields type.

* message-oriented read and async_read only work on messages
  using basic_fields as the Fields type.

Actions Required:

* Callers using `parser` with Fields types other than basic_fields
  will need to create their own subclass of basic_parser to work
  with their custom fields type.
2017-07-20 08:15:27 -07:00
Vinnie Falco
fc09a4cad1 Tidy up namespaces in examples 2017-07-20 08:15:27 -07:00
Vinnie Falco
c3e2de29ef Doc fixes and tidy 2017-07-20 08:15:27 -07:00
Vinnie Falco
79eb97fbd6 Add server-framework tests 2017-07-20 08:15:27 -07:00
Vinnie Falco
0a4f964811 Tidy up resolver calls 2017-07-20 08:15:27 -07:00
Vinnie Falco
a4a4121444 Add multi_port to server-framework 2017-07-20 08:15:27 -07:00
Vinnie Falco
f6e0e5ef47 Tidy up http-crawl example
fix #513
2017-07-20 08:15:27 -07:00
Vinnie Falco
8b5f5c6feb Reorganize SSL examples 2017-07-20 08:15:27 -07:00
Vinnie Falco
8f627b0748 Fix shadowing warnings
fix #510
2017-07-20 08:15:27 -07:00
Vinnie Falco
65932ee343 Add server-framework SSL HTTP and WebSocket ports 2017-07-20 08:15:27 -07:00
Vinnie Falco
74891560ae Refactor WebSocket, HTTP examples:
fix #297, fix #488

* Errors are checked and reported
* More comments explaining what is going on
* The connection is gracefully closed

WebSocket:

* Messages are drained before closing
2017-07-20 08:15:27 -07:00
Vinnie Falco
298bf5fbb1 Flush the output stream in the example 2017-07-20 08:15:27 -07:00
Vinnie Falco
30e6426db5 Tidy up some integer conversion warnings 2017-07-20 08:15:27 -07:00
Vinnie Falco
9be141a1e0 Reorganize SSL examples 2017-07-20 08:15:27 -07:00
Vinnie Falco
d12d686167 Documentation work 2017-07-20 08:15:27 -07:00
Vinnie Falco
a26017d695 Use generic_cateogry for errno 2017-07-20 08:15:27 -07:00
Vinnie Falco
fd9a13b11f New server-framework, full featured server example:
A new server framework is introduced, allowing users to
quickly get off the ground. Example servers are refactored
to use the common framework.
2017-07-20 08:15:26 -07:00
Vinnie Falco
b5306a5712 String comparisons are public interfaces 2017-07-20 08:15:26 -07:00
Vinnie Falco
611e610c0c Change Body::size signature (API Change):
fix #497

This changes the function signature to accept the `value_type`
instead of the entire message.

Actions Required:

* For any user-defined models of Body, change the function signature
  to accept `value_type const&` and modify the function definition
  accordingly.
2017-07-20 08:15:26 -07:00
Sacha
0a2a03acfa Integrated Beast interface. 2017-07-20 08:15:26 -07:00
Vinnie Falco
eb7e971c7a Renamed to basic_fields::set (API Change):
* `replace` is renamed to `set`

Actions Required:

* Rename calls to `basic_fields::replace` to `basic_fields::set`
2017-07-20 08:15:26 -07:00
Vinnie Falco
510092d34b Reorganize examples:
* The examples/ directory is renamed to example/

* Each program is in its own directory with its own build scripts
2017-07-20 08:15:26 -07:00