Skip to content

Commit

Permalink
lib-oauth2: Accept empty responses
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse authored and villesavolainen committed Jun 16, 2017
1 parent 9924591 commit de59864
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib-oauth2/oauth2.c
Expand Up @@ -49,6 +49,12 @@ oauth2_parse_json(struct oauth2_request *req)
(void)json_parser_deinit(&req->parser, &error);
error = "Invalid response data";
success = FALSE;
} else if (i_stream_is_eof(req->is) &&
req->is->v_offset == 0 && req->is->stream_errno == 0) {
/* discard error, empty response is OK. */
(void)json_parser_deinit(&req->parser, &error);
error = NULL;
success = TRUE;
} else {
ret = json_parser_deinit(&req->parser, &error);
success = (ret == 0);
Expand Down

0 comments on commit de59864

Please sign in to comment.