I believe the problem is that Perl's "encode_base64" function appends a newline to its output value. You need to suppress this behavior by adding an empty string as the second argument.
The 2-minute delay you were seeing was because you specified Content-Length:200 but didn't send any data. The server was waiting until it timed out. You should either set Content-Length:0 or use --data-binary=@filename to send a file.
Here's my updated code. I also removed the extra $Date from the signature and just kept the newline.
Have you considered using one of our language bindings if you're using Java, .NET, PHP, Ruby, etc? The bindings perform request signing, sending, parsing, etc.
Can you post a Wireshark trace of the HTTP request so that we can look at what's actually being sent over the wire?
The 1002 error you're seeing may be because your request is missing the required "Content-Length" http header. Is curl reading from stdin? (If so try reading from a file to prove your signatures are correct.) What size object are you trying to create?
As an aside, I would advise removing the HTTP basic authentication from your request... Its basically harmless since Atmos ignores it -- instead relying on its own native REST-based authentication -- but its best to remove these from your curl requests.
Are you using on-premise Atmos? The AT&T Synaptic service doesn't allow port 80, as far as I know.
Are you still seeing the 1032 signature mismatch errors at this point?
JasonCwik
281 Posts
0
July 13th, 2012 11:00
I believe the problem is that Perl's "encode_base64" function appends a newline to its output value. You need to suppress this behavior by adding an empty string as the second argument.
The 2-minute delay you were seeing was because you specified Content-Length:200 but didn't send any data. The server was waiting until it timed out. You should either set Content-Length:0 or use --data-binary=@filename to send a file.
Here's my updated code. I also removed the extra $Date from the signature and just kept the newline.
And the output:
rbala1
222 Posts
1
July 5th, 2012 00:00
Have you considered using one of our language bindings if you're using Java, .NET, PHP, Ruby, etc? The bindings perform request signing, sending, parsing, etc.
Can you post a Wireshark trace of the HTTP request so that we can look at what's actually being sent over the wire?
JasonCwik
281 Posts
1
July 5th, 2012 07:00
I think the problem is that in your signature string you have:
application/octet-stream
But your curl command line has:
-H "Content-type:Application/octet-stream"
Try changing Application to lowercase on the curl command.
What language are you using? As Raj mentioned, we recommend using one of our exising APIs.
sadimadh2
18 Posts
0
July 6th, 2012 02:00
Jason,
Thank you for your response. If I change the header to lower case, I get a 1002 error (invalid header).
sadimadh2
18 Posts
0
July 6th, 2012 02:00
Bala and Jason,
I am more comfortable working with perl, I did not find a link for a binding in Perl. Will reply with the wireshark op soon
sadimadh2
18 Posts
0
July 6th, 2012 02:00
This is the message captured by wireshark.
Since I am working on a windows platform, I see that the carriage return is implemented as \r\n. But in my signature, there would only be \n
Let me check it on a linux machine and come back
Hypertext Transfer Protocol
POST /rest/objects HTTP/1.1\r\n
Authorization: Basic YXRtb3N1Z3JAc2E3MjRwLmluOnVzaTEyMzQ1\r\n
User-Agent: curl/7.24.0 (i686-pc-cygwin) libcurl/7.24.0 OpenSSL/1.0.1 zlib/1.2.5 libidn/1.22 libssh2/Accept:*/*\r\n
Content-type:Application/octet-stream\r\n
Host:135.21.93.176\r\n
Date:Fri, 6 Jul 2012 09:41:55 GMT\r\n
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin\r\n
x-emc-signature:d1DwpdhQj7NBH+N+2V2oNxRUoXk=\n
\r\n
sadimadh2
18 Posts
0
July 6th, 2012 03:00
no change from linux as well...over to you
JasonCwik
281 Posts
0
July 6th, 2012 06:00
It's definitely the "A" in "Application/octet-stream". Can you make that lowercase and then wireshark the result if you still get the invalid header?
sadimadh2
18 Posts
0
July 6th, 2012 09:00
Invalid header was my mistake earlier may be, but I still hit the signature mismatch
sadimadh2
18 Posts
0
July 6th, 2012 09:00
The request and error:
$ perl staas_test.pl
POST
application/octet-stream
Fri, 6 Jul 2012 16:36:31 GMT
/rest/objects
x-emc-date:Fri, 6 Jul 2012 16:36:31 GMT
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
iM5wF6SCNGCQsVPufOsU0wJIaCE=
* About to connect() to 135.21.93.176 port 80 (#0)
* Trying 135.21.93.176...
* connected
* Connected to 135.21.93.176 (135.21.93.176) port 80 (#0)
* Server auth using Basic with user 'atmosugr@sa724p.in'
> POST /rest/objects HTTP/1.1
> Authorization: Basic YXRtb3N1Z3JAc2E3MjRwLmluOnVzaTEyMzQ1
> User-Agent: curl/7.24.0 (i686-pc-cygwin) libcurl/7.24.0 OpenSSL/1.0.1 zlib/1.2 .5 libidn/1.22 libssh2/1.4.0
> Accept:*/*
> Content-type:application/octet-stream
> Host:135.21.93.176
> Date:Fri, 6 Jul 2012 16:36:31 GMT
> x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
> x-emc-signature:iM5wF6SCNGCQsVPufOsU0wJIaCE=
>
>
< HTTP/1.1 403 Forbidden
< Date: Fri, 06 Jul 2012 16:36:33 GMT
< Server: Apache
< Content-Length: 195
< Connection: close
< Content-Type: text/xml
<
{ [data not shown]
* Closing connection #0
1032Output from Wireshark:
Hypertext Transfer Protocol
POST /rest/objects HTTP/1.1\r\n
[Expert Info (Chat/Sequence): POST /rest/objects HTTP/1.1\r\n]
Request Method: POST
Request URI: /rest/objects
Request Version: HTTP/1.1
Authorization: Basic YXRtb3N1Z3JAc2E3MjRwLmluOnVzaTEyMzQ1\r\n
User-Agent: curl/7.24.0 (i686-pc-cygwin) libcurl/7.24.0 OpenSSL/1.0.1 zlib/1.2.5 libidn/1.22 libssh2/1.4.0\r\n
Accept:*/*\r\n
Content-type:application/octet-stream\r\n
Host:135.21.93.176\r\n
Date:Fri, 6 Jul 2012 16:36:31 GMT\r\n
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin\r\n
x-emc-signature:iM5wF6SCNGCQsVPufOsU0wJIaCE=\n
\r\n
[Full request URI: http://135.21.93.176/rest/objects]
Hypertext Transfer Protocol
\r\n
sadimadh2
18 Posts
0
July 6th, 2012 10:00
One more thing is, tenant is at&t storage as a service.
JasonCwik
281 Posts
0
July 6th, 2012 11:00
I see you're using x-emc-date. Try removing the plain date from your signature string and replace with an empty line, e.g.
POST
application/octet-stream
/rest/objects
x-emc-date:Fri, 6 Jul 2012 16:36:31 GMT
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
sadimadh2
18 Posts
0
July 6th, 2012 12:00
POST
application/octet-stream
/rest/objects
x-emc-date:Fri, 6 Jul 2012 19:50:14 GMT
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
EiUsxVN1kSIz7vGPRXxw2kvJGlA=
* About to connect() to 135.21.93.176 port 80 (#0)
* Trying 135.21.93.176...
* connected
* Connected to 135.21.93.176 (135.21.93.176) port 80 (#0)
* Server auth using Basic with user 'atmosugr@sa724p.in'
> POST /rest/objects HTTP/1.1
> Authorization: Basic YXRtb3N1Z3JAc2E3MjRwLmluOnVzaTEyMzQ1
> User-Agent: curl/7.24.0 (i686-pc-cygwin) libcurl/7.24.0 OpenSSL/1.0.1 zlib/1.2.5 libidn/1.22 libssh2/1.4.0
> Accept:*/*
> Content-type:application/octet-stream
> Host:135.21.93.176
> x-emc-date:Fri, 6 Jul 2012 19:50:14 GMT
> x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
> x-emc-signature:EiUsxVN1kSIz7vGPRXxw2kvJGlA=
>
>
< HTTP/1.1 400 Bad Request
< Date: Fri, 06 Jul 2012 19:50:15 GMT
< Server: Apache
< Content-Length: 145
< Connection: close
< Content-Type: text/xml
<
{ [data not shown]
* Closing connection #0
1002Wireshark O/P:
Hypertext Transfer Protocol
POST /rest/objects HTTP/1.1\r\n
Authorization: Basic YXRtb3N1Z3JAc2E3MjRwLmluOnVzaTEyMzQ1\r\n
User-Agent: curl/7.24.0 (i686-pc-cygwin) libcurl/7.24.0 OpenSSL/1.0.1 zlib/1.2.5 libidn/1.22 libssh2/1.4.0\r\n
Accept:*/*\r\n
Content-type:application/octet-stream\r\n
Host:135.21.93.176\r\n
x-emc-date:Fri, 6 Jul 2012 19:50:14 GMT\r\n
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin\r\n
x-emc-signature:EiUsxVN1kSIz7vGPRXxw2kvJGlA=\n
\r\n
[Full request URI: http://135.21.93.176/rest/objects]
Hypertext Transfer Protocol
\r\n
BrianOlson
13 Posts
1
July 12th, 2012 23:00
Hi,
The 1002 error you're seeing may be because your request is missing the required "Content-Length" http header. Is curl reading from stdin? (If so try reading from a file to prove your signatures are correct.) What size object are you trying to create?
As an aside, I would advise removing the HTTP basic authentication from your request... Its basically harmless since Atmos ignores it -- instead relying on its own native REST-based authentication -- but its best to remove these from your curl requests.
Are you using on-premise Atmos? The AT&T Synaptic service doesn't allow port 80, as far as I know.
Are you still seeing the 1032 signature mismatch errors at this point?
sadimadh2
18 Posts
0
July 13th, 2012 02:00
I put the content-length header in, I get the same error, only thing different now is there is a 2minute wait.
POST
application/octet-stream
Fri, 13 Jul 2012 09:12:15 GMT
/rest/objects
x-emc-date:Fri, 13 Jul 2012 09:12:15 GMT
x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
/WnCu9IFA7B+gX+0md5pFpgnFXY=* About to connect() to 135.21.93.176 port 80 (#0)
* Trying 135.21.93.176...
* connected
* Connected to 135.21.93.176 (135.21.93.176) port 80 (#0)
> POST /rest/objects/ HTTP/1.1
> User-Agent: curl/7.24.0 (i686-pc-cygwin) libcurl/7.24.0 OpenSSL/1.0.1 zlib/1.2.5 libidn/1.22 libssh2/1.4.0
> accept:*/*
> content-type:application/octet-stream
> content-length:200
> host:135.21.93.176
> x-emc-date:Fri, 13 Jul 2012 09:12:15 GMT
> x-emc-uid:d3ade228823c412b8a3460084e7917e2/atmosugrATsa724pDOTin
> x-emc-signature:/WnCu9IFA7B+gX+0md5pFpgnFXY=
>
< Date: Fri, 13 Jul 2012 09:12:16 GMT
< Server: Apache
< Content-Length: 195
< Connection: close
< Content-Type: text/xml
<
{ [data not shown]
* Closing connection #0
1032