Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow empty header values.

  • Loading branch information...
commit 23b0827465ea7146046ec14b7147214ed527724c 1 parent 7f9b42c
@FooBarWidget authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 multipart.cpp
View
16 multipart.cpp
@@ -48,8 +48,10 @@ class MultipartParser {
size_t partDataMark;
const char *errorReason;
- void callback(Callback cb, const char *buffer = NULL, size_t start = UNMARKED, size_t end = UNMARKED) {
- if (start != UNMARKED && start == end) {
+ void callback(Callback cb, const char *buffer = NULL, size_t start = UNMARKED,
+ size_t end = UNMARKED, bool allowEmpty = false)
+ {
+ if (start != UNMARKED && start == end && !allowEmpty) {
return;
}
if (cb != NULL) {
@@ -57,16 +59,18 @@ class MultipartParser {
}
}
- void dataCallback(Callback cb, size_t &mark, const char *buffer, size_t i, size_t bufferLen, bool clear) {
+ void dataCallback(Callback cb, size_t &mark, const char *buffer, size_t i, size_t bufferLen,
+ bool clear, bool allowEmpty = false)
+ {
if (mark == UNMARKED) {
return;
}
if (!clear) {
- callback(cb, buffer, mark, bufferLen);
+ callback(cb, buffer, mark, bufferLen, allowEmpty);
mark = 0;
} else {
- callback(cb, buffer, mark, i);
+ callback(cb, buffer, mark, i, allowEmpty);
mark = UNMARKED;
}
}
@@ -234,7 +238,7 @@ class MultipartParser {
state = HEADER_VALUE;
case HEADER_VALUE:
if (c == CR) {
- dataCallback(onHeaderValue, headerValueMark, buffer, i, len, true);
+ dataCallback(onHeaderValue, headerValueMark, buffer, i, len, true, true);
state = HEADER_VALUE_ALMOST_DONE;
}
break;
Please sign in to comment.
Something went wrong with that request. Please try again.