Closed thekid closed 9 years ago
Workaround for the moment is to force HttpConnection to use the CURL extension:
HttpTransport::register('https', XPClass::forName('peer.http.CurlHttpTransport'));
$c= new HttpConnection('https://...');
// ...
Test script:
<?php
use peer\http\HttpConnection;
use peer\http\HttpProxy;
use util\log\LogCategory;
use util\log\ConsoleAppender;
use util\cmd\Console;
class Proxy extends \lang\Object {
public static function main($args) {
$c= new HttpConnection($args[0]);
$c->setTrace((new LogCategory('console'))->withAppender(new ConsoleAppender()));
if (isset($args[1])) {
sscanf($args[1], '%[^:]:%d', $host, $port);
$c->setProxy(new HttpProxy($host, $port ?: 3128));
}
$c->get();
}
}
Works with certain proxies; we might need to use "CONNECT" though, not sure...
Now works:
vagrant@precise32:/devel/xp/http$ XP_RT=sys xp Proxy https://github.com/ localhost:3128
[13:42:18 5677 info] >>> CONNECT github.com:443 HTTP/1.1
[13:42:19 5677 info] <<< HTTP/1.0 200 Connection established
[13:42:19 5677 debug] @@@ Enabling tls:// cryptography
[13:42:19 5677 info] >>> GET / HTTP/1.1
Connection: close
Host: github.com
User-Agent: Proxy test class
[13:42:19 5677 info] <<< HTTP/1.1 200 OK
Server: GitHub.com
Date: Sun, 19 Oct 2014 11:42:19 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 200 OK
# ...
The proxy I'm using is Squid3.
The following tries to connect to the proxy via HTTPS. Instead, it should connect there with HTTP and issue a
CONNECT
verb.Result:
See http://stackoverflow.com/questions/11697943/when-should-one-use-connect-and-get-http-methods-at-http-proxy-server