danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.8k stars 636 forks source link

dl.php not return error status code on exception #1375

Closed foremtehan closed 1 year ago

foremtehan commented 1 year ago

The HTTP status code from dl.php is always 200, regardless of the exception thrown. (for reproduce the issue just change something in query string)

second issue, it should not print trace logs as body response when error happens

danog commented 1 year ago

Re-tagged a new beta110 that fixes this.

foremtehan commented 1 year ago

it prints on missing extensions:


MadelineProto requires the igbinary extension to run. Try running sudo apt-get install php8.2-igbinary.
MadelineProto requires the igbinary extension to run. Try running sudo apt-get install php8.2-igbinary.

Warning: Cannot modify header information - headers already sent by (output started at /app/vendor/danog/madelineproto/src/Exception.php:71) in /app/vendor/danog/madelineproto/src/MTProtoTools/ResponseInfo.php on line 225

Warning: Cannot modify header information - headers already sent by (output started at /app/vendor/danog/madelineproto/src/Exception.php:71) in /app/vendor/danog/madelineproto/src/MTProtoTools/ResponseInfo.php on line 225

Warning: Cannot modify header information - headers already sent by (output started at /app/vendor/danog/madelineproto/src/Exception.php:71) in /app/vendor/danog/madelineproto/src/MTProtoTools/ResponseInfo.php on line 228

502 Bad Gateway

Either the associated MadelineProto EventHandler bot or the MadelineProto IPC server are offline, please check logs and make sure at least one of them is running!

Telegram file download server (up to 4GB), powered by [MadelineProto](https://docs.madelineproto.xyz/)!
Click [here](https://docs.madelineproto.xyz/docs/FILES.html#getting-a-download-link) for more info on how to setup your very own Telegram file download server!
danog commented 1 year ago

Since this is a one-time error that only occurs if the admin restarts the server, I don't feel like hiding the headers already sent errors, since they might come useful in debugging things like an accidental echo before downloadToBrowser.