Skip to content

Commit ab06842

Browse files
committed
Switch micropython to commit which implements TCP listen/accept backlog support
Fix unittest - support both: remove/unlink
1 parent 8c8ae15 commit ab06842

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ install:
2121
- ln -s ../../uasyncio.core/uasyncio/core.py `pwd`/micropython-lib/uasyncio/uasyncio
2222
- ln -s `pwd`/micropython-lib/uasyncio/uasyncio $MDST/uasyncio
2323
- ln -s `pwd`/tinyweb $MDST/tinyweb
24-
# compile/install micropython. Use release v1.9.4
24+
# compile/install micropython.
25+
# Use commit "extmod/modlwip: Implement TCP listen/accept backlog"
26+
# In order to support TCP listen/accept backlog
2527
- cd micropython
26-
- git checkout v1.9.4
28+
- git checkout 4737ff8054e84b3ccd1e7364d773a8c1d14095f5
2729
- sudo make -C ports/unix axtls install
2830
- cd ..
2931

@@ -42,8 +44,8 @@ script:
4244
- export MPORT=micropython/ports/esp32/modules
4345
- ln -s `pwd`/tinyweb $MPORT/tinyweb
4446
- ln -s `pwd`/micropython-lib/uasyncio/uasyncio $MPORT/uasyncio
45-
# Supported SDK for 1.9.4 is 3ede9f011b50999b0560683f9419538c066dd09e
46-
- docker run -v`pwd`/micropython:/micropython arsenicus/esp32-open-sdk:3ede9f011b50999b0560683f9419538c066dd09e /bin/bash -c ". /.bashrc && cd /micropython/ports/esp32 && make"
47+
# Supported ESP32 SDK
48+
- docker run -v`pwd`/micropython:/micropython arsenicus/esp32-open-sdk:30545f4cccec7460634b656d278782dd7151098e /bin/bash -c ". /.bashrc && cd /micropython/ports/esp32 && make"
4749
- cp micropython/ports/esp32/build/firmware.bin ./firmware_esp32-$TRAVIS_TAG.bin
4850

4951
deploy:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ Simple? Oh yeah!
7272

7373
Like it? Check more [examples](https://github.com/belyalov/tinyweb/tree/master/examples) then :)
7474

75-
### Limitation / Known issues
75+
### Limitations
7676
* HTTP protocol support - due to memory constrains only **HTTP/1.0** is supported (with exception for REST API - it uses HTTP/1.1 with `Connection: close`). Support of HTTP/1.1 may be added when `esp8266` platform will be completely deprecated.
77-
* [esp8266: socket accept() does not always accept](https://github.com/micropython/micropython/issues/2490) - sometimes whenever you're opening connection simultaneously some of them will never be accepted. Therefore it is strongly recommended to pack all your data (like `css`, `js`) into single html page.
7877

7978
### Reference
8079
#### class `webserver`

test/test_server.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@
1414
from tinyweb.server import request, HTTPException
1515

1616

17-
# HTTP headers helpers
17+
# Helper to delete file
18+
def delete_file(fn):
19+
# "unlink" gets renamed to "remove" in micropython,
20+
# so support both
21+
if hasattr(os, 'unlink'):
22+
os.unlink(fn)
23+
else:
24+
os.remove(fn)
1825

1926

27+
# HTTP headers helpers
2028
def HDR(str):
2129
return '{}\r\n'.format(str)
2230

@@ -774,7 +782,7 @@ def setUp(self):
774782

775783
def tearDown(self):
776784
try:
777-
os.unlink(self.tempfn)
785+
delete_file(self.tempfn)
778786
except OSError:
779787
pass
780788

@@ -812,7 +820,7 @@ def testSendFileNotFound(self):
812820
wrt = mockWriter()
813821

814822
# Intentionally delete file before request
815-
os.unlink(self.tempfn)
823+
delete_file(self.tempfn)
816824
run_coro(self.srv._handler(rdr, wrt))
817825

818826
exp = ['HTTP/1.0 404 MSG\r\n\r\n']

0 commit comments

Comments
 (0)