diff --git a/api/boinc_api.C b/api/boinc_api.C index 7d38352e23..f4de4b010e 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -302,7 +302,7 @@ int boinc_report_app_status( double checkpoint_cpu_time, double fraction_done ) { - char msg_buf[MSG_CHANNEL_SIZE], buf[256]; + char msg_buf[MSG_CHANNEL_SIZE]; sprintf(msg_buf, "%10.4f\n" "%.15e\n" diff --git a/checkin_notes b/checkin_notes index 6c1b44fae1..b8296fbcb0 100755 --- a/checkin_notes +++ b/checkin_notes @@ -20976,3 +20976,14 @@ David 9 Dec 2004 client/ http.C,h net_xfer.C,h + +David 9 Dec 2004 + - Really fixed the above problem. + The HTTP code was looking at the wrong flag + (io_done, should have been io_ready) + in the POST2 case waiting for reply body + + api/ + boinc_api.C + client/ + http.C,h diff --git a/client/http.C b/client/http.C index 5313229cf8..21ef02bcd7 100644 --- a/client/http.C +++ b/client/http.C @@ -280,6 +280,8 @@ int HTTP_REPLY_HEADER::read_reply(int socket) { } // Read the contents of the socket into buf +// Read until EOF from socket, so only call this if you're +// sure the message is small // static int read_reply(int socket, char* buf, int len) { int i, n; @@ -688,18 +690,18 @@ bool HTTP_OP_SET::poll(double) { break; } switch (htp->http_op_type) { - case HTTP_OP_HEAD: - htp->init_head(new_url); - break; - case HTTP_OP_GET: - htp->init_get(new_url, htp->outfile, false); - break; - case HTTP_OP_POST: - htp->init_post(new_url, htp->infile, htp->outfile); - break; - case HTTP_OP_POST2: - htp->init_post2(new_url, htp->req1, htp->infile, htp->file_offset); - break; + case HTTP_OP_HEAD: + htp->init_head(new_url); + break; + case HTTP_OP_GET: + htp->init_get(new_url, htp->outfile, false); + break; + case HTTP_OP_POST: + htp->init_post(new_url, htp->infile, htp->outfile); + break; + case HTTP_OP_POST2: + htp->init_post2(new_url, htp->req1, htp->infile, htp->file_offset); + break; } // Open connection to the redirected server @@ -753,27 +755,32 @@ bool HTTP_OP_SET::poll(double) { break; case HTTP_OP_POST2: htp->http_op_state = HTTP_STATE_REPLY_BODY; - htp->io_ready = false; htp->io_done = false; break; } } break; case HTTP_STATE_REPLY_BODY: - if (htp->io_done) { - action = true; - switch (htp->http_op_type) { - case HTTP_OP_POST2: + switch (htp->http_op_type) { + case HTTP_OP_POST2: + if (htp->io_ready) { + action = true; read_reply(htp->socket, htp->req1, 256); - break; - default: + scope_messages.printf("HTTP_OP_SET::poll(): got reply body\n"); + htp->http_op_state = HTTP_STATE_DONE; + htp->http_op_retval = 0; + } + break; + default: + if (htp->io_done) { + action = true; fclose(htp->file); htp->file = 0; + scope_messages.printf("HTTP_OP_SET::poll(): got reply body\n"); + htp->http_op_state = HTTP_STATE_DONE; + htp->http_op_retval = 0; break; } - scope_messages.printf("HTTP_OP_SET::poll(): got reply body\n"); - htp->http_op_state = HTTP_STATE_DONE; - htp->http_op_retval = 0; } break; } diff --git a/client/http.h b/client/http.h index e6089528f3..e467c8f31e 100644 --- a/client/http.h +++ b/client/http.h @@ -85,7 +85,9 @@ public: int init_get(const char* url, char* outfile, bool del_old_file, double offset=0); int init_post(const char* url, char* infile, char* outfile); int init_post2( - const char* url, char* req1, char* infile, double offset + const char* url, + char* req1, // first part of request. ALSO USED FOR REPLY + char* infile, double offset // infile is NULL if no file sent ); bool http_op_done(); };