[asterisk-dev] [Code Review] 3541: res_http_websocket: Create a websocket client

Kevin Harwell reviewboard at asterisk.org
Mon Jun 2 10:54:10 CDT 2014



> On May 31, 2014, 4:06 a.m., wdoekes wrote:
> > trunk/main/uri.c, lines 183-187
> > <https://reviewboard.asterisk.org/r/3541/diff/6/?file=59049#file59049line183>
> >
> >     I'm not seeing that with the git version. And what happens when someone *does* want X in the URL?
> >     
> >     
> >     My test against the git version:
> >     
> >     src/uriparser-git$ cat 1.c 
> >     
> >     #include <uriparser/Uri.h>
> >     #include <stdio.h>
> >     
> >     int main(int argc, char **argv) {
> >     	UriParserStateA state;
> >     	UriUriA uri;
> >     
> >     	state.uri = &uri;
> >     	if (uriParseUriA(&state, argv[1]) != URI_SUCCESS) {
> >     		/* Failure */
> >     		uriFreeUriMembersA(&uri);
> >     		return 1;
> >     	}
> >     
> >     #define P(s, c, k) do { \
> >     	if (c && k.first) { printf(s " = \"%.*s\"\n", \
> >     		(int)(k.afterLast - k.first), k.first); \
> >     	} else { printf(s " = null\n"); } } while(0)
> >     
> >     	P("scheme", 1, uri.scheme);
> >     	P("host", 1, uri.hostText);
> >     	P("path", uri.pathHead, uri.pathHead->text);
> >     
> >     	uriFreeUriMembersA(&uri);
> >     	return 0;
> >     }
> >     
> >     
> >     
> >     src/uriparser-git$ gcc 1.c src/*.c -I`pwd`/include -w
> >     
> >     src/uriparser-git$ ./a.out "http://test"
> >     scheme = "http"
> >     host = "test"
> >     path = null
> >     src/uriparser-git$ ./a.out "http://test/"
> >     scheme = "http"
> >     host = "test"
> >     path = ""
> >     src/uriparser-git$ ./a.out "http://test/X"
> >     scheme = "http"
> >     host = "test"
> >     path = "X"
> >     uriparser-git$ ./a.out "http://test?1"
> >     scheme = "http"
> >     host = "test"
> >     path = null
> >     uriparser-git$ ./a.out "http://test/?1"
> >     scheme = "http"
> >     host = "test"
> >     path = ""
> >     
> >     
> >     Is something wrong with your path_size calculations above?
> >     
> >     The "X" is indeed used as a placeholder for certain (missing?) items:
> >     
> >     src/UriCommon.c:/*extern*/ const URI_CHAR * const URI_FUNC(SafeToPointTo) = _UT("X");
> >     
> >

yes there was something wrong with my calculations.  I can actually just use the pathTail pointer instead of searching for the '?'.  Doing it that way should give me the correct values.


- Kevin


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


On May 30, 2014, 12:36 p.m., Kevin Harwell wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3541/
> -----------------------------------------------------------
> 
> (Updated May 30, 2014, 12:36 p.m.)
> 
> 
> Review request for Asterisk Developers and Joshua Colp.
> 
> 
> Bugs: ASTERISK-23742
>     https://issues.asterisk.org/jira/browse/ASTERISK-23742
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Add client websocket capabilities to Asterisk.
> 
> 
> Diffs
> -----
> 
>   trunk/tests/test_websocket_client.c PRE-CREATION 
>   trunk/tests/test_uri.c PRE-CREATION 
>   trunk/res/res_http_websocket.exports.in 414813 
>   trunk/res/res_http_websocket.c 414813 
>   trunk/main/uri.c PRE-CREATION 
>   trunk/main/http.c 414813 
>   trunk/include/asterisk/uri.h PRE-CREATION 
>   trunk/include/asterisk/http_websocket.h 414813 
>   trunk/include/asterisk/http.h 414813 
> 
> Diff: https://reviewboard.asterisk.org/r/3541/diff/
> 
> 
> Testing
> -------
> 
> Created some unit tests.
> 
> 
> Thanks,
> 
> Kevin Harwell
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140602/98c990ac/attachment.html>


More information about the asterisk-dev mailing list