| 19 | } |
| 20 | |
| 21 | bool SC::HttpURLQueryIterator::next(HttpURLQueryItem& item) |
| 22 | { |
| 23 | item = {}; |
| 24 | if (cursor >= search.sizeInBytes()) |
| 25 | { |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | const char* data = search.bytesWithoutTerminator(); |
| 30 | const size_t nameStart = cursor; |
| 31 | while (cursor < search.sizeInBytes() and data[cursor] != '=' and data[cursor] != '&') |
| 32 | { |
| 33 | cursor++; |
| 34 | } |
| 35 | const size_t nameEnd = cursor; |
| 36 | |
| 37 | const bool hasValue = cursor < search.sizeInBytes() and data[cursor] == '='; |
| 38 | if (hasValue) |
| 39 | { |
| 40 | cursor++; |
| 41 | } |
| 42 | |
| 43 | const size_t valueStart = cursor; |
| 44 | while (cursor < search.sizeInBytes() and data[cursor] != '&') |
| 45 | { |
| 46 | cursor++; |
| 47 | } |
| 48 | const size_t valueEnd = cursor; |
| 49 | if (cursor < search.sizeInBytes() and data[cursor] == '&') |
| 50 | { |
| 51 | cursor++; |
| 52 | } |
| 53 | |
| 54 | item.name = {{data + nameStart, nameEnd - nameStart}, false, search.getEncoding()}; |
| 55 | item.value = {{data + valueStart, valueEnd - valueStart}, false, search.getEncoding()}; |
| 56 | item.hasValue = hasValue; |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | SC::HttpFormUrlEncodedIterator::HttpFormUrlEncodedIterator(StringSpan formBody) : body(formBody) {} |
| 61 |
no test coverage detected