[asterisk-dev] [Code Review] 3125: http: support chunked Transfer-Encoding

Matt Jordan reviewboard at asterisk.org
Mon Jan 13 16:24:59 CST 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3125/#review10583
-----------------------------------------------------------



/branches/12/include/asterisk/http.h
<https://reviewboard.asterisk.org/r/3125/#comment20045>

    Since this isn't getting called anywhere other than in http.c, why not make it static? That way, we don't have any modifications to the http API in the middle of 12, which is always nice.



/branches/12/main/http.c
<https://reviewboard.asterisk.org/r/3125/#comment20046>

    Spaces:
    
    int value = 0;



/branches/12/main/http.c
<https://reviewboard.asterisk.org/r/3125/#comment20051>

    You could actually defer allocating buffer here until you know content_length + chunk_length, then allocate the buffer. That would have the benefit of only allocating as much memory as you actually need.



/branches/12/main/http.c
<https://reviewboard.asterisk.org/r/3125/#comment20047>

    You don't need the while(1) here, as you aren't breaking out of the block scope that it provides.



/branches/12/main/http.c
<https://reviewboard.asterisk.org/r/3125/#comment20049>

    I'd put the word "HTTP" in the warning message, as the other warning messages were kind enough to tell the user what had an error condition



/branches/12/main/http.c
<https://reviewboard.asterisk.org/r/3125/#comment20050>

    Well, if chunk_length is *really* big, even bufsize *=2 might not be sufficient.
    
    In fact, MAX_POST_CONTENT is 1025, so we should never actually hit this code, since we explicitly disallow a chunk_length + content_length greater than that.


- Matt Jordan


On Jan. 13, 2014, 4:09 p.m., Scott Griepentrog wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3125/
> -----------------------------------------------------------
> 
> (Updated Jan. 13, 2014, 4:09 p.m.)
> 
> 
> Review request for Asterisk Developers and Matt Jordan.
> 
> 
> Bugs: ASTERISK-23068
>     https://issues.asterisk.org/jira/browse/ASTERISK-23068
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Implements support for HTTP chunked mode Transfer-Encoding in JSON and Form (post vars) body content.  Relocated code from ast_http_get_json() and ast_http_get_post_vars() that reads content from stream into new function ast_http_get_contents(), and added support for reading and decoding chunked mode transfers.
> 
> 
> Diffs
> -----
> 
>   /branches/12/main/http.c 405282 
>   /branches/12/include/asterisk/http.h 405282 
> 
> Diff: https://reviewboard.asterisk.org/r/3125/diff/
> 
> 
> Testing
> -------
> 
> Testsuite test rest_api/chunked_transfer added (see https://reviewboard.asterisk.org/r/3126/) to insure correct operation of chunked and regular mode.
> 
> 
> Thanks,
> 
> Scott Griepentrog
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140113/fdea60fc/attachment-0001.html>


More information about the asterisk-dev mailing list