I can download a test.pdf file using this get command below with a code that I've in C for a microcontroller to communicate with a server:
GET /TestFolder/test.pdf HTTP/1.1\r\n Host: www.xyz.com\r\n\r\n the file: test.pdf is located in folder: TestFolder at Host: xyz.com
I wanted to test the program on Amazon S3; so I created an account and uploaded the data and made the file and folder public, added policy to the S3 bucket so objects can be accessed. When I send the GET command above to the S3 host: s3-us-west-2.amazonaws.com I get an error after the socket is connected and I get the server's IP, error message from S3 says:
Response error: HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Date: Mon, .. 2015 04:15:02 GMT
Connection: close
Server: AmazonS3
I thought to remove extra \r\n from the get command, and sent this command to s3 GET /TestFolder/test.pdf HTTP/1.1\r\n Host: s3-us-west-2.amazonaws.com\r\n
This time, the requests hangs with no response. I don't get any error message, the socket is connected as usual and I see the server's IP.
I'll appreciate any suggestion or input where the problem could be. Obviously the GET command works for file download when the file is public at other sites, has anyone encountered this kind of issue with http/1.1 GET command? I can access the file from AWS S3 in my browser by typing the link.