0

when I use boost asio to implement a http server,I have encountered a question that is,I want to limit a upload file size,when the program check the file'size is more than size that I give,then write response to browser and close the socket immediately,but this processing will make browser ERR_CONNECTION_RESET,So,how to return reseponse 413 state and close the socket connection when clients still have data to send,or If my way would be wrong,how to implement that?

xmh0511
  • 7,010
  • 1
  • 9
  • 36
  • 1
    Would you consider using Boost Beast? It has this feature: https://stackoverflow.com/questions/58556690/how-do-i-avoid-body-limit-error-in-boosts-beast-and-correctly-handle-large-mess – John Zwinck May 08 '20 at 11:58
  • @JohnZwinck I just want to implement it by asio,how to limit file size using correctly method. – xmh0511 May 08 '20 at 14:50
  • Then perhaps you should look at how Beast does it, probably you can follow their example. – John Zwinck May 09 '20 at 03:47

0 Answers0