forming a GET command based on curl.exe's verbose mode

I can successfully send the following curl command to a camera:

curl -v http://10.1.1.85/ctrl/rec?action=start

  • Trying 10.1.1.85…
  • TCP_NODELAY set
  • Connected to 10.1.1.85 (10.1.1.85) port 80 (#0)

GET /ctrl/rec?action=start HTTP/1.1
Host: 10.1.1.85
User-Agent: curl/7.55.1
Accept: /

< HTTP/1.1 200 Ok
< Content-Length: 29
< Cache-Control: no-cache
< Content-Type: application/json; charset=utf-8
< Connection: close
<
{“code”:0,“desc”:"",“msg”:""}* Closing connection 0

the code 0 indicates that the operation executed successfully, and the camera indeed starts recording.

However, when I try to reproduce what I think is functionally the same command using the Ethernet library:

. . . 
    client.println("GET /ctrl/mode?action=start HTTP/1.1");
    client.println("Host: 10.1.1.85");
    client.println("User-Agent: curl/7.55.1");
    client.println("Connection: close");
    client.println();

. . .

the response looks like this:

HTTP/1.1 200 Ok
Content-Length: 30
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Connection: close

{“code”:-1,“desc”:"",“msg”:""}

and the camera does not start recording.

There are some differences in the packet, but I think they’re valid. Can you see anything wrong with the way I form my request as compared with the way curl.exe forms it?

Thank you,

You might try something like below.

  if (client.connect(myserver, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request

Ok, it turns out I had malformed my GET command, and in fact using the output from verbose CURL works fine. In my case this is the final successful command

client.println("GET /ctrl/rec?action=start HTTP/1.1");
client.println("Host: 10.1.1.85");
client.println("User-Agent: curl/7.55.1");
client.println("Accept: /");
client.println("Connection: close");
client.println();

the correct GET is

client.println("GET /ctrl/rec?action=start HTTP/1.1");

the incorrect GET is

client.println("GET /ctrl/mode?action=start HTTP/1.1");

Thank you for your help,