Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative header handling #24

Conversation

mikee47
Copy link

@mikee47 mikee47 commented Aug 2, 2019

As a suggestion, if we keep a note of headerName the code is clearer and more flexible if we want to check other header fields.

Throwing a junk file at it I get this (emulator):

8969445 TCP received: 536 bytes
8969445 TCP onReadyToSendData: 1
8969445 The headers are complete
8969445 Mapped 'firmware' @ 0x00002000
8970422 TCP received: 107 bytes
8970422 TCP onReadyToSendData: 1
8972374 partBegin
8972374 readHeaderName('Content-Disposition')
8972374 readHeaderValue('form-data; name="firmware"; filename="App_Common.c"')
8972374 parser->name = 'firmware'
8972374 readHeaderName('Content-Type')
8972374 readHeaderValue('text/x-csrc')
8972374 partData(2 bytes)
flashmem_write: 0x00002000, 0
8972374 rboot_write_flash: item.size: 3
8973351 partData(2 bytes)
flashmem_write: 0x00002000, 4
8973351 rboot_write_flash: item.size: 5
8973351 partData(0 bytes)
8973351 rboot_write_flash: item.size: 5
8973351 partData(2 bytes)
flashmem_write: 0x00002004, 0
8973351 rboot_write_flash: item.size: 7

`useValue` remains set after parsing `Content-Disposition`, fails in `Content-Type` and aborts the entire thing.

With extra debug we now get this:

```
8969445 TCP received: 536 bytes
8969445 TCP onReadyToSendData: 1
8969445 The headers are complete
8969445 Mapped 'firmware' @ 0x00002000
8970422 TCP received: 107 bytes
8970422 TCP onReadyToSendData: 1
8972374 partBegin
8972374 readHeaderName('Content-Disposition')
8972374 readHeaderValue('form-data; name="firmware"; filename="App_Common.c"')
8972374 parser->name = 'firmware'
8972374 readHeaderName('Content-Type')
8972374 readHeaderValue('text/x-csrc')
8972374 partData(2 bytes)
flashmem_write: 0x00002000, 0
8972374 rboot_write_flash: item.size: 3
8973351 partData(2 bytes)
flashmem_write: 0x00002000, 4
8973351 rboot_write_flash: item.size: 5
8973351 partData(0 bytes)
8973351 rboot_write_flash: item.size: 5
8973351 partData(2 bytes)
flashmem_write: 0x00002004, 0
8973351 rboot_write_flash: item.size: 7
```
@slaff slaff merged commit 7099672 into slaff:feature/httpserver-multipart-bodyparser Aug 2, 2019
@mikee47 mikee47 deleted the feature/httpserver-multipart-bodyparser branch August 3, 2019 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants