ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Web Request framework can only handle GET-style query params #313

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There are 3 different ways that params can be submitted as part of a web 
request.  GET-style (as part of the URL string, URL-encoded), POST-style (as 
part of the headers, HTTP-encoded) and multipart-form style (as part of the 
headers, with an encoding type of 'multipart/form-data").  The current 
TWebRequest only handles GET-style params, (and doesn't even bother decoding 
them,) so a script looking for params submitted via the other methods would be 
out of luck.

Original issue reported on code.google.com by masonwhe...@gmail.com on 29 Nov 2012 at 1:12

GoogleCodeExporter commented 8 years ago
Yes, it's currently just for the demo, lots of things are missing for the 
Response as well (like... everything).

At the moment it looks unlikely things will stay based on classes RTTI, because 
that's too fragile (triggering AVs or leaks with RTTI-exposed Delphi classes is 
far too easy). So RTTI was used as a shortcut, but isn't considered useful for 
production.

Also a lot of the content encoding (like multipart) will have to be implemented 
or better reused from other library. Originally I used Delphi's HttpApp, but it 
is ante-diluvian and vulnerable to malformed queries.

Original comment by zar...@gmail.com on 29 Nov 2012 at 2:21

GoogleCodeExporter commented 8 years ago
Attached is a patch that allows the server project to correctly handle all 3 
types of params.  It uses Indy's decoding, which is compatible with the 
server's licensing.

It also introduces the concept of attachments, but does not provide a script 
interface to them, because attachments can be arbitrary binary data and are 
best represented as streams, but DWS does not have a TStream type available.

This code is a rough draft. Feel free to refine it as necessary.

Original comment by masonwhe...@gmail.com on 26 Jan 2013 at 6:02

Attachments:

GoogleCodeExporter commented 8 years ago
Is MIT compatible with MPL? Looks like a lot like something I made for xxm as 
well:

http://sourceforge.net/p/xxm/code/HEAD/tree/trunk/Delphi/common/xxmParams.pas#l1
59

Original comment by stijnsan...@gmail.com on 28 Feb 2013 at 8:16

GoogleCodeExporter commented 8 years ago

Original comment by zar...@gmail.com on 11 Jun 2013 at 7:21