ayena.de

Transfer HTTP POST data to lua

Wednesday, September 19, 2007 - 07:45 PM

Luaetta FS#9

Links:

Requirements:

  • handling forms and binary data, even mixed
  • don't overload the lua stack with large binary blobs
  • easy handling of long upload processes

Solutions:

All solutions refer to this example:
  1. Content-Type: multipart/related; boundary=f93dcbA3; type=application/xml; start="<980119.X53GGT@example.com>"
  2. Content-Length: xxx
  3.  
  4. --f93dcbA3
  5. Content-Type: application/xml; charset=UTF-8
  6. Content-ID: <980119.X53GGT@example.com>
  7.  
  8. <?xml version="1.0"?>
  9. <uploadDocument>
  10. <title>My Proposal</title>
  11. <author>E. X. Ample</author>
  12. <summary>A proposal for a new project.</summary>
  13. <notes image="cid:980119.X17AXM@example.com">(see handwritten region)</notes>
  14. <keywords>project proposal funding</keywords>
  15. <readonly>false</readonly>
  16. <filename>image.png</filename>
  17. <content>cid:980119.X25MNC@example.com</content>
  18. </uploadDocument>
  19. --f93dcbA3
  20. Content-Type: image/png
  21. Content-Transfer-Encoding: binary
  22. Content-ID: <980119.X25MNC@example.com>
  23.  
  24. ...Binary data here...
  25. --f93dcbA3
  26. Content-Type: image/png
  27. Content-Transfer-Encoding: binary
  28. Content-ID: <980119.X17AXM@example.com>
  29.  
  30. ...Binary data here...
  31. --f93dcbA3--

Solution A

A second argument for the onRequest() hook containing a table with an ID and MIME-type of each content.
Comment! Keep reading >>