Hi guys, I am trying to connect to discord (which I know probably can't happen on Arduino Uno because of the cryptography) and I ran into a problem where I would receive a HTTP 400 response (Bad Request)
It is odd because it happens when I write information to the server instead of println'ing headers.
Example of code that works:
if (client.connect(server, 80)) {
Serial.println("connecting...");
client.println("GET /gateway HTTP/1.1");
client.println("Host: discord.com");
client.println("Connection: close");
client.println();
}
Code that is a bad request:
myFile = SD.open("AUP/shake.txt");
while(myFile.available()){
client.write(buffer, myFile.read(buffer, 80));
}
AUP/shake.txt:
GET /gateway HTTP/1.1\r\nHost: discord.com\r\nConnection: close\r\n\r\n
Unsure why this happens, the code references the text file correctly, I checked with Serial.