Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 7ab20765 authored by deuce's avatar deuce

Use ConnectedSocket() to get IPv6 goodness.

parent 8df52918
......@@ -88,6 +88,7 @@ HTTPRequest.prototype.SetupPost=function(url, referer, base, data, content_type)
HTTPRequest.prototype.SendRequest=function() {
var i;
var port;
function do_send(sock, str) {
var sent = 0;
......@@ -107,12 +108,18 @@ HTTPRequest.prototype.SendRequest=function() {
if (this.sock != undefined)
this.sock.close();
if((this.sock=new Socket(SOCK_STREAM))==null)
throw("Unable to create socket");
var port = this.url.port?this.url.port:(this.url.scheme=='http'?80:443);
if(!this.sock.connect(this.url.host, port)) {
this.sock.close();
throw(format("Unable to connect to %s:%u", this.url.host, this.url.port));
port = this.url.port?this.url.port:(this.url.scheme=='http'?80:443);
if (js.global.ConnectedSocket != undefined) {
if ((this.sock = new ConnectedSocket(this.url.host, port)) == null)
throw(format("Unable to connect to %s:%u", this.url.host, this.url.port));
}
else {
if((this.sock=new Socket(SOCK_STREAM))==null)
throw("Unable to create socket");
if(!this.sock.connect(this.url.host, port)) {
this.sock.close();
throw(format("Unable to connect to %s:%u", this.url.host, this.url.port));
}
}
if(this.url.scheme=='https')
this.sock.ssl_session=true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment