-
Notifications
You must be signed in to change notification settings - Fork 4
Misc Webserver Changes #11
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
base: master
Are you sure you want to change the base?
Conversation
When HTTP request was being built, the http headers were loaded out of order. The header that was used to build the RequestLine and URI required the 'Host' header which was loaded in a subsequent iteration of the While loop. This resulted in an exception being thrown when the URI was created. I resolved this by adding all of the other HTTP headers first and then loading the RequestLineAndURI after the While loop completed. Also, the method that was used to add the headers to the HeaderCollection in the RequestContext didn't have a constructor for the HeaderCollection class and so a null exception was thrown as soon as a header was attempted to add to the HeaderCollection. I created a default constructor for the RequestContext Class (Just as was done for the ResponseContext Class) which solved this issue. I noticed that the default code had a HeaderCollection constructor in the SetHeaders(), however this method wasn't utilized.
Added a ToHexString extension method for Byte Arrays. Changed the NetworkInterfaceLocator() method so that it would use the new ToHexString extension method when writing out the MAC address so that it would be displayed in Hexidecimal instead of its previously displayed decimal value.
I was having a problem with serializing quotation marks using the JsonSerializer class. I implemented Json.NetMF package and implemented it's serialization method in the Controller Class instead; this corrected the problem.
Integrated an SDCard Class to help stave off any possible concurrency update issues that may be encountered from reading and writing the SDCard. Implemented a FileController class that can be inherited instead of Controller when the Rinsen.WebServer.FileAndDirectoryServer Project is integrated with a Rinsen.WebServer project.
leveraged the JsonSerializer class to inherit from Json.NETMF so that JSON serialization implementation could remain unchanged.
I added an SDCardContents Directory for use in serving up the filemanager.html page that shows an ajax post to upload a text file to the Netduino
|
I added a SDCard manager to help deal with any possible concurrency update issues that could occur from reading/writing to the SDCard. |
Used the .ToUpper() method to perform case insensitive matches on content types base on file extensions in the FileAndDirectoryService Class. Replaced Method text matches with enum implementation of the value.
|
Good work! I have tried to do some tests in the emulator but can´t make it load any programs main method in Windows 10 with VS2015 for some reason that I don´t understand... |
I moved the function GetMoreBytes to an extension method instead of in the SDCardMagager Class
Implemented ContentType Enums, ContentSubtype enums. Fixed issues with my SDCard class needing to be static and moved extension methods all into one File on Rinsen.WebServer
|
|
New versions can for sure be a pain :) I had to install VS2013 yesterday because I cant get it to run in 2015... But that will hopefully solve my issues so I can try to run some code :) And yes, time is always a big issue :) |
Ajax post Data is now written to file with no gaps in data.
Files are now saved to the SDCard as Byte Arrays which allows for Uploads of any file type.
I had an issue where the the boundary data was not removed in files that could be read within the first pass of the buffer.
|
Implemented Binary File upload. All files that get uploaded are now written to the SD Card as Byte Arrays; this allows the uploading of files that couldn't be decoded with UTF8. It is slow and I had to kind of brute force the thing, but it works rather reliably and should also be able to handle multiple file uploads as well... The code could use some refining and I should divert any text Content Types to instead use the faster UTF8 method, but those will be future tasks :) |
|
Fredrik, I spoke too soon, cause it was unreliable when I switched to files that are loaded in multiple passes :) So I just put a fix in place. |
|
What do you think of these? Would you prefer me to clean out my fork and then just pull incremental changes into it so that you can test before committing? |
|
I will probably have some hours to spend on this tomorrow so I will get back to you after that :) A busy time both at work and at home now before Christmas :) |
|
It's a shame how work always has to get in the way of fun :) |
|
Hi! I have slooowly been looking into this and its a lot of good things 👍 I have one thing that I can´t include because it will break existing code for me and others. It´s the change from strings to enums in response types and I personally don´t like like having external constants as build in enums, but I still like the idea of having nice compiler support when writing code that I guess you are after here :) And I should have asked you in the beginning to give me a few smaller pull request instead of this huge one to make it easier to follow all the changes :) And it really makes me sad to see such an awesome thing as the Netduino product/community slowly dying :/ |
|
Hey Fredrik! Thanks for the kind words; take what you feel would be good to incorporate and leave the rest. That is fine. |
|
Hi! I am not that fast either and my Netduino have run its last code since I fried it, so not much more will happen here. And of course it is always nice to get new toys and the Pi is really really nice! The only sad thing is that the end was so fast and because of a failed project.. Ant thanks for that feedback! Its really fun and gives a lot of motivation to see things I have done come to life and use in projects that I don´t own! :) |
|
Fredrik, Regards, |
|
Hi! https://www.hanselman.com/blog/NETCoreAndNETStandardForIoTThePotentialOfTheMeadowKickstarter.aspx Let's hope it goes way better that the agent smart watch...! /Fredrik |
|
LOL Totally! |
Fredrik,
You did a great job on that webserver! I am currently using it on a Netduino 3 WiFi that I integrated with a push cart, scale, scanner and label printer. Your software works flawlessly and makes publishing pages to it a snap! Soon I'll be adding functionality to the webserver that allows file uploads; I've got it in beta testing on my ScaleIndicatorPrinter project. Thank you for the server and the input. I am flattered that you are going to incorporate some of the changes I made.