Open erfantkerfan opened 3 years ago
Hey @erfantkerfan, I never had experience with Octane but it look quite cool. Might you send me a the resulting stream you get? For me it looks like, that the Content-Type header might not be set properly...
Hi @niklasravnsborg I used chrome to generate curl command
curl 'http://127.0.0.1/pdf/all/319' \
-H 'Connection: keep-alive' \
-H 'Cache-Control: max-age=0' \
-H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Sec-Fetch-User: ?1' \
-H 'Sec-Fetch-Dest: document' \
-H 'Referer: http://127.0.0.1/home' \
-H 'Accept-Language: en-US,en;q=0.9,fa;q=0.8' \
-H 'Cookie: _gcl_au=1.1.1458068351.1629118703; _ga_L64TW0SCR8=GS1.1.1629118702.1.0.1629118702.60; _ga=GA1.1.1048031957.1629118703; analytics_campaign={%22source%22:%22direct%22%2C%22medium%22:null}; analytics_token=6a9187fb-e65b-50bf-936e-66457aface42; _yngt=b463a671-12e72-22727-7afde-ecd6c55003612; XSRF-TOKEN=eyJpdiI6IjVCeStQam1ENGxiQitGWHl1OENlNlE9PSIsInZhbHVlIjoiNWtVVms0bys3bkswOXJ4QVdYQjJtZStBakFnekxlRCtESUlrckM2UmlWTlplOFZrZEl1a1JOeVhkbXJYd28xMEU1cDExd2pDeW5obllISWh0VS8xQVYzejdiM25JZFBiR0JndmM2NHBML0ZlYU1VcFBTRkhHZURiQlpUZndhWXciLCJtYWMiOiJiMzc2ZDQ4YzQxZGU1NmRkODhkZGYwZmI0ZjhhZWU2MTM1OGU4MWRlNTJlOGNlZDgyNzhmZGRhNTMyZTRmZjIwIiwidGFnIjoiIn0%3D; laravel_session=eyJpdiI6InoyTmlQYmFBME5mUzUzNU44N1JjWGc9PSIsInZhbHVlIjoiaHdNc1VGclNQRDBDbkhzcGE5ZXBpOUhVWEFVbks2dFRlemw2Zk13cGxtTE9vRDJlM3NZMkRCZnZUNHUzY2hTdW1QMUZvREthTGxUU090TVpQVnBLaFJaa2tNcHhXdmk5UGFrcVpJNzVDRzFqei96TTJTVnZIL3RxYlUvNlRMZWIiLCJtYWMiOiJlY2E2NTk4Y2FkYzc3MTRhMjczMDc3N2M2ZTgxYjgyZGYyODZmMjgxMzAzY2ZmNDYyNDI1YWEyYjFmMmQwZmE3IiwidGFnIjoiIn0%3D' \
--compressed --output output.pdf
and output looked like this:its a temp link but output in browser is like this
you can examine this bug in this project:
https://github.com/erfantkerfan/bank/commit/96a546bc6c46318ba9e91c8f5fb19bd73be0aea1
and also in this project I use docker so it has easy setup
cp .env.example .env
set up key in .env and a random 32 character hex in zarinpal key in .env file
use composer to setup vendor or use
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/opt \
-w /opt \
laravelsail/php80-composer:latest \
composer install --ignore-platform-reqs
then
./vendor/bin/sail up -d
and then ./vendor/bin/sail npm ci
and down and up project once more to make it work ./vendor/bin/sail down
and ./vendor/bin/sail up -d
but I cant provide you a database right now
if you are dedicated to fix this bug I can provide you with a smaller db for testing this yourself
@erfantkerfan In the screenshot you sent to me, the response header Content-Type
is set to text/html; charset=UTF-8
. This is most definitely causing the error. Please try to set it to application/pdf
.
It looks weird to me, that the request sends the header Accept
, which doesn't include application/pdf
...
Hello, I have the same problem when generating pdf, using laravel octane.
Describe the bug when using PHP-fpm and artisan serve command packages works fine but when using laravel/octane with swoole the stream becomes nonsense
To Reproduce Steps to reproduce the behavior:
Expected behavior A normal pdf file
Screenshots