node icon indicating copy to clipboard operation
node copied to clipboard

Error if message is bigger than Content-Length

Open betochf opened this issue 3 years ago • 7 comments

Pr for issue #39041

The test for the changes is very simple, it just contains a 200 request with a header specifying the "Content-Lenght", in this case with a size of 2 bytes, with a response of 4 so the error could be triggered.

tests:

  • If we change the value of the Content-Lenght for the actual one or a bigger one, we have no error.
  • Finally, we do a request with no headers just to prove that the code still running, even with the new #changes.

betochf avatar Jun 24 '21 05:06 betochf

Unrelated documentation changes in doc/api/errors.md. (Line 9 to Line 805 | Line 821 to Line 3241)

VoltrexKeyva avatar Jun 24 '21 09:06 VoltrexKeyva

Hey @ronag for .end(), how many bytes would be a good amount so the error is not triggered? I was thinking that it should be at least half of the size of the Content-Length

betochf avatar Jun 24 '21 22:06 betochf

Hey @ronag for .end(), how many bytes would be a good amount so the error is not triggered? I was thinking that it should be at least half of the size of the Content-Length

If it doesn’t match content length then error

ronag avatar Jun 25 '21 07:06 ronag

@betochf Could you please rebase and resolve the merge conflicts?

RaisinTen avatar Jul 04 '21 05:07 RaisinTen

@RaisinTen done, it was an error in the Doc

betochf avatar Jul 05 '21 16:07 betochf

@ronag I did the changes... which other tests should I try?

betochf avatar Jul 09 '21 22:07 betochf

I think 3 tests should be added at least:

  • when actual length is mismatched (more or less) with Content-Length, it should throw;
  • when Content-Length is negative, it should throw;

Ayase-252 avatar Aug 12 '21 09:08 Ayase-252