Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
FROM ubuntu:15.10 | ||
MAINTAINER Davey Shafik <dshafik@akamai.com> | ||
|
||
RUN apt-get update | ||
RUN apt-get install --yes build-essential bison wget | ||
RUN apt-get install --yes git | ||
RUN set -ex \ | ||
&& for key in \ | ||
9554F04D7259F04124DE6B476D5A82AC7E37093B \ | ||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | ||
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \ | ||
FD3A5288F042B6850C66B31F09FE44734EB7990E \ | ||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | ||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | ||
; do \ | ||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ | ||
done | ||
|
||
ENV NPM_CONFIG_LOGLEVEL info | ||
ENV NODE_VERSION 5.0.0 | ||
RUN apt-get install --yes curl | ||
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ | ||
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | ||
&& gpg --verify SHASUMS256.txt.asc \ | ||
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \ | ||
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \ | ||
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc | ||
RUN apt-get remove --yes curl | ||
|
||
RUN apt-get build-dep --yes curl | ||
RUN apt-get install --yes g++ make binutils autoconf automake autotools-dev libtool pkg-config \ | ||
zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \ | ||
libjemalloc-dev | ||
|
||
ENV CFLAGS -O0 -ggdb3 | ||
|
||
RUN git clone https://github.com/tatsuhiro-t/nghttp2.git | ||
WORKDIR nghttp2 | ||
RUN git checkout v1.4.0 | ||
RUN autoreconf -i && automake && autoconf && ./configure && make && make install | ||
WORKDIR .. | ||
|
||
RUN git clone https://github.com/bagder/curl.git | ||
WORKDIR curl | ||
RUN ./buildconf && ./configure --with-nghttp2 --with-ssl --enable-debug | ||
RUN make && make install | ||
WORKDIR .. | ||
RUN git clone https://github.com/dshafik/php-src.git | ||
WORKDIR php-src | ||
RUN git checkout curl-http2-push && ./buildconf && ./configure --disable-all --enable-debug --with-curl && make | ||
WORKDIR .. | ||
RUN git clone https://github.com/dshafik/php-http2-push-example.git | ||
RUN git clone https://github.com/bagder/curl-http2-dev.git | ||
ENV LD_LIBRARY_PATH /usr/local/lib | ||
RUN apt-get install --yes vim gdb | ||
ENV SHEBANG '#!/bin/bash' | ||
RUN echo $SHEBANG > ./run.sh | ||
RUN echo "nghttpd --htdocs=./curl-http2-dev --verbose --echo-upload --push=/index.html=/LICENSE --push=/index.html=/README.md 8443 ./curl-http2-dev/privkey.pem ./curl-http2-dev/server.pem &" >> ./run.sh | ||
RUN echo "sleep 2" >> ./run.sh | ||
RUN echo "./php-src/sapi/cli/php ./php-http2-push-example/push.php https://localhost:8443/index.html" >> ./run.sh | ||
RUN chmod +x ./run.sh | ||
CMD echo "Running" && ./run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
<?php | ||
$callback = function() { | ||
$args = func_get_args(); | ||
var_dump($args); | ||
var_dump(CURL_PUSH_OK); | ||
$transfers = 1; | ||
|
||
$callback = function() use (&$transfers) { | ||
$transfers++; | ||
return CURL_PUSH_OK; | ||
}; | ||
|
||
$mh = curl_multi_init(); | ||
|
||
curl_multi_setopt($mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX); | ||
curl_multi_setopt($mh, CURLMOPT_PUSHFUNCTION, $callback); | ||
|
||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_VERBOSE, 1); | ||
curl_setopt($ch, CURLOPT_URL, $_SERVER['argv'][1]); | ||
curl_setopt($ch, CURLOPT_HTTP_VERSION, 3); | ||
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); | ||
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
|
||
curl_multi_add_handle($mh, $ch); | ||
|
||
$active = null; | ||
//execute the handles | ||
do { | ||
$mrc = curl_multi_exec($mh, $active); | ||
} while ($mrc == CURLM_CALL_MULTI_PERFORM); | ||
|
||
while ($active && $mrc == CURLM_OK) { | ||
if (curl_multi_select($mh) != -1) { | ||
do { | ||
$mrc = curl_multi_exec($mh, $active); | ||
} while ($mrc == CURLM_CALL_MULTI_PERFORM); | ||
} | ||
} | ||
$status = curl_multi_exec($mh, $active); | ||
|
||
do { | ||
$info = curl_multi_info_read($mh); | ||
if (false !== $info && $info['msg'] == CURLMSG_DONE) { | ||
$handle = $info['handle']; | ||
if ($handle !== null) { | ||
$transfers--; | ||
$out = curl_multi_getcontent($info['handle']); | ||
var_dump($out); | ||
curl_multi_remove_handle($mh, $handle); | ||
curl_close($handle); | ||
} | ||
} | ||
} while ($info); | ||
} while ($transfers); | ||
|
||
curl_multi_close($mh); |