HTTP Request fails with argv[1]

When I make my HTTP request this way, it kinda works.
char *httprequestdata = "GET / HTTP/1.1\r\n";
send(socketforsending, httprequestdata, strlen(httprequestdata), 0);

send(socketforsending, argv[1], strlen(argv[1]), 0);

When making request with paramater './requestprogram "GET / HTTP/1.1\r\n" ' it fails, at least I can't see request in 'access_log'.
When you pass \r\n in a string, it's translated to 2 binary characters 13 and 10, corresponding to CR and LF.

When you pass them on the command line, they're treated as strings, i.e. 4 characters \, r, \, n.

BTW, you end an HTTP request with \r\n\r\n.
Topic archived. No new replies allowed.