Fixes for micro http-client (phar_release)

This commit is contained in:
Daniil Gentili 2018-02-22 14:26:57 +00:00
parent f9626173a3
commit 2b921eea56
4 changed files with 8 additions and 7 deletions

View File

@ -2,10 +2,7 @@ language: php
php: php:
- '7.1' - '7.1'
before_install: before_install:
- openssl aes-256-cbc -K $encrypted_5699a01b7a5f_key -iv $encrypted_5699a01b7a5f_iv
-in madeline_rsa.enc -out madeline_rsa -d
- echo "phar.readonly = 0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - echo "phar.readonly = 0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- chmod 600 madeline_rsa
script: script:
- tests/makephar.sh - tests/makephar.sh

Binary file not shown.

View File

@ -341,6 +341,7 @@ class Connection
case 'https': case 'https':
$headers = []; $headers = [];
$close = false; $close = false;
$length = 0;
while (true) { while (true) {
$current_header = ''; $current_header = '';
while (($curchar = $this->read(1)) !== "\n") { while (($curchar = $this->read(1)) !== "\n") {
@ -362,8 +363,9 @@ class Connection
$headers[] = $current_header; $headers[] = $current_header;
} }
$read = $this->read($length); $read = $this->read($length);
if ($headers[0] !== 'HTTP/1.1 200 OK') { $headers[0] = explode(" ", $headers[0], 3);
throw new Exception($headers[0]); if ($headers[0][1] !== '200') {
throw new Exception($headers[0][2]);
} }
if ($close) { if ($close) {
$this->close_and_reopen(); $this->close_and_reopen();

View File

@ -30,11 +30,13 @@ echo '{
composer update composer update
cd .. cd ..
$php7to5 convert --copy-all phar7 phar5 $php7to5 convert --copy-all phar7 phar5 >/dev/null
php makephar.php phar5 madeline.phar $TRAVIS_COMMIT php makephar.php phar5 madeline.phar $TRAVIS_COMMIT
eval "$(ssh-agent -s)" eval "$(ssh-agent -s)"
echo -e "$private_key" > madeline_rsa
chmod 600 madeline_rsa
ssh-add madeline_rsa ssh-add madeline_rsa
git clone git@github.com:danog/MadelineProtoPhar git clone git@github.com:danog/MadelineProtoPhar
cd MadelineProtoPhar cd MadelineProtoPhar
@ -53,6 +55,6 @@ for chat_id in $destinations;do
$TRAVIS_COMMIT_MESSAGE" -F parse_mode="HTML" -F chat_id=$chat_id | JSON.sh/JSON.sh -s | egrep '\["result","message_id"\]' | cut -f 2 | cut -d '"' -f 2) $TRAVIS_COMMIT_MESSAGE" -F parse_mode="HTML" -F chat_id=$chat_id | JSON.sh/JSON.sh -s | egrep '\["result","message_id"\]' | cut -f 2 | cut -d '"' -f 2)
echo "$TRAVIS_COMMIT_MESSAGE" | grep -q release_phar && curl -s https://api.telegram.org/bot$token/sendDocument -F caption="md5: $(md5sum madeline.phar | sed 's/\s.*//g') #echo "$TRAVIS_COMMIT_MESSAGE" | grep -q release_phar && curl -s https://api.telegram.org/bot$token/sendDocument -F caption="md5: $(md5sum madeline.phar | sed 's/\s.*//g')
commit: $TRAVIS_COMMIT" -F chat_id=$chat_id -F document=@madeline.phar -F reply_to_message_id=$ID commit: $TRAVIS_COMMIT" -F chat_id=$chat_id -F document=@madeline.phar -F reply_to_message_id=$ID
done done