- I decided to use a new, new plan.
- I analyzed the function handle_http_put in the existing code.
- I decided to skip further analysis and go straight to coding.
Coding up the ability to start up a new process, call ejabberd_http_bind:process_request and waiting for a reply proved very straight-forward. The hard part is formatting the response for the client.
According to wireshark, an HTTP response has the following form:
HTTP/1.1 200 OK
Content-Length: 1961
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
content...
Each line must be terminated with a carriage-return, linefeed combination. process_request actually returns most of the headers so the only work is formatting the first line, formatting the Content-Length line, and ensuring that everything uses the proper carriage-return/linefeed combos.
I am currently slogging through getting all the formatting correct. Hopefully for next time I'll have something interesting to say.
I am currently slogging through getting all the formatting correct. Hopefully for next time I'll have something interesting to say.
No comments:
Post a Comment