-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
add begin(port) to esp8266webserver, move some strings to flash, some refactoring #4148
Conversation
I'm including some string stuff here: moving strings to flash, remove duplicates, and so on. |
Alright, moving all the strings and so on saves 368b of heap on build with the HttpBasicAuth example, and increases the bin size by 496b. I actually expected the bin size to decrease as well, given that I removed several duplicate strings. No idea why it went the opposite direction. |
_nc = _exractParam(authReq,"nc=",','); | ||
_cnonce = _exractParam(authReq,"cnonce=\""); | ||
if(authReq.indexOf(FPSTR(qop_auth)) != -1) { | ||
_nc = _extractParam(authReq, F("nc="), ','); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this typo in the method name! _exractParam always gave me a headache!
Any other comments? corrections? suggestions? observations? indications? tribulations? |
The mimetable array and enum being in separate files will be a pain to keep in sync, if we ever add things (but that seems unlikely). Only [gz] is used, so why not just hardcode ".gz". It's not likely that the standard compression format identifier is going to change in the lifetime of this code (famous last words). You could drop the enum then, no? You were very thorough in moving strings to PMEM, but as .rodada does dedupe, I'm not sure you gained anything from changing "" to F("") (and in some spots "" -> String()). OTW looks good to me, no problems. |
About the mimetable in its own file, I thought it might be useful for some users. I even need it myself for something stupid. Maybe it shouldn't be under details directory, but if it's to be moved, I'm thinking do it later. |
@earlephilhower looks like you were right: adding F() to short strings like "" or "/r/n" doesn't improve heap, and increases bin size. I'm gonna guess that the inflection point is strings of size 4, so 3 chars. More importantly: is the mimetable correctly declared to hold everything in flash? |
Ignore previous comment. I see the SDWebServer itself is the one causing these to be in RODATA. It basically repeats all MIME types in loadFromSdCard(). I think you're golden. |
The mimetable is an array of structs with 2 string members, which is different than an array of pointer to strings, which is why that last look made my spidey sense tingle... |
You missed my updated comment. You're all good, the strings are actually all repeated in the SDWebServer example that I compiled to test. So, no problems w/the changes, but we may want to refactor the examples at some point... |
Oh, I did miss it. Great! Nothing further to do here then :) |
No description provided.