GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Dependents: GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more
Fork of GSwifi by
GainSpan Wi-Fi library
The GS1011 is an ultra low power 802.11b wireless module from GainSpan.
see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。
解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Diff: GSwifi_httpd.cpp
- Revision:
- 24:5c350ae2e703
- Parent:
- 23:a783c62c36d0
- Child:
- 25:f6e5622d2930
--- a/GSwifi_httpd.cpp Mon Jan 21 05:58:28 2013 +0000 +++ b/GSwifi_httpd.cpp Wed Jan 23 07:41:23 2013 +0000 @@ -174,8 +174,13 @@ #ifdef GS_USE_WEBSOCKET if (flg && _httpd[cid].mode == GSHTTPDMODE_WEBSOCKET) { // websocket + _httpd[cid].host = _gs_sock[cid].host; + j = strlen(_handler[i].uri); + _httpd[cid].file = &_httpd[cid].uri[j]; + _httpd[cid].query = NULL; + send_websocket_accept(cid); - break; // break while + break; // exit while } else #endif @@ -256,7 +261,7 @@ strcpy(file, dir); strcat(file, gshttpd->file); if (file[strlen(file) - 1] == '/') { - strcat(file, "index.htm"); + strcat(file, "index.html"); } DBG("file: %s\r\n", file); @@ -488,16 +493,11 @@ case 0x02: // binary i = get_handler(_httpd[cid].uri); if (i >= 0) { - _httpd[cid].host = _gs_sock[cid].host; - j = strlen(_handler[i].uri); - _httpd[cid].file = &_httpd[cid].uri[j]; - _httpd[cid].query = NULL; - if (_handler[i].onHttpCgi) { // cgi _handler[i].onHttpCgi(cid, &_httpd[cid]); LOG("%d.%d.%d.%d ", _httpd[cid].host.getIp()[0], _httpd[cid].host.getIp()[1], _httpd[cid].host.getIp()[2], _httpd[cid].host.getIp()[3]); - LOG("%s %s %d 200 -\r\n", _httpd[cid].type == GSPROT_HTTPGET ? "GET" : "POST", _httpd[cid].uri, _httpd[cid].length); + LOG("%s %s %d 200 -\r\n", "WEBSOCKET", _httpd[cid].uri, _httpd[cid].length); flg = 1; } } @@ -561,7 +561,6 @@ base64encode(buf2, 20, buf, sizeof(buf)); send(cid, buf, strlen(buf)); send(cid, "\r\n", 2); - // send(cid, "Sec-WebSocket-Protocol: chat\r\n", 30); send(cid, "\r\n", 2); LOG("%d.%d.%d.%d ", _httpd[cid].host.getIp()[0], _httpd[cid].host.getIp()[1], _httpd[cid].host.getIp()[2], _httpd[cid].host.getIp()[3]);