Skip to content

Commit

Permalink
Merge pull request iafonov#19 from ioancea/master
Browse files Browse the repository at this point in the history
Fixed 2 issues in s_header_{field,value} states
  • Loading branch information
iafonov committed May 7, 2015
2 parents 711bc91 + c61b685 commit bd1cc25
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions multipart_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,14 @@ size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len
break;
}

if (c == '-') {
break;
}

if (c == ':') {
EMIT_DATA_CB(header_field, buf + mark, i - mark);
p->state = s_header_value_start;
break;
}

cl = tolower(c);
if (cl < 'a' || cl > 'z') {
if ((c != '-') && (cl < 'a' || cl > 'z')) {
multipart_log("invalid character in header name");
return i;
}
Expand Down Expand Up @@ -203,6 +199,7 @@ size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len
if (c == CR) {
EMIT_DATA_CB(header_value, buf + mark, i - mark);
p->state = s_header_value_almost_done;
break;
}
if (is_last)
EMIT_DATA_CB(header_value, buf + mark, (i - mark) + 1);
Expand Down

0 comments on commit bd1cc25

Please sign in to comment.