Hi,
I'm currently interfacing to an external module which has a pre-defined protocol that I'm trying to comply with. The module uses both GET and POST messages to the same cgi file, for example;
Get example; GET http://<server>/<filename>.cgi?req=<parampath>
Post example; POST http://<server>/<filename>.cgi\r\n content-Length:XX\r\n \r\n <paramPath>=<value>\r\n
I can successfully capture and action the GET messages sent by the external module via the cgi_process_var() . I don't however seem to be able to capture and action the POST messages via the cgi_process_data(). The cgi_process_data() never seems to be called on receipt of the POST message.
Is it possible to do both methods via the same cgi file?
I've tried to look at the cgi script language to see if there is anything I should be including in my cgi file but i cannot see anything other then possibly including a <FORM> element?(http://www.keil.com/support/man/docs/rlarm/rlarm_tn_http_scriptlang.htm)
My cgi file currently only contains a call to the cgi_func() via the simple script "c S E %s" to allow me to send back a custom strings to the module.
Apologies in advance for the gaps in my knowledge on this subject.
Thanks
Tom
Them both being possible sounds like good news.
We have a http server with two sessions (one for the requests from the discussed external unit and one for our simple config browser page) both on port 80.
The requests are generated by the external unit, there is no web browser under our control for these requests. It is possible to simulate/replicate the requests being sent by the external equipment by using HTTP-Client software like "I'm Only Resting" from Swensen Software.
Some example messages that are sent to us (assuming our IP is 192.168.100.23) to process would be;
Get Example;
The request would be in the format; GET 192.168.100.23/.../param.cgi
Our response is in the format HTTP/1.0 200 OK\r\n Content-Type: text/html\r\n \r\n General.UnitName=My Name\r\n
Post Example;
The request would be in the format; POST 192.168.100.23/.../param.cgi\r\n Content-Length: 26\r\n \r\n General.UnitName=New Name\r\n
Our response to confirm the would be; HTTP/1.0 200 OK\r\n Content-Type: text/html\r\n Content-Length: 26\r\n \r\n General.UnitName=My Name\r\n
Thank you for your continued support.