Re: [Qemu-devel] [PATCH v2 04/11] curl: fix curl_open

2013-05-14 Thread Stefan Hajnoczi
On Tue, May 14, 2013 at 10:26:23AM +0800, Fam Zheng wrote: > +if (!strncmp(s->url, "http://";, strlen("http://";)) && !s->accept_range) { > +strncpy(state->errmsg, "Server not supporting range.", > CURL_ERROR_SIZE); Please use pstrcpy(), it always NUL-terminates. strncpy(3) does not

[Qemu-devel] [PATCH v2 04/11] curl: fix curl_open

2013-05-13 Thread Fam Zheng
Change curl_size_cb to curl_header_cb, as what the function is really doing. Fix the registering, CURLOPT_WRITEFUNCTION is apparently wrong, should be CURLOPT_HEADERFUNCTION. Parsing size from header is not necessary as we're using curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD