From 2b921eea568baa4ff9ff048da041ee23ec2eaeae Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 22 Feb 2018 14:26:57 +0000 Subject: [PATCH] Fixes for micro http-client (phar_release) --- .travis.yml | 3 --- madeline_rsa.enc | Bin 3248 -> 0 bytes src/danog/MadelineProto/Connection.php | 6 ++++-- tests/makephar.sh | 6 ++++-- 4 files changed, 8 insertions(+), 7 deletions(-) delete mode 100644 madeline_rsa.enc diff --git a/.travis.yml b/.travis.yml index 07f0c287..5fde2d46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,7 @@ language: php php: - '7.1' 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 -- chmod 600 madeline_rsa script: - tests/makephar.sh diff --git a/madeline_rsa.enc b/madeline_rsa.enc deleted file mode 100644 index f9295f65fbb5e631edbabda55dce443e6e7acf44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3248 zcmV;h3{UgYv;o^ie{eA7XL8e0v`BcKcS?61%&%(~TnpSA5C#ZB{VY1aD_2t=J!+NCxh718n9XEw(Z1{@7K#WjMSSMIdJ}0QFWGq zz!k=jD?XnPT_{z4P4?@Cc0C|yP%=heQS_)!5ILI*4@5Dy*!qgnVzBGlIvCxhPzZXr ze@XE)8)59c5YJKgroD?ssOsYfqn@r$`At=J9|*UvZaYU;4zWPNSOGFi?&+7~3NOFs z@pK8%sCD#`BVozl7&1g!Xj8(#ObP9MR^(^OiKIFH4H9cXm+Hx$B7hS;C%yiLmmWxh zTwY%2f7&7h5m%|rb=wuJd1XYQ9yBQ+V4td1qv zQ3-c20QD#3JgiBiSt!lXs)72}3l2oIllSy=i zoSdOv$N;hcUodKyASVER~Q*u6mOOIr^VNovi(Ygp>q9T_`cQ**VI+*P`LJ`V~T1 zGGJ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>{~pO$};_{vUU!-!b(Q|x5wQW3~#4dq_8@sLM#Rd{2AF64n#hX7F* zHwhXJ0>&Le5K@&ZfWY0S?muR2TSv{kJxoRl!PnitR?2hwN9jQuTiLAG`PEPgjZS&m z`E@(86MVx@!A$#dkZN0~rSL|3tV+{?Drpi>c$zs#Pg? z%iY@5U07gv<5va)VTN!`)Rre$`bTjgxkoY2Mk!Cn(QZ~n?*bRzM{ROrxGuBjLru7j zyylfze~DG$TQR<|GK(4OTtX!PSQEW!T z=x*SX<&S@a+-`MyCpfSMo|`ZQ;S`8M%CCYgolp1&@G<1aGm_Fbk(^RcxGlHX+h2f` zx421+q(bfVodNM^W#CSu{K?@0O7}l#N!&Ar=E-e*!>s1?uA4^4(uaMC#)>P|!5@Ev zygqk>;9{>&S*DayA9ndl-FUQ_KEBc1E+icdc7-M)h^ow4Uw|B4LV?B}z%&Zz5kvld zwOD^Nf6{A+Lf2QA;DI?H53<4trmKAVyci;kud_fRM%$?Z`u1{q8{#C$>2ZFmRzN!n zhU56k1d-kU{TWD@s{1IAQEr!c*`TAEbZ^6G3wu{f!=9VGtJ+&5?*iA@-e78K} zoUHKwC@n3|K76!g?;Cvqpk-@R1yYR626u4{d%;ucW}0xBtq$;$XEc0W%ejIl=~z0Z iY23ij>Hhx9C*mp}U{oF3#o1v}xD#;S2zN}tr|jyWfKO-u diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php index dedea6f6..24a1ab92 100644 --- a/src/danog/MadelineProto/Connection.php +++ b/src/danog/MadelineProto/Connection.php @@ -341,6 +341,7 @@ class Connection case 'https': $headers = []; $close = false; + $length = 0; while (true) { $current_header = ''; while (($curchar = $this->read(1)) !== "\n") { @@ -362,8 +363,9 @@ class Connection $headers[] = $current_header; } $read = $this->read($length); - if ($headers[0] !== 'HTTP/1.1 200 OK') { - throw new Exception($headers[0]); + $headers[0] = explode(" ", $headers[0], 3); + if ($headers[0][1] !== '200') { + throw new Exception($headers[0][2]); } if ($close) { $this->close_and_reopen(); diff --git a/tests/makephar.sh b/tests/makephar.sh index 1836a2e0..24195a43 100755 --- a/tests/makephar.sh +++ b/tests/makephar.sh @@ -30,11 +30,13 @@ echo '{ composer update cd .. -$php7to5 convert --copy-all phar7 phar5 +$php7to5 convert --copy-all phar7 phar5 >/dev/null php makephar.php phar5 madeline.phar $TRAVIS_COMMIT eval "$(ssh-agent -s)" +echo -e "$private_key" > madeline_rsa +chmod 600 madeline_rsa ssh-add madeline_rsa git clone git@github.com:danog/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) - 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 done