sparkfun / SFE_CC3000_Library

Arduino library for the TI CC3000 WiFi module
Other
31 stars 11 forks source link

400 Bad Request error on GET requests #3

Closed vergun closed 10 years ago

vergun commented 10 years ago

Have you experienced issues with the library GET request resulting in a 400 error on the server?

Monitoring the server's nginx access logs, this is what I see: 76.14.47.3 - - [17/Jun/2014:06:08:23 +0000] "-" 400 0 "-" "-"

Wifi.init() works; then, I'm able to dns lookup the server; then, I'm able to ping the server with the library; then, I'm able to get True response from client.connect(server, 80); then, I'm able to get True response from client.connected();

Then, this code just waits and after some time I see the 400 on the server access logs:

// Make a HTTP GET request client.println("GET / HTTP/1.1"); client.print("Host: "); client.println(server); client.println("Connection: close"); client.println(); Serial.println();

Running the WebClient example and only changing the SSID and Password fields, I see: SparkFun CC3000 - WebClient; then no output from Serial monitor.

The server variable is set to "k9.x64.me". I can "curl k9.x64.me" and "curl k9.x64.me:80" and get the html response back in terminal.

How does client.println and client.print and the last client.println() work? I couldn't find these methods in the source. Also, what would fix my issues?

ShawnHymel commented 10 years ago

This issue got buried in my emails - so sorry!

I'm confused as to what the issue is. Are you unable to make GET requests to any server? Or just yours?

As for print/println, SFE_CC3000_Client extends Client, which is an Arduino class that offers some basic functionality for web connections (read, write, fluch, peek, etc.). This allows you to call print() and println() and that will send out strings via the connection. You'll have to dig into Arduino's Client class if you want to see the internals.

vergun commented 10 years ago

You can mark this as resolved. The problem was due to running out of memory. Fishy fishy.

ShawnHymel commented 10 years ago

Cool. Glad it worked out.