cetcd
cetcd copied to clipboard
Issue when set contains large value
it appears that when value of the key is large (something larger than 1024 or so) Expect: 100-continue is used from libcurl (if i can recall by defult) and state machine is troubled(response_discard_st). etcd replies with HTTP/1.1 100 Continue and then HTTP/1.1 200 OK.
error :1000, not a json response (HTTP/1.1 200 OK ) Error Code:1000 Error Message:not a json response Error Cause:HTTP/1.1 200 OK
One possible workarround is the disable the Expect: 100-continue in the send request
@@ -1122,9 +1129,15 @@ void *cetcd_send_request(CURL *curl, cetcd_request *req) { curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cetcd_parse_response); curl_easy_setopt(curl, CURLOPT_VERBOSE, req->cli->settings.verbose); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, req->cli->settings.connect_timeout);
- struct curl_slist *chunk = NULL;
- chunk = curl_slist_append(chunk, "Expect:");
- res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
res = curl_easy_perform(curl);
- curl_slist_free_all(chunk);
if that's OK i can send a pull request.
What would happen when 100 Continue
is disabled on large value ?
then cetcd will send the full payload towards etcd (100-continue will not be returned from etcd)
Sorry for my late reply. It looks good to me. Please send me a pull request if you will.
In this case with larger value string, it's libcurl initiated the "expect 100-continue). Disable it should works. Theoretically, other 1xx like 102-processing may be received as indicated by HTTP protocal. So is it better to add cetcd_parse_response() the capability to handle the 1xx msg? Just for open discussion. 1xx is informational response from server which should be discard by cetcd if any of they received. 1×× Informational 100 Continue 101 Switching Protocols 102 Processing