Commit Graph
185 Commits
Author SHA1 Message Date
Vinnie Falco 37110f2d04 Add span_body 2017-07-20 08:15:30 -07:00
Vinnie Falco c9908eada0 Tidy up includes and javadocs 2017-07-20 08:15:30 -07:00
Vinnie Falco e1de01ad13 Add vector_body
fix #580
2017-07-20 08:15:30 -07:00
Vinnie Falco c6d7fa185b Tidy up basic_string_body
fix #580
2017-07-20 08:15:30 -07:00
Vinnie Falco a00ce1209b Fix parse illegal characters in obs-fold 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
Vinnie Falco db59a92011 BodyReader may construct from a non-const message
fix #619
2017-07-20 08:15:30 -07:00
Vinnie Falco 0324dc371f Use Boost.Config 2017-07-20 08:15:30 -07:00
Vinnie Falco f65a611b85 Always go through write_some:
HTTP stream serialization algorithms always go
through write_some or async_write some.
2017-07-20 08:15:30 -07:00
Vinnie Falco b1a8cf8a13 file_body tests 2017-07-20 08:15:30 -07:00
Vinnie Falco 731164bec2 Add serializer::limit 2017-07-20 08:15:30 -07:00
Vinnie Falco 8bf46ffa05 Add file_body 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
Vinnie Falco 2ee088de5f Add basic_parser tests 2017-07-20 08:15:29 -07:00
Vinnie Falco e608acb791 basic_parser optimizations:
fix #185, fix #489

* SSE4.2 is detected

* basic_parser uses SSE4.2 if available

* basic_parser tries to parse on the initial buffer and if
  it does not find the end of header it shifts to a new
  strategy of waiting for the end of header to defeat
  slow loris attacks. This coincidentally is also faster
  than the previous algorithm.
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 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 f3afc834b1 Check trailers in test 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
Vinnie Falco 7753d6eda2 Add parser::on_header to set a callback 2017-07-20 08:15:29 -07:00
Vinnie Falco 788550e833 Add basic_parser header and body limits:
fix #550

* default body limits are now 1MB/8MB
* default header limit is 8KB

Actions Required:

* Call body_limit and/or header_limit as needed to adjust the
  limits to suitable values if the defaults are insufficient.
2017-07-20 08:15:29 -07:00
Vinnie Falco f3eaa409d1 basic_parser optimizations 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 43f8bb841a bad_target replaces bad_path (API Change):
Actions Required:

* Replace references to http::error::bad_path with http::error::bad_target
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 e389b853c5 Documentation work 2017-07-20 08:15:28 -07:00
Vinnie Falco dab5d3bc12 Handle bad_alloc in parser 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 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 7b8149cfd4 Move benchmarks to a separate project 2017-07-20 08:15:27 -07:00
Vinnie Falco 9c4b3ed2a7 Only build and run tests in variant=coverage 2017-07-20 08:15:27 -07:00
Vinnie Falco 5613ce7e97 Add http::is_fields trait
fix #515
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 f9f6e1e0cc Refine FieldsReader concept (API Change)
* FieldsReader now requires chunked() and keep_alive()

* serializer logic calls into the reader to calculate
  the message metadata

* Removed some of the previous requirements of FieldsReader

Actions Required:

* Implement chunked() and keep_alive() for user defined FieldsReader types.
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 4d393f4c2a Clear the error faster 2017-07-20 08:15:27 -07:00
Vinnie Falco d5f15976e7 Tidy up test build scripts and projects 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 c8b8439ebc Tidy up names in error categories 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
Sacha 0a2a03acfa Integrated Beast interface. 2017-07-20 08:15:26 -07:00
Vinnie Falco dba4be01ab Fix parsing chunk size with leading zeroes
fix #496
2017-07-20 08:15:26 -07:00
Vinnie Falco f64109d79a Fix basic_fields insert ordering 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