SOCKS proxy fixes

svn path=/trunk/boinc/; revision=770
This commit is contained in:
Eric Heien 2002-12-19 00:10:39 +00:00
parent 53d5743480
commit 62ea01059d
5 changed files with 17 additions and 18 deletions

View File

@ -223,7 +223,7 @@ HTTP_OP::HTTP_OP() {
http_op_state = HTTP_STATE_IDLE;
http_op_type = HTTP_OP_NONE;
http_op_retval = 0;
use_proxy = false;
use_http_proxy = false;
proxy_server_port = 0;
strcpy(proxy_server_name,"");
}
@ -236,10 +236,10 @@ HTTP_OP::~HTTP_OP() {
int HTTP_OP::init_head(char* url) {
char proxy_buf[256];
parse_url(url, hostname, port, filename);
NET_XFER::init(use_proxy?proxy_server_name:hostname, use_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
NET_XFER::init(use_http_proxy?proxy_server_name:hostname, use_http_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
http_op_type = HTTP_OP_HEAD;
http_op_state = HTTP_STATE_CONNECTING;
if (use_proxy) {
if (use_http_proxy) {
sprintf( proxy_buf, "http://%s:%d/%s", hostname, port, filename );
} else {
sprintf( proxy_buf, "/%s", filename );
@ -258,11 +258,11 @@ int HTTP_OP::init_get(char* url, char* out, bool del_old_file, double off) {
}
file_offset = off;
parse_url(url, hostname, port, filename);
NET_XFER::init(use_proxy?proxy_server_name:hostname, use_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
NET_XFER::init(use_http_proxy?proxy_server_name:hostname, use_http_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
strcpy(outfile, out);
http_op_type = HTTP_OP_GET;
http_op_state = HTTP_STATE_CONNECTING;
if (use_proxy) {
if (use_http_proxy) {
sprintf( proxy_buf, "http://%s:%d/%s", hostname, port, filename );
} else {
sprintf( proxy_buf, "/%s", filename );
@ -279,7 +279,7 @@ int HTTP_OP::init_post(char* url, char* in, char* out) {
char proxy_buf[256];
parse_url(url, hostname, port, filename);
NET_XFER::init(use_proxy?proxy_server_name:hostname, use_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
NET_XFER::init(use_http_proxy?proxy_server_name:hostname, use_http_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
strcpy(infile, in);
strcpy(outfile, out);
retval = file_size(infile, size);
@ -287,7 +287,7 @@ int HTTP_OP::init_post(char* url, char* in, char* out) {
content_length = (int)size;
http_op_type = HTTP_OP_POST;
http_op_state = HTTP_STATE_CONNECTING;
if (use_proxy) {
if (use_http_proxy) {
sprintf( proxy_buf, "http://%s:%d/%s", hostname, port, filename );
} else {
sprintf( proxy_buf, "/%s", filename );
@ -308,7 +308,7 @@ int HTTP_OP::init_post2(
char proxy_buf[256];
parse_url(url, hostname, port, filename);
NET_XFER::init(use_proxy?proxy_server_name:hostname, use_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
NET_XFER::init(use_http_proxy?proxy_server_name:hostname, use_http_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
req1 = r1;
if (in) {
strcpy(infile, in);
@ -323,7 +323,7 @@ int HTTP_OP::init_post2(
content_length += strlen(req1);
http_op_type = HTTP_OP_POST2;
http_op_state = HTTP_STATE_CONNECTING;
if (use_proxy) {
if (use_http_proxy) {
sprintf( proxy_buf, "http://%s:%d/%s", hostname, port, filename );
} else {
sprintf( proxy_buf, "/%s", filename );
@ -341,7 +341,7 @@ int HTTP_OP::init_put(char* url, char* in, int off) {
offset = off;
parse_url(url, hostname, port, filename);
NET_XFER::init(use_proxy?proxy_server_name:hostname, use_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
NET_XFER::init(use_http_proxy?proxy_server_name:hostname, use_http_proxy?proxy_server_port:port, HTTP_BLOCKSIZE);
strcpy(infile, in);
retval = file_size(infile, content_length);
if (retval) return retval;

View File

@ -67,7 +67,7 @@ public:
int http_op_state; // values below
int http_op_type;
int http_op_retval;
bool use_proxy;
bool use_http_proxy;
int proxy_server_port;
char proxy_server_name[256];

View File

@ -90,7 +90,6 @@ int NET_XFER::get_ip_addr( char *hostname, int &ip_addr ) {
//
int NET_XFER::open_server() {
sockaddr_in addr;
hostent* hep;
int fd=0, ipaddr, retval=0;
retval = get_ip_addr(hostname, ipaddr);

View File

@ -75,8 +75,8 @@ bool PERS_FILE_XFER::start_xfer() {
// download or upload for the persistent file transfer
//
file_xfer = new FILE_XFER;
if (gstate.use_proxy) {
file_xfer->use_proxy = true;
if (gstate.use_http_proxy) {
file_xfer->use_http_proxy = true;
strcpy(file_xfer->proxy_server_name, gstate.proxy_server_name);
file_xfer->proxy_server_port = gstate.proxy_server_port;
}

View File

@ -180,8 +180,8 @@ int SCHEDULER_OP::start_rpc() {
printf("--------- END ---------\n");
fclose(f);
}
if (gstate.use_proxy) {
http_op.use_proxy = true;
if (gstate.use_http_proxy) {
http_op.use_http_proxy = true;
strcpy(http_op.proxy_server_name, gstate.proxy_server_name);
http_op.proxy_server_port = gstate.proxy_server_port;
}
@ -206,8 +206,8 @@ int SCHEDULER_OP::init_master_fetch(PROJECT* p) {
if (log_flags.sched_op_debug) {
printf("Fetching master file for %s\n", project->master_url);
}
if (gstate.use_proxy) {
http_op.use_proxy = true;
if (gstate.use_http_proxy) {
http_op.use_http_proxy = true;
strcpy(http_op.proxy_server_name, gstate.proxy_server_name);
http_op.proxy_server_port = gstate.proxy_server_port;
}