Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when set contains large value #37

Open
kinsu opened this issue Sep 4, 2016 · 4 comments
Open

Issue when set contains large value #37

kinsu opened this issue Sep 4, 2016 · 4 comments

Comments

@kinsu
Copy link
Contributor

kinsu commented Sep 4, 2016

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.

@shafreeck
Copy link
Owner

shafreeck commented Sep 5, 2016

What would happen when 100 Continue is disabled on large value ?

@kinsu
Copy link
Contributor Author

kinsu commented Sep 5, 2016

then cetcd will send the full payload towards etcd (100-continue will not be returned from etcd)

@shafreeck
Copy link
Owner

Sorry for my late reply. It looks good to me. Please send me a pull request if you will.

@zhileitao
Copy link
Contributor

zhileitao commented Nov 22, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants