I'm working on centos 7 and has this json request :
curl --output 'json.data.json' -vvv -x '' -X POST -H "Content-Type: application/json" -H "Connection: keep-alive" -d '{"jsonrpc":"2.0","method":"item.get","params":{"output": ["name","lastvalue","lastclock","hostid"],"groupids": ["5"],"filter":{"name":["LDT Security Flag"]},"sortfield": "name" },"auth":"c1cxxxxxxxxx","id":1}' $CURLADDR
Now,
In middle of results I see :
734247","lastvalue":"0"},{"itemid":"192890","name":"LDT Fl* transfer closed with outstanding read data remaining
100 86797 0 86569 100 228 75094 197 0:00:01 0:00:01 --:--:-- 75146
* Closing connection 0
curl: (18) transfer closed with outstanding read data remaining
And after that some more json results.
But I noticed that not matter how many times I run it and redirect output to .json file , file always at the same size : 88K like there some kind of limit on info download size ? what can i do ?
UPDATE:
So i added it and now the error : curl: (18) transfer closed with outstanding Read data remaining is gone. but is still cuts at the middle with : * Closing Connection 0 and file is 88K – Batchen Regev 11 mins ago
also connection data :
> POST /api_jsonrpc.php HTTP/1.0
> User-Agent: curl/7.29.0
> Host: XXXXXX:1080
> Content-Type: application/json;charset=utf-8
> Accept: application/json, text/plain, */*
> Content-Length: 224
>
} [data not shown]
* upload completely sent off: 224 out of 224 bytes
100 224 0 0 100 224 0 223 0:00:01 0:00:01 --:--:-- 223< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 25 Dec 2018 15:21:07 GMT
< Content-Type: application/json
< Connection: close
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Content-Type
< Access-Control-Allow-Methods: POST
< Access-Control-Max-Age: 1000
<
{ [data not shown]
100 86840 0 86616 100 224 77583 200 0:00:01 0:00:01 --:--:-- 77612
* Closing connection 0
This seems to be a server side issue.
You might try to work it around by forcing HTTP 1.0 connection (to avoid chunked transfer which might cause this problem) with the --http1.0 option.
CURLE_PARTIAL_FILE (18)
A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't match the previously given size.
Source: https://curl.haxx.se/libcurl/c/libcurl-errors.html
Related
I´ve been having a problem after configure my cluster, using cuchbase Rest API, when I want to add new nodes, and then rebalancing.
Here what I´m doing
Create account and cluster for machine A
createAccount(){
ip=$1
curl -s -u ${USER}:${PASSWORD} -X POST http://${ip}:8091/pools/default -d memoryQuota=${QUOTA} }
createCluster(){
ip=$1
# Initialize Node
curl -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/nodes/self/controller/settings \
-d 'data_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata& \
index_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata'
# Rename Node
curl -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/node/controller/rename \
-d 'hostname=127.0.0.1'
# Setup Services
curl -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/node/controller/setupServices \
-d 'services=kv%2Cn1ql%2Cindex'
# Setup Administrator username and password
curl -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/settings/web \
-d "password=$PASSWORD&username=$USER&port=SAME"
}
Create account and cluster for machine B (The same script than above)
Then add server B calling server A
addServer(){
curl -u ${USER}:${PASSWORD} http://A:8091/controller/addNode \
-d "hostname=B&user=$USER&password=$PASSWORD&services=kv%2Cn1ql%2Cindex"
}
Then I can see how in A and B server I have B as pending to rebalancing.
But when I try to rebalance calling A
rebalance(){
masterIp=$1
couchbaseNode=$2
curl -v -u ${USER}:${PASSWORD} -X POST http://A:8091/controller/rebalance \
-d "knownNodes=ns_1#A, ns_1#B"
}
Server returns
{"mismatch":1}
What I´m doing wrong here?
Regards
EDIT:
This is the stack of HTTP to give extra information
First machine
----- CREATING COUCHBASE CLUSTER ON 172.31.35.67
* Trying 172.31.35.67...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /nodes/self/controller/settings HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 129
> Content-Type: application/x-www-form-urlencoded
>
} [129 bytes data]
* upload completely sent off: 129 out of 129 bytes
100 129 0 0 100 129 0 107 0:00:01 0:00:01 --:--:-- 107< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Length: 0
< Cache-Control: no-cache
<
100 129 0 0 100 129 0 79 0:00:01 0:00:01 --:--:-- 80
* Connection #0 to host 172.31.35.67 left intact
* Trying 172.31.35.67...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/rename HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 18
> Content-Type: application/x-www-form-urlencoded
>
} [18 bytes data]
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Length: 0
< Cache-Control: no-cache
<
100 18 0 0 100 18 0 5253 --:--:-- --:--:-- --:--:-- 6000
* Connection #0 to host 172.31.35.67 left intact
* Trying 172.31.35.67...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/setupServices HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 26
> Content-Type: application/x-www-form-urlencoded
>
} [26 bytes data]
* upload completely sent off: 26 out of 26 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Length: 0
< Cache-Control: no-cache
<
100 26 0 0 100 26 0 3992 --:--:-- --:--:-- --:--:-- 4333
* Connection #0 to host 172.31.35.67 left intact
* Trying 172.31.35.67...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /settings/web HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 50
> Content-Type: application/x-www-form-urlencoded
>
} [50 bytes data]
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Type: application/json
< Content-Length: 42
< Cache-Control: no-cache
<
{ [42 bytes data]
Second machine
Trying 172.31.134.213...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /nodes/self/controller/settings HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 129
> Content-Type: application/x-www-form-urlencoded
>
} [129 bytes data]
* upload completely sent off: 129 out of 129 bytes
100 129 0 0 100 129 0 107 0:00:01 0:00:01 --:--:-- 107< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Length: 0
< Cache-Control: no-cache
<
100 129 0 0 100 129 0 81 0:00:01 0:00:01 --:--:-- 81
* Connection #0 to host 172.31.134.213 left intact
* Trying 172.31.134.213...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/rename HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 18
> Content-Type: application/x-www-form-urlencoded
>
} [18 bytes data]
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Length: 0
< Cache-Control: no-cache
<
100 18 0 0 100 18 0 1976 --:--:-- --:--:-- --:--:-- 2000
* Connection #0 to host 172.31.134.213 left intact
* Trying 172.31.134.213...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/setupServices HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 26
> Content-Type: application/x-www-form-urlencoded
>
} [26 bytes data]
* upload completely sent off: 26 out of 26 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Length: 0
< Cache-Control: no-cache
<
100 26 0 0 100 26 0 9626 --:--:-- --:--:-- --:--:-- 13000
* Connection #0 to host 172.31.134.213 left intact
* Trying 172.31.134.213...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /settings/web HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 50
> Content-Type: application/x-www-form-urlencoded
>
} [50 bytes data]
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Type: application/json
< Content-Length: 44
< Cache-Control: no-cache
<
{ [44 bytes data]
100 94 100 44 100 50 15422 17525 --:--:-- --:--:-- --:--:-- 25000
* Connection #0 to host 172.31.134.213 left intact
{"newBaseUri":"http://172.31.134.213:8091/"}----- ADD NODE 172.31.134.213 IN COUCHBASE CLUSTER 172.31.35.67
masterID:172.31.35.67
node:172.31.134.213
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 87 0 0 100 87 0 55769 --:--:-- --:--:-- --:--:-- 43500
32 268 0 0 100 87 0 81 0:00:01 0:00:01 --:--:-- 81
100 268 100 181 100 87 169 81 0:00:01 0:00:01 --:--:-- 169
["Join completion call failed. Got HTTP status 500 from REST call post to http://172.31.134.213:8091/completeJoin. Body was: \"[\\\"Unexpected server error, request logged.\\\"]\""]----- REBALANCING NODE 172.31.134.213 IN COUCHBASE CLUSTER 172.31.35.67
* Trying 172.31.35.67...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /controller/rebalance HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 30
> Content-Type: application/x-www-form-urlencoded
>
} [30 bytes data]
* upload completely sent off: 30 out of 30 bytes
< HTTP/1.1 400 Bad Request
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:04 GMT
< Content-Type: application/json
< Content-Length: 14
< Cache-Control: no-cache
<
{ [14 bytes data]
100 44 100 14 100 30 11965 25641 --:--:-- --:--:-- --:--:-- 30000
* Connection #0 to host 172.31.35.67 left intact
{"mismatch":1}
As you can see the last request fail with a 400 code
In the knownNodes list, remove the spaces between the nodes. I was able to replicate it. With the spaces, {"mismatch":1}. Without the spaces, it works.
I have opened a bug on the documentation on this issue.
I am reading from an input stream with (t/read request-body :json)
and I get a java.lang.RuntimeException: java.io.EOFException.
{"A":"B", "C":"D"}
java.lang.RuntimeException: java.io.EOFException
ReaderFactory.java:122 com.cognitect.transit.impl.ReaderFactory$ReaderImpl.read
TransitFactory.java:136 com.cognitect.transit.TransitFactory$DeferredJsonReader.read
transit.clj:285 cognitect.transit/read
Any ideas why this could be?
For clarity the curl POST request:
%curl -X POST ...../word -H "Content-Type: application/json" -d '{"A":"B", "C":"D"}' -v > abc.html
* Hostname was NOT found in DNS cache
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 178.63.65.149...
* Connected to ..... (178.63.65.149) port 80 (#0)
> POST /word HTTP/1.1
> User-Agent: curl/7.37.1
> Host: .....
> Accept: */*
> Content-Type: application/json
> Content-Length: 18
>
} [data not shown]
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 500 Server Error
* Server nginx/1.2.1 is not blacklisted
< Server: nginx/1.2.1
< Date: Sat, 04 Apr 2015 19:05:03 GMT
< Content-Type: text/html;charset=ISO-8859-1
< Content-Length: 13190
< Connection: keep-alive
<
{ [data not shown]
100 13208 100 13190 100 18 79062 107 --:--:-- --:--:-- --:--:-- 79457
* Connection #0 to host ..... left intact
Looking at your logging data, your request body is not actually json, it looks like a multi-part/form-data encoded form which includes a json file-upload.
So I've got an arduino uno with a CC3000 shield attached and I want to push data to my Xively account:
https://xively.com/develop/yS4XfViIIEEkB94MJ4zs
However I get this error when I connect:
Connected!
Request DHCP
api.xively.com -> 64.94.18.120
Data Lengthz
PUT /v2/feeds/97346308.json HTTP/1.1
Host: api.xively.com
X-ApiKey:mykey
Content-Length: z
Connection: close
{"version":"1.0.0","datastreams" : [ {"id" : "Longitude","current_value" : ""},{"id" : "Latitude","current_value" : ""}]}
Connected to Xively server.
--------------------------------------
HTTP/1.1 411 Length Required
Date: Fri, 08 Aug 2014 13:19:33 GMT
Content-Type: text/html
Content-Length: 181
Connection: close
<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx/1.1.19</center>
</body>
</html>
I understand that error 411 is a call for content length but I've alread declared this in my header and I still get this error.
Any help would be greatly appreciated :)
The Content-Length value must be a sequence of digits. What you sent is a letter, so the server complained that it didn't get your header in the correct format.
Instead of:
Content-Length: z
Use:
Content-Length: 0
If you are actually including data in the body of your request, the length should be the number of octets in the encoded body.
I am trying to send an email via the Mandrill API, but it is throwing an error with the key(s) I provide. Below is the text.json file I am including in my curl request.
{
'key' : 'MyActualKey',
'message': {
'html': '<p>Example HTML content</p>',
'text': 'Example text content',
'subject': 'example subject',
'from_email': 'from#example.com',
'from_name': 'Test',
'to': [
{
'email': 'to#example.com',
'name': 'Eric Clapton',
'type': 'to'
}
],
'headers': {
'Reply-To': 'reply#example.com'
},
'merge': True,
'tags': [
'Mandrill Test'
]
},
'ip_pool': 'Main Pool'
}
Then I execute this curl command:
curl -X POST -H "Content-Type: application/json" --data #test.json https://mandrillapp.com/api/1.0/messages/send.json -v
Resulting in this output with the error shown on the last line:
* Adding handle: conn: 0x7fd922803a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fd922803a00) send_pipe: 1, recv_pipe: 0
* About to connect() to mandrillapp.com port 443 (#0)
* Trying 54.221.22.61...
* Connected to mandrillapp.com (54.221.22.61) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: mandrillapp.com
* Server certificate: Thawte SSL CA
* Server certificate: thawte Primary Root CA
* Server certificate: Thawte Premium Server CA
> POST /api/1.0/messages/send.json HTTP/1.1
> User-Agent: curl/7.30.0
> Host: mandrillapp.com
> Accept: */*
> Content-Type: application/json
> Content-Length: 501
>
* upload completely sent off: 501 out of 501 bytes
< HTTP/1.1 500 Internal Server Error
* Server nginx/1.6.0 is not blacklisted
< Server: nginx/1.6.0
< Date: Sat, 14 Jun 2014 23:46:44 GMT
< Content-Type: application/json; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.3.10-1ubuntu3.11
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS
< Access-Control-Allow-Headers: Content-Type
< Access-Control-Allow-Credentials: false
<
* Connection #0 to host mandrillapp.com left intact
{"status":"error","code":-1,"name":"ValidationError","message":"You must specify a key value"}
Notice how the last line says 'specify a key value' - again, this is the exact key from the Mandrill control panel. I even generated a couple more and they all failed.
Try to change it into a valid json and see if that helps:
Change all single quotes into double quotes
Change the value of "merge" from "True" to lower case "true".
Have a situation where an outside user collaborates or shares a folder with a enterprise user. API call impersonating the enterprise user returns a 404 error. Please see the http exchange below using curl. Some sensitive information is masked. Appreciate any help.
curl -k -v -H "Authorization: Bearer XXXXXXXXXXXXXXXXXXXX" -H "As-User: 2146XXXXX" https://api.box.com/2.0/folders/1834XXXXXX
* About to connect() to api.box.com port 443 (#0)
* Trying 74.112.185.97... connected
> GET /2.0/folders/1834XXXXXX HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: api.box.com
> Accept: */*
> Authorization: Bearer XXXXXXXXXXXXXXXXXXXX
> As-User: 2146XXXXX
>
< HTTP/1.1 404 Not Found
< Server: nginx
< Date: Wed, 16 Apr 2014 00:34:58 GMT
< Content-Type: application/json
< Content-Length: 323
< Connection: keep-alive
< Cache-Control: no-cache, no-store
<
* Connection #0 to host api.box.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
{"type":"error","status":404,"code":"not_found","context_info":{"errors": [{"reason":"invalid_parameter","name":"item","message":"Invalid value 'd_1834XXXXXX'. 'item' with value 'd_1834XXXXXX' not found"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Not Found","request_id":"1378003773534dd03193806"}