RESTinio

multipart_body.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
12#pragma once
13
14#include <restinio/helpers/string_algo.hpp>
15#include <restinio/helpers/easy_parser.hpp>
16#include <restinio/helpers/http_field_parsers/basics.hpp>
17#include <restinio/helpers/http_field_parsers/content-type.hpp>
18
19#include <restinio/http_headers.hpp>
20#include <restinio/request_handler.hpp>
21#include <restinio/expected.hpp>
22
23#include <restinio/impl/string_caseless_compare.hpp>
24
25#include <restinio/utils/metaprogramming.hpp>
26
27#include <iostream>
28
29 namespace restinio
30{
31
32 namespace multipart_body
33{
34
35//
36// split_multipart_body
37//
70 RESTINIO_NODISCARD
71 inline std::vector< string_view_t >
72 split_multipart_body(
73 string_view_t body,
74 string_view_t boundary )
75{
76 using namespace restinio::string_algo;
77
78 std::vector< string_view_t > result;
79 std::vector< string_view_t > tmp_result;
80
81 const string_view_t eol{ "\r\n" };
82 const string_view_t last_separator{ "--\r\n" };
83
84 // Find the first boundary.
85 auto boundary_pos = body.find( boundary );
86 if( string_view_t::npos == boundary_pos )
87 // There is no initial separator in the body.
88 return result;
89
90 // The first body can be at the very begining of the body or
91 // there should be CRLF before the initial boundary.
92 if( boundary_pos != 0u &&
93 (boundary_pos < eol.size() ||
94 body.substr( boundary_pos - eol.size(), eol.size() ) != eol) )
95 return result;
96
97 auto remaining_body = body.substr( boundary_pos + boundary.size() );
98 if( starts_with( remaining_body, last_separator ) )
99 // The start boundary is the last boundary.
100 return result;
101
102 while( starts_with( remaining_body, eol ) )
103 {
104 remaining_body = remaining_body.substr( eol.size() );
105
106 boundary_pos = remaining_body.find( boundary );
107 if( string_view_t::npos == boundary_pos )
108 return result;
109
110 // There should be CRLF before the next boundary.
111 if( boundary_pos < eol.size() ||
112 remaining_body.substr( boundary_pos - eol.size(), eol.size() ) != eol )
113 return result;
114
115 tmp_result.push_back(
116 remaining_body.substr( 0u, boundary_pos - eol.size() ) );
117
118 remaining_body = remaining_body.substr( boundary_pos + boundary.size() );
119 // Is this boundary the last one?
120 if( starts_with( remaining_body, last_separator ) )
121 {
122 // Yes, our iteration can be stopped and we can return the result.
123 swap( tmp_result, result );
124 return result;
125 }
126 }
127
128 // We didn't find the last boundary. Or some error encountered in the format
129 // of the body.
130 //
131 // Empty result should be returned.
132 return result;
133}
134
135//
136// parsed_part_t
137//
143 struct parsed_part_t
144{
146
150 http_header_fields_t fields;
152 string_view_t body;
153};
154
155 namespace impl
156{
157
158 namespace parser_details
159{
160
161 using namespace restinio::http_field_parsers;
162
163 namespace easy_parser = restinio::easy_parser;
164
165 constexpr char CR = '\r';
166 constexpr char LF = '\n';
167
168//
169// body_producer_t
170//
183 struct body_producer_t
184 : public easy_parser::impl::producer_tag< string_view_t >
185{
186 RESTINIO_NODISCARD
187 expected_t< string_view_t, easy_parser::parse_error_t >
188 try_parse( easy_parser::impl::source_t & from ) const noexcept
189 {
190 // Return the whole content from the current position.
191 return from.fragment( from.current_position() );
192 }
193};
194
195//
196// field_value_producer_t
197//
207 struct field_value_producer_t
208 : public easy_parser::impl::producer_tag< std::string >
209{
210 RESTINIO_NODISCARD
211 expected_t< std::string, easy_parser::parse_error_t >
212 try_parse( easy_parser::impl::source_t & from ) const
213 {
214 std::string accumulator;
215 auto ch = from.getch();
216 while( !ch.m_eof && ch.m_ch != CR && ch.m_ch != LF )
217 {
218 accumulator += ch.m_ch;
219 ch = from.getch();
220 }
221
222 if( ch.m_eof )
223 return make_unexpected( easy_parser::parse_error_t{
224 from.current_position(),
225 easy_parser::error_reason_t::unexpected_eof
226 } );
227
228 // CR or LF symbol should be returned back.
229 from.putback();
230
231 return { std::move(accumulator) };
232 }
233};
234
235} /* namespace parser_details */
236
237//
238// make_parser
239//
252 RESTINIO_NODISCARD
253 auto
254 make_parser()
255{
256 using namespace parser_details;
257
258 return produce< parsed_part_t >(
259 produce< http_header_fields_t >(
260 repeat( 0, N,
261 produce< http_header_field_t >(
262 token_p() >> to_lower() >> custom_consumer(
263 [](auto & f, std::string && v) {
264 f.name(std::move(v));
265 } ),
266 symbol(':'),
267 ows(),
268 field_value_producer_t{} >> custom_consumer(
269 [](auto & f, std::string && v) {
270 f.value(std::move(v));
271 } ),
272 symbol(CR), symbol(LF)
273 ) >> custom_consumer(
274 [](auto & to, http_header_field_t && v) {
275 to.add_field( std::move(v) );
276 } )
277 )
278 ) >> &parsed_part_t::fields,
279 symbol(CR), symbol(LF),
280 body_producer_t{} >> &parsed_part_t::body );
281}
282
283} /* namespace impl */
284
285//
286// try_parse_part
287//
313 RESTINIO_NODISCARD
314 expected_t< parsed_part_t, restinio::easy_parser::parse_error_t >
315 try_parse_part( string_view_t part )
316{
317 namespace easy_parser = restinio::easy_parser;
318
319 easy_parser::impl::source_t source{ part };
320
321 auto actual_producer = impl::make_parser();
322
323 return easy_parser::impl::top_level_clause_t< decltype(actual_producer) >{
324 std::move(actual_producer)
325 }.try_process( source );
326}
327
328//
329// handling_result_t
330//
337 enum class handling_result_t
338{
342 continue_enumeration,
346 stop_enumeration,
350 terminate_enumeration
351};
352
353//
354// enumeration_error_t
355//
361 enum class enumeration_error_t
362{
366 content_type_field_not_found,
368 content_type_field_parse_error,
372 content_type_field_inappropriate_value,
375 illegal_boundary_value,
377 no_parts_found,
381 terminated_by_handler,
383 unexpected_error
384};
385
386 namespace impl
387{
388
389 namespace boundary_value_checkers
390{
391
392// From https://tools.ietf.org/html/rfc1521:
393//
394// boundary := 0*69<bchars> bcharsnospace
395//
396// bchars := bcharsnospace / " "
397//
398// bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" /"_"
399// / "," / "-" / "." / "/" / ":" / "=" / "?"
400//
401 RESTINIO_NODISCARD
402 constexpr bool
403 is_bcharnospace( char ch )
404{
405 return (ch >= '0' && ch <= '9') // DIGIT
406 || ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) // ALPHA
407 || ch == '\''
408 || ch == '('
409 || ch == ')'
410 || ch == '+'
411 || ch == '_'
412 || ch == ','
413 || ch == '-'
414 || ch == '.'
415 || ch == '/'
416 || ch == ':'
417 || ch == '='
418 || ch == '?';
419}
420
421 RESTINIO_NODISCARD
422 constexpr bool
423 is_bchar( char ch )
424{
425 return is_bcharnospace(ch) || ch == ' ';
426}
427
428} /* namespace boundary_value_checkers */
429
430} /* namespace impl */
431
432//
433// check_boundary_value
434//
455 RESTINIO_NODISCARD
456 inline optional_t< enumeration_error_t >
457 check_boundary_value( string_view_t value )
458{
459 using namespace impl::boundary_value_checkers;
460
461 if( value.size() >= 1u && value.size() <= 70u )
462 {
463 const std::size_t last_index = value.size() - 1u;
464 for( std::size_t i = 0u; i != last_index; ++i )
465 if( !is_bchar( value[i] ) )
466 return enumeration_error_t::illegal_boundary_value;
467
468 if( !is_bcharnospace( value[ last_index ] ) )
469 return enumeration_error_t::illegal_boundary_value;
470 }
471 else
472 return enumeration_error_t::illegal_boundary_value;
473
474 return nullopt;
475}
476
477//
478// detect_boundary_for_multipart_body
479//
494 template< typename Extra_Data >
495 RESTINIO_NODISCARD
496 expected_t< std::string, enumeration_error_t >
497 detect_boundary_for_multipart_body(
498 const generic_request_t< Extra_Data > & req,
499 string_view_t expected_media_type,
500 optional_t< string_view_t > expected_media_subtype )
501{
502 namespace hfp = restinio::http_field_parsers;
503 using restinio::impl::is_equal_caseless;
504
505 // Content-Type header file should be present.
506 const auto content_type = req.header().opt_value_of(
507 restinio::http_field::content_type );
508 if( !content_type )
509 return make_unexpected(
510 enumeration_error_t::content_type_field_not_found );
511
512 // Content-Type field should successfuly parsed and should
513 // contain value that correspond to expected media-type.
514 const auto parse_result = hfp::content_type_value_t::try_parse(
515 *content_type );
516 if( !parse_result )
517 return make_unexpected(
518 enumeration_error_t::content_type_field_parse_error );
519
520 const auto & media_type = parse_result->media_type;
521 if( !is_equal_caseless( expected_media_type, media_type.type ) )
522 {
523 return make_unexpected(
524 enumeration_error_t::content_type_field_inappropriate_value );
525 }
526 if( expected_media_subtype &&
527 !is_equal_caseless( *expected_media_subtype, media_type.subtype ) )
528 {
529 return make_unexpected(
530 enumeration_error_t::content_type_field_inappropriate_value );
531 }
532
533 // `boundary` param should be present in parsed Content-Type value.
534 const auto boundary = hfp::find_first(
535 parse_result->media_type.parameters,
536 "boundary" );
537 if( !boundary )
538 return make_unexpected(
539 enumeration_error_t::content_type_field_inappropriate_value );
540
541 // `boundary` should have valid value.
542 const auto boundary_check_result = check_boundary_value( *boundary );
543 if( boundary_check_result )
544 return make_unexpected( *boundary_check_result );
545
546 // Actual value of boundary mark can be created.
547 std::string actual_boundary_mark;
548 actual_boundary_mark.reserve( 2 + boundary->size() );
549 actual_boundary_mark.append( "--" );
550 actual_boundary_mark.append( boundary->data(), boundary->size() );
551
552 return { std::move(actual_boundary_mark) };
553}
554
555 namespace impl
556{
557
567 template< typename Handler >
568 RESTINIO_NODISCARD
569 expected_t< std::size_t, enumeration_error_t >
570 enumerate_parts_of_request_body(
571 const std::vector< string_view_t > & parts,
572 Handler && handler )
573{
574 std::size_t parts_processed{ 0u };
575 optional_t< enumeration_error_t > error;
576
577 for( auto current_part : parts )
578 {
579 // The current part should be parsed to headers and the body.
580 auto part_parse_result = try_parse_part( current_part );
581 if( !part_parse_result )
582 return make_unexpected( enumeration_error_t::unexpected_error );
583
584 // NOTE: parsed_part is passed as rvalue reference!
585 const handling_result_t handler_ret_code = handler(
586 std::move(*part_parse_result) );
587
588 if( handling_result_t::terminate_enumeration != handler_ret_code )
589 ++parts_processed;
590 else
591 error = enumeration_error_t::terminated_by_handler;
592
593 if( handling_result_t::continue_enumeration != handler_ret_code )
594 break;
595 }
596
597 if( error )
598 return make_unexpected( *error );
599
600 return parts_processed;
601}
602
603//
604// valid_handler_type
605//
606 template< typename, typename = restinio::utils::metaprogramming::void_t<> >
607 struct valid_handler_type : public std::false_type {};
608
609 template< typename T >
610 struct valid_handler_type<
611 T,
612 restinio::utils::metaprogramming::void_t<
613 std::enable_if_t<
614 std::is_same<
615 handling_result_t,
616 decltype(std::declval<T>()(std::declval<parsed_part_t>()))
617 >::value,
618 bool
619 >
620 >
621 > : public std::true_type
622{};
623
624} /* namespace impl */
625
626//
627// enumerate_parts
628//
683 template< typename User_Type, typename Handler >
684 RESTINIO_NODISCARD
685 expected_t< std::size_t, enumeration_error_t >
686 enumerate_parts(
688 const generic_request_t< User_Type > & req,
690 Handler && handler,
697 string_view_t expected_media_type = string_view_t{ "multipart" },
704 optional_t< string_view_t > expected_media_subtype = nullopt )
705{
706 static_assert(
707 impl::valid_handler_type< std::decay_t<Handler> >::value,
708 "Handler should be callable object, "
709 "should accept parsed_part_t by value, const or rvalue reference, "
710 "and should return handling_result_t" );
711
712 const auto boundary = detect_boundary_for_multipart_body(
713 req,
714 expected_media_type,
715 expected_media_subtype );
716 if( boundary )
717 {
718 const auto parts = split_multipart_body( req.body(), *boundary );
719
720 if( parts.empty() )
721 return make_unexpected(
722 enumeration_error_t::no_parts_found );
723
724 return impl::enumerate_parts_of_request_body(
725 parts,
726 std::forward<Handler>(handler) );
727 }
728
729 return make_unexpected( boundary.error() );
730}
731
732} /* namespace multipart_body */
733
734} /* namespace restinio */
735
basics.hpp
Utilities for parsing values of http-fields.
nonstd::optional_lite::optional
class optional
Definition: optional.hpp:919
restinio::easy_parser::impl::source_t
The class that implements "input stream".
Definition: easy_parser.hpp:740
restinio::easy_parser::impl::source_t::getch
RESTINIO_NODISCARD character_t getch() noexcept
Get the next character from the input stream.
Definition: easy_parser.hpp:765
restinio::easy_parser::impl::source_t::putback
void putback() noexcept
Return one character back to the input stream.
Definition: easy_parser.hpp:777
restinio::easy_parser::impl::source_t::current_position
RESTINIO_NODISCARD position_t current_position() const noexcept
Get the current position in the stream.
Definition: easy_parser.hpp:786
restinio::easy_parser::impl::top_level_clause_t
A special class to be used as the top level clause in parser.
Definition: easy_parser.hpp:1533
restinio::easy_parser::parse_error_t
Information about parsing error.
Definition: easy_parser.hpp:93
restinio::generic_request_t
HTTP Request data.
Definition: request_handler.hpp:201
restinio::generic_request_t::header
const http_request_header_t & header() const noexcept
Get request header.
Definition: request_handler.hpp:256
restinio::generic_request_t::body
const std::string & body() const noexcept
Get request body.
Definition: request_handler.hpp:263
restinio::http_header_field_t
A single header field.
Definition: http_headers.hpp:583
restinio::http_header_fields_t
Header fields map.
Definition: http_headers.hpp:703
restinio::http_header_fields_t::opt_value_of
optional_t< string_view_t > opt_value_of(string_view_t name) const noexcept
Get optional value of a field.
Definition: http_headers.hpp:1300
RESTINIO_NODISCARD
#define RESTINIO_NODISCARD
Definition: compiler_features.hpp:33
content-type.hpp
Stuff related to value of Content-Type HTTP-field.
easy_parser.hpp
An very small, simple and somewhat limited implementation of recursive-descent parser.
expected.hpp
http_headers.hpp
metaprogramming.hpp
Various tools for C++ metaprogramming.
nonstd::optional_lite::std11::false_type
bool_constant< false > false_type
Definition: optional.hpp:460
nonstd::optional_lite::std11::move
T & move(T &t)
Definition: optional.hpp:465
nonstd::optional_lite::std11::true_type
bool_constant< true > true_type
Definition: optional.hpp:459
nonstd::optional_lite::nullopt
const nullopt_t nullopt((nullopt_t::init()))
nonstd::optional_lite::swap
void swap(optional< T > &x, optional< T > &y)
Definition: optional.hpp:1705
restinio::easy_parser
Definition: easy_parser.hpp:39
restinio::easy_parser::symbol
RESTINIO_NODISCARD auto symbol(char expected) noexcept
A factory function to create a clause that expects the speficied symbol, extracts it and then skips i...
Definition: easy_parser.hpp:4032
restinio::easy_parser::error_reason_t::unexpected_eof
@ unexpected_eof
Unexpected end of input is encontered when some character expected.
restinio::easy_parser::try_parse
RESTINIO_NODISCARD expected_t< typename Producer::result_type, parse_error_t > try_parse(string_view_t from, Producer producer)
Perform the parsing of the specified content by using specified value producer.
Definition: easy_parser.hpp:5042
restinio::easy_parser::repeat
RESTINIO_NODISCARD auto repeat(std::size_t min_occurences, std::size_t max_occurences, Clauses &&... clauses)
A factory function to create repetitor of subclauses.
Definition: easy_parser.hpp:3876
restinio::easy_parser::custom_consumer
RESTINIO_NODISCARD auto custom_consumer(F consumer)
A factory function to create a custom_consumer.
Definition: easy_parser.hpp:4516
restinio::easy_parser::N
constexpr std::size_t N
A special marker that means infinite repetitions.
Definition: easy_parser.hpp:455
restinio::easy_parser::to_lower
RESTINIO_NODISCARD auto to_lower() noexcept
A factory function to create a to_lower_transformer.
Definition: easy_parser.hpp:4610
restinio::http_field_parsers
Definition: accept-charset.hpp:20
restinio::http_field_parsers::find_first
RESTINIO_NODISCARD expected_t< string_view_t, not_found_t > find_first(const parameter_with_mandatory_value_container_t &where, string_view_t what)
A helper function to find the first occurence of a parameter with the specified value.
Definition: basics.hpp:1568
restinio::http_field_parsers::ows
RESTINIO_NODISCARD auto ows() noexcept
A factory function to create an OWS clause.
Definition: basics.hpp:939
restinio::http_field_parsers::token_p
RESTINIO_NODISCARD auto token_p() noexcept
A factory function to create a token_producer.
Definition: basics.hpp:985
restinio::impl::is_equal_caseless
bool is_equal_caseless(const char *a, const char *b, std::size_t size) noexcept
Comparator for fields names.
Definition: string_caseless_compare.hpp:40
restinio::multipart_body::impl::boundary_value_checkers::is_bcharnospace
RESTINIO_NODISCARD constexpr bool is_bcharnospace(char ch)
Definition: multipart_body.hpp:403
restinio::multipart_body::impl::boundary_value_checkers::is_bchar
RESTINIO_NODISCARD constexpr bool is_bchar(char ch)
Definition: multipart_body.hpp:423
restinio::multipart_body::impl::parser_details::CR
constexpr char CR
Definition: multipart_body.hpp:165
restinio::multipart_body::impl::parser_details::LF
constexpr char LF
Definition: multipart_body.hpp:166
restinio::multipart_body::impl::make_parser
RESTINIO_NODISCARD auto make_parser()
A factory function for a parser of a part of multipart message.
Definition: multipart_body.hpp:254
restinio::multipart_body::impl::enumerate_parts_of_request_body
RESTINIO_NODISCARD expected_t< std::size_t, enumeration_error_t > enumerate_parts_of_request_body(const std::vector< string_view_t > &parts, Handler &&handler)
A function that parses every part of a multipart body and calls a user-provided handler for every par...
Definition: multipart_body.hpp:570
restinio::multipart_body::handling_result_t
handling_result_t
The result to be returned from user-provided handler of parts of multipart body.
Definition: multipart_body.hpp:338
restinio::multipart_body::handling_result_t::stop_enumeration
@ stop_enumeration
Enumeration of parts should be stopped. All remaining parts of multipart body will be skipped....
restinio::multipart_body::handling_result_t::terminate_enumeration
@ terminate_enumeration
Enumeration of parts should be ignored. All remaining parts of multipart body will be skipped and the...
restinio::multipart_body::handling_result_t::continue_enumeration
@ continue_enumeration
Enumeration of parts should be continued. If there is another part the user-provided handler will be ...
restinio::multipart_body::check_boundary_value
RESTINIO_NODISCARD optional_t< enumeration_error_t > check_boundary_value(string_view_t value)
A helper function for checking the validity of 'boundary' value.
Definition: multipart_body.hpp:457
restinio::multipart_body::enumerate_parts
RESTINIO_NODISCARD expected_t< std::size_t, enumeration_error_t > enumerate_parts(const generic_request_t< User_Type > &req, Handler &&handler, string_view_t expected_media_type=string_view_t{ "multipart" }, optional_t< string_view_t > expected_media_subtype=nullopt)
A helper function for enumeration of parts of a multipart body.
Definition: multipart_body.hpp:686
restinio::multipart_body::enumeration_error_t
enumeration_error_t
The result of an attempt to enumerate parts of a multipart body.
Definition: multipart_body.hpp:362
restinio::multipart_body::enumeration_error_t::content_type_field_inappropriate_value
@ content_type_field_inappropriate_value
Content-Type field value parsed but doesn't contain an appropriate value. For example there can be me...
restinio::multipart_body::enumeration_error_t::no_parts_found
@ no_parts_found
No parts of a multipart body actually found.
restinio::multipart_body::enumeration_error_t::illegal_boundary_value
@ illegal_boundary_value
Value of 'boundary' parameter is invalid (for example it contains some illegal characters).
restinio::multipart_body::enumeration_error_t::content_type_field_not_found
@ content_type_field_not_found
Content-Type field is not found. If Content-Type is absent there is no way to detect 'boundary' param...
restinio::multipart_body::enumeration_error_t::terminated_by_handler
@ terminated_by_handler
Enumeration of parts was aborted by user-provided handler. This code is returned when user-provided h...
restinio::multipart_body::enumeration_error_t::content_type_field_parse_error
@ content_type_field_parse_error
Unable to parse Content-Type field value.
restinio::multipart_body::enumeration_error_t::unexpected_error
@ unexpected_error
Some unexpected error encountered during the enumeration.
restinio::multipart_body::try_parse_part
RESTINIO_NODISCARD expected_t< parsed_part_t, restinio::easy_parser::parse_error_t > try_parse_part(string_view_t part)
Helper function for parsing content of one part of a multipart body.
Definition: multipart_body.hpp:315
restinio::multipart_body::split_multipart_body
RESTINIO_NODISCARD std::vector< string_view_t > split_multipart_body(string_view_t body, string_view_t boundary)
Helper function for spliting a multipart body into a serie of separate parts.
Definition: multipart_body.hpp:72
restinio::multipart_body::detect_boundary_for_multipart_body
RESTINIO_NODISCARD expected_t< std::string, enumeration_error_t > detect_boundary_for_multipart_body(const generic_request_t< Extra_Data > &req, string_view_t expected_media_type, optional_t< string_view_t > expected_media_subtype)
Helper function for parsing Content-Type field and extracting the value of 'boundary' parameter.
Definition: multipart_body.hpp:497
restinio::string_algo
Definition: string_algo.hpp:21
restinio::string_algo::starts_with
RESTINIO_NODISCARD bool starts_with(const string_view_t &where, const string_view_t &what) noexcept
Definition: string_algo.hpp:24
restinio::utils::metaprogramming::void_t
typename make_void< Ts... >::type void_t
Definition: metaprogramming.hpp:28
restinio
Definition: asio_include.hpp:21
restinio::string_view_t
nonstd::string_view string_view_t
Definition: string_view.hpp:19
restinio::expected_t
nonstd::expected< T, E > expected_t
Definition: expected.hpp:22
request_handler.hpp
string_algo.hpp
Various string-related algorithms.
string_caseless_compare.hpp
Helpers for caseless comparison of strings.
restinio::easy_parser::impl::character_t::m_ch
char m_ch
Definition: easy_parser.hpp:595
restinio::easy_parser::impl::producer_tag
A special base class to be used with producers.
Definition: easy_parser.hpp:945
restinio::multipart_body::impl::parser_details::body_producer_t
A special producer that consumes the whole remaining content from the input stream.
Definition: multipart_body.hpp:185
restinio::multipart_body::impl::parser_details::body_producer_t::try_parse
RESTINIO_NODISCARD expected_t< string_view_t, easy_parser::parse_error_t > try_parse(easy_parser::impl::source_t &from) const noexcept
Definition: multipart_body.hpp:188
restinio::multipart_body::impl::parser_details::field_value_producer_t
A special producer that consumes the rest of the current line in the input stream until CR/LF will be...
Definition: multipart_body.hpp:209
restinio::multipart_body::impl::parser_details::field_value_producer_t::try_parse
RESTINIO_NODISCARD expected_t< std::string, easy_parser::parse_error_t > try_parse(easy_parser::impl::source_t &from) const
Definition: multipart_body.hpp:212
restinio::multipart_body::impl::valid_handler_type
Definition: multipart_body.hpp:607
restinio::multipart_body::parsed_part_t
A description of parsed content of one part of a multipart body.
Definition: multipart_body.hpp:144
restinio::multipart_body::parsed_part_t::fields
http_header_fields_t fields
HTTP-fields local for that part.
Definition: multipart_body.hpp:150
restinio::multipart_body::parsed_part_t::body
string_view_t body
The body of that part.
Definition: multipart_body.hpp:152