2008 Headshot

The Life Unwired

with Ben Combee

Webduino 1.3 update
2008 Headshot
[info]unwiredben
(Update: version 1.3.1 is now up due to a nasty bug found over the weekend.  I didn't test as well as I should have.)

I've updated my Webduino web server library to version 1.3.  This was prompted by a discussion over on arduino.cc where a user was having problems communicating with the server from his cell phone.  I looked at the "read a new character from the network" logic and realized that a slow connection could let the Arduino think the client had finished its request when it really was just waiting on a new packet from the sender.

When I fixed that, I ran into a new issue.  Modern HTTP clients will usually make a request in "keep-alive" mode.  This means they don't close the socket when the finish asking the server for data, but instead keep it alive in case they want to send more requests.  So, to determine where I was done reading POST data, I needed to look at the Content-Length header passed with the POST and kill the connection after reading that many bytes.  Before, this wasn't a problem, as I'd just assume the connection was dropped when I didn't have any new data coming in from the client.

These fixes are in v1.3, along with some code you can turn on to debug your server's responses (it does slow things down a bit because the serial output code doesn't run in the background) and a fix for a possible security hole in parsing POST requests.

If you're into it, get the new code from http://webduino.googlecode.com.

Introducing webduino
2008 Headshot
[info]unwiredben
I've been working on a pretty nice chunk of code for the class I'm teaching later today. The main idea of the class is to put a web server on an Arduino board. Once you've got that, you can use any computer with a browser to pull data from the board or send commands to control things. As I worked on the code, I realized that a little refactoring would turn it into a nice framework for building lots of different webby things.

If you're interested, the project is hosted at http://webduino.googlecode.com. I'm releasing it with a MIT-style license. I expect to do a few more modifications to it over the next few days, especially after feedback I get from the class. I'll also probably restructure it to fit into the library scheme used for Arduino add-ons; right now, you just put a copy of the header into the folder with your code, which is nice for keeping it with your sketch, but not-so-nice for code duplication.