Skip to content

Commit

Permalink
lib-http: If istream read fails, preserve the istream's full error me…
Browse files Browse the repository at this point in the history
…ssage
  • Loading branch information
sirainen authored and Timo Sirainen committed Oct 30, 2017
1 parent f48fad9 commit 2a8454f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/lib-http/http-header-parser.c
Expand Up @@ -360,7 +360,8 @@ int http_header_parse_next_field(struct http_header_parser *parser,
if (parser->input->stream_errno == 0)
*error_r = "Premature end of input";
else
*error_r = "Stream error";
*error_r = t_strdup_printf("Stream error: %s",
i_stream_get_error(parser->input));
}
return ret;
}
3 changes: 2 additions & 1 deletion src/lib-http/http-message-parser.c
Expand Up @@ -119,7 +119,8 @@ int http_message_parse_finish_payload(struct http_message_parser *parser)
parser->error = "Invalid payload";
} else {
parser->error_code = HTTP_MESSAGE_PARSE_ERROR_BROKEN_STREAM;
parser->error = "Stream error while skipping payload";
parser->error = t_strdup_printf("Stream error while skipping payload: %s",
i_stream_get_error(parser->payload));
}
}
return ret;
Expand Down
3 changes: 2 additions & 1 deletion src/lib-http/http-response-parser.c
Expand Up @@ -264,7 +264,8 @@ http_response_parse_status_line(struct http_response_parser *parser)
if (_parser->input->eof &&
parser->state == HTTP_RESPONSE_PARSE_STATE_INIT)
return 0;
_parser->error = "Stream error";
_parser->error = t_strdup_printf("Stream error: %s",
i_stream_get_error(_parser->input));
return -1;
}
return 0;
Expand Down

0 comments on commit 2a8454f

Please sign in to comment.