← Back to team overview

ladon-dev-team team mailing list archive

Fwd: HTTP request processing

 

Hi Mike.

I'm guessing this is a replacement for "ladon-ctl testserve" into a
fullblown stand-alone server part for Ladon, right?

/ Jakob


2012/10/29 Mykhailo Stadnyk <mikhus@xxxxxxxxx>

> Hi Jacob.
>
> I considered myself to create a module which generalize work with an HTTP
> requests parsing in Python. Here what I did -
> https://github.com/Mikhus/wsgikit
> It is done with Cython and works pretty fast. From other hand I've been
> working for years with such language as PHP, so I tried to implement some
> useful ideas implemented in PHP nativley, like:
>
>  - protection from flooding (limiting the size of allowed content in
> request body, number of uploaded files, file size limit, turn on/off files
> uploads)
>  - parsing of complex arguments passed with the request to suitable Python
> dicts, like "foo[][bar]=1&foo[][baz]=2&foo[xyz]=777" => { "foo" : { 0 : {
> "bar" : 1 }, 1 : { "baz" : 2 }, "xyz" : 777 } }
>  - handling files upload via temporary storage locations (to not grab
> everything from request directly into memory)
>  - handling request data into separate storage, like SERVER, HEADERS,
> QUERY, BODY, COOKIE, FILES
>
> Finally, the module compiled es an extension for Python from native C
> code, which is generated with Cython, so it works really fast.
> Please, tell me if it's interesting for you to integrate it with Ladon? I
> assume we can discuss wsgikit module functionality and improve it to make
> a good alternative to standard Python's "cgi" module and provide generic
> solution to parse an HTTP requests in Python
>
> Actually I started to work on it because I wanted to have an ability to
> pass a complex structures via HTTP parameters in QUERY_STRING or request
> body to handle them in REST implementation.
>
> Example:
>
> user[id]=1&user[name]=John%20Doe&user[email]=john@xxxxxxx
> &user[passwd]=qwerty123
>
> by parsing to :
>
> {
>     "user" : {
>         "id" : "1",
>         "name" : "John Doe",
>         "email" : "john@xxxxxxx",
>         "passwd" : "qwerty123"
>     }
> }
>
> and could be treated as a single bypassed parameter with name "user"
> having some user-defined type.
>
> It was an initial idea, but finally it could be some generic
> implementation for HTTP requests handling.
>
>
> Please, let me know your though.
>
> Best regards,
> Mike
>



-- 
Med venlig hilsen / Best regards
Jakob Simon-Gaarde



-- 
Med venlig hilsen / Best regards
Jakob Simon-Gaarde

Follow ups