| 754 | } |
| 755 | |
| 756 | StringSpan HttpIncomingMessage::getBoundary() const |
| 757 | { |
| 758 | StringSpan contentType; |
| 759 | if (getHeader("Content-Type", contentType)) |
| 760 | { |
| 761 | HttpStringIterator it(contentType); |
| 762 | if (it.advanceUntilMatchesIgnoreCase("boundary=")) |
| 763 | { |
| 764 | for (size_t i = 0; i < 9; ++i) |
| 765 | (void)it.stepForward(); |
| 766 | |
| 767 | if (it.advanceIfMatches('"')) |
| 768 | { |
| 769 | auto start = it; |
| 770 | while (not it.isAtEnd() and not it.match('"')) |
| 771 | (void)it.stepForward(); |
| 772 | return HttpStringIterator::fromIterators(start, it, contentType.getEncoding()); |
| 773 | } |
| 774 | |
| 775 | auto start = it; |
| 776 | char matched; |
| 777 | (void)it.advanceUntilMatchesAny({';', ' ', '\r', '\0'}, matched); |
| 778 | return HttpStringIterator::fromIterators(start, it, contentType.getEncoding()); |
| 779 | } |
| 780 | } |
| 781 | return {}; |
| 782 | } |
| 783 | |
| 784 | //------------------------------------------------------------------------------------------------------- |
| 785 | // HttpRequest |
no test coverage detected