HTTP Response and Request
This week I tried to send and receive the http headers fields. For sending the header fields from the server, the task was easier since we just needed to simply send out the suitable. By referring on the microchip demo code, I wrote a code to send the required response message. The response messages of each stage were tested by using the curl command.
For receiving the header messages, it was more difficult since there are general format needed to be follow. For instances the name, contents, colon separate and CRLF termination. Firstly, I tried to read the request message by scanning the name until it meets the colon. For testing purposes, I used each messages to toggle LEDs. Whereas for the content after the colon, it will keep reading till the CRLF. If the CRLF only detected once, it will proceed to read the next message. However if a consecutive pair of CRLF were detected, the request message process will be terminated.
Next, I needed to include the HTTP with SSL function for safety purposes. The microchip demo does provide the SSL code samples but I had difficulties in compiling it. At first, I found that the problem was because I missed including some of the c and header files. However, there are still some errors even all the files are included. Hopefully this can be done as soon as possible.