From 3b1f64ce1b8c8fd5e63c3f854a1f762013d27a2b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 10 May 2003 00:52:36 +0000 Subject: [PATCH] http 1.0 svn path=/trunk/boinc/; revision=1179 --- client/Makefile.in | 1 + client/file_xfer.C | 18 +++++++++++------- client/file_xfer.h | 1 + client/hostinfo_unix.C | 8 ++++---- client/http.C | 6 +++--- client/main.C | 4 +++- doc/key_setup.html | 4 ++++ sched/handle_request.C | 11 +++++++++-- test/gen_keys.php | 9 +++++++++ test/test.inc | 4 ++-- todo | 6 +----- 11 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 test/gen_keys.php diff --git a/client/Makefile.in b/client/Makefile.in index 48847b79cc..d14b4547f2 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -45,6 +45,7 @@ OBJS = \ prefs.o \ scheduler_op.o \ speed_stats.o \ + ss_logic.o \ time_stats.o \ ../lib/app_ipc.o \ ../lib/filesys.o \ diff --git a/client/file_xfer.C b/client/file_xfer.C index 514ccf4d0e..037377c8cc 100644 --- a/client/file_xfer.C +++ b/client/file_xfer.C @@ -43,6 +43,7 @@ FILE_XFER::~FILE_XFER() { int FILE_XFER::init_download(FILE_INFO& file_info) { double f_size; + is_upload = false; fip = &file_info; get_pathname(fip, pathname); if (file_size(pathname, f_size)) { @@ -64,6 +65,7 @@ int FILE_XFER::init_upload(FILE_INFO& file_info) { fip = &file_info; get_pathname(fip, pathname); + is_upload = true; if (file_info.upload_offset < 0) { bytes_xferred = 0; sprintf(header, @@ -175,6 +177,7 @@ bool FILE_XFER_SET::poll() { unsigned int i; FILE_XFER* fxp; bool action = false; + int retval; for (i=0; ihttp_op_retval); } - if (fxp->http_op_retval == 0) { - fxp->file_xfer_retval = fxp->parse_server_response( - fxp->fip->upload_offset - ); + fxp->file_xfer_retval = fxp->http_op_retval; + if (fxp->file_xfer_retval == 0) { + if (fxp->is_upload) { + fxp->file_xfer_retval = fxp->parse_server_response( + fxp->fip->upload_offset + ); + } // If this was a file size query, restart the transfer // using the remote file size information // if (fxp->file_size_query) { if (fxp->file_xfer_retval) { - printf("ERROR: file upload returned %d\n", fxp->file_xfer_retval); + printf("ERROR: file upload returned %d\n", retval); fxp->fip->upload_offset = -1; } else { remove(fxp); @@ -213,8 +219,6 @@ bool FILE_XFER_SET::poll() { } } } - } else { - fxp->file_xfer_retval = fxp->http_op_retval; } } } diff --git a/client/file_xfer.h b/client/file_xfer.h index 08999639f7..51444d789b 100644 --- a/client/file_xfer.h +++ b/client/file_xfer.h @@ -38,6 +38,7 @@ public: char pathname[256]; char header[4096]; bool file_size_query; + bool is_upload; FILE_XFER(); ~FILE_XFER(); diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index bcda2e2de2..8480b77341 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -180,6 +180,9 @@ void get_host_disk_info( double &total_space, double &free_space ) { int get_host_info(HOST_INFO& host) { get_host_disk_info( host.d_total, host.d_free ); +#ifdef linux + parse_cpuinfo(host); +#else #if HAVE_SYS_SYSCTL_H int mib[2], mem_size; size_t len; @@ -196,10 +199,8 @@ int get_host_info(HOST_INFO& host) { len = sizeof(host.p_model); sysctl(mib, 2, &host.p_model, &len, NULL, 0); #endif - -#ifdef linux - parse_cpuinfo(host); #endif + #if defined(_SC_NPROCESSORS_ONLN) host.p_ncpus = sysconf(_SC_NPROCESSORS_ONLN); @@ -259,7 +260,6 @@ int get_host_info(HOST_INFO& host) { host.m_swap = vm_info.t_vm; */ #else -#error Need to specify a method to obtain swap space #endif #if defined(HAVE_SYS_SYSTEMINFO_H) && defined(SI_HW_SERIAL) diff --git a/client/http.C b/client/http.C index d3f1192b40..e23554f5ed 100644 --- a/client/http.C +++ b/client/http.C @@ -79,7 +79,7 @@ static void http_get_request_header( char offset_info[256]; if (offset) sprintf( offset_info, "Range: bytes=%.0f-\015\012", offset ); sprintf(buf, - "GET %s HTTP/1.1\015\012" + "GET %s HTTP/1.0\015\012" "User-Agent: BOINC client\015\012" "Host: %s:%d\015\012" "%s" @@ -94,7 +94,7 @@ static void http_get_request_header( // static void http_head_request_header(char* buf, char* host, int port, char* file) { sprintf(buf, - "HEAD %s HTTP/1.1\015\012" + "HEAD %s HTTP/1.0\015\012" "User-Agent: BOINC client\015\012" "Host: %s:%d\015\012" "Connection: close\015\012" @@ -115,7 +115,7 @@ static void http_post_request_header( "Pragma: no-cache\015\012" "Cache-Control: no-cache\015\012" "Host: %s:%d\015\012" - //"Connection: close\015\012" + "Connection: close\015\012" "Content-Type: application/octet-stream\015\012" "Content-Length: %d\015\012" "\015\012", diff --git a/client/main.C b/client/main.C index 313ed6c029..f990e7cc9c 100644 --- a/client/main.C +++ b/client/main.C @@ -38,7 +38,9 @@ #include "prefs.h" #include "util.h" -void quit_client(int); +// dummies +void create_curtain(){} +void delete_curtain(){} // Display a message to the user. // Depending on the priority, the message may be more or less obtrusive diff --git a/doc/key_setup.html b/doc/key_setup.html index 9daaaa7010..c114073877 100644 --- a/doc/key_setup.html +++ b/doc/key_setup.html @@ -10,6 +10,10 @@ a highly secure (e.g., a disconnected, physically secure) host. crypt_prog -genkey 1024 BOINC_KEY_DIR/upload_private BOINC_KEY_DIR/upload_public crypt_prog -genkey 1024 BOINC_KEY_DIR/code_sign_private BOINC_KEY_DIR/code_sign_public +Or, in the test/ directory, run +
+gen_keys.php
+

The program lib/crypt_prog can be used for several purposes: diff --git a/sched/handle_request.C b/sched/handle_request.C index d2158cdc10..b038a48fd3 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -132,15 +132,22 @@ int add_wu_to_reply( APP_VERSION* app_version; int retval; WORKUNIT wu2; + char buf[256]; app = ss.lookup_app(wu.appid); if (!app) { - write_log("Can't find app\n"); + sprintf(buf, "Can't find app w/ ID %d\n", wu.appid); + write_log(buf); return -1; } app_version = ss.lookup_app_version(app->id, platform.id, app->min_version); if (!app_version) { - write_log("Can't find app version\n"); + sprintf(buf, + "Can't find app version: appid %d platformid %d min_version %d"\n, + app->id, platform.id, app->min_version + ); + + write_log(buf); return -1; } diff --git a/test/gen_keys.php b/test/gen_keys.php new file mode 100644 index 0000000000..f242eb7260 --- /dev/null +++ b/test/gen_keys.php @@ -0,0 +1,9 @@ +#! /usr/local/bin/php + diff --git a/test/test.inc b/test/test.inc index f838c9db3c..6d65335591 100644 --- a/test/test.inc +++ b/test/test.inc @@ -286,8 +286,8 @@ class Project { $p = $app_version->platform; $x = "add app_version -db_name $this->db_name -app_name '$app->name' -platform_name $p->name -version $app_version->version -download_dir $this->project_dir/download -download_url $this->download_url -code_sign_keyfile $this->key_dir/code_sign_private -exec_dir $app_version->exec_dir -exec_files"; - for ($i=0; $iexec_names); $i++) { - $x = $x." ".$app_version->exec_names[$i]; + for ($j=0; $jexec_names); $j++) { + $x = $x." ".$app_version->exec_names[$j]; } run_tool($x); } diff --git a/todo b/todo index cdb9bc16a1..fce07ad50f 100755 --- a/todo +++ b/todo @@ -19,9 +19,6 @@ BUGS (arranged from high to low priority) run_on_startup hangup_if_dialed - trim leading/trailing spaces from account ID (Win GUI) -- astropulse wanted to display screensaver graphics when it wasn't supposed to, - causing the screen to flicker wildly and uncontrollably until ap.exe was killed - This happened on 98 and 2000. recreate using Display Properties, preview - I entered in a wrong URL - there was no obvious feedback that it wasn't correct. Messages showed up in the messages tab, but I was looking at the progress tab. Shouldn't the client expect something from the server? If it doesn't get it, @@ -33,8 +30,7 @@ BUGS (arranged from high to low priority) - consider warning message during windows (and perhaps other platforms) install that checks to see if the BOINC directory already exists, and if so, should the user overwrite it? or upgrade it? -- When previewing the screensaver (on Win98) I had the AP graphics already on on the - desktop - the screensaver just shows a bouncing "B" icon. Should that happen? +- Screensaver on win98 shows up as "boinc_ss" in the screensaver list. Should be "BOINC" - After running all night (on Win98) I shook the mouse to wake up the blank screen, and all I saw was the top half of the screen was solid gray, and the bottom half the bottom half of the astropulse graphics. They weren't moving. The computer was frozen.