[asterisk-commits] tilghman: branch group/manager_http_auth r188475 - in /team/group/manager_htt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 14 18:45:25 CDT 2009


Author: tilghman
Date: Tue Apr 14 18:45:22 2009
New Revision: 188475

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=188475
Log:
Address suggestions in my own code review

Modified:
    team/group/manager_http_auth/include/asterisk/http.h
    team/group/manager_http_auth/main/ast_expr2.c
    team/group/manager_http_auth/main/astobj2.c
    team/group/manager_http_auth/main/http.c

Modified: team/group/manager_http_auth/include/asterisk/http.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/manager_http_auth/include/asterisk/http.h?view=diff&rev=188475&r1=188474&r2=188475
==============================================================================
--- team/group/manager_http_auth/include/asterisk/http.h (original)
+++ team/group/manager_http_auth/include/asterisk/http.h Tue Apr 14 18:45:22 2009
@@ -64,36 +64,26 @@
 struct ast_http_uri;
 
 /*! \brief HTTP Callbacks take the socket
-
-<<<<<<< .working
-   \note The callback function get server instance, uri, http method,
-   get method variable (if present in uri) and http headers as arguments
-   and should ast_http_send() function for sending content allocated
-   with malloc() and/or content from opeened file descriptor.
-   
-   Status and status text should be put as argument in ast_http_send()
-   function to reflect the status of the request. (200 or 304, for example).
-   Content length calculated by ast_http_send() function internality. 
-
-   Static content indicated in argument passed to ast_http_send() function.
-
-\verbatim
-   All addition http response headers must be send as separate malloc'ated
-   string, and must be not existed in responce content! No addition line
-   with \r\n are required.
-=======
-   \note The method and the path as arguments and should
-   return the content, allocated with malloc().  Status should be changed to reflect
-   the status of the request if it isn't 200 and title may be set to a malloc()'d string
-   to an appropriate title for non-200 responses.  Content length may also be specified.
-\verbatim
-   The return value may include additional headers at the front and MUST include a blank
-   line with \r\n to provide separation between user headers and content (even if no
-   content is specified)
->>>>>>> .merge-right.r184448
-\endverbatim
-
-   For error responce can be used ast_http_error() function.
+ *
+ * \note The callback function receives server instance, uri, http method,
+ * get method (if present in URI), and http headers as arguments and should
+ * use the ast_http_send() function for sending content allocated with ast_str
+ * and/or content from an opened file descriptor.
+ *
+ * Status and status text should be sent as arguments to the ast_http_send()
+ * function to reflect the status of the request (200 or 304, for example).
+ * Content length is calculated by ast_http_send() automatically.
+ *
+ * Static content is indicated in the argument passed to the ast_http_send()
+ * function.
+ *
+ * \verbatim
+ * All additional http response headers must be sent as a separate ast_str
+ * object, and must not be part of the response content! No additional lines
+ * with \r\n are required.
+ * \endverbatim
+ *
+ * For an error response, the ast_http_error() function may be used.
 */
 typedef int (*ast_http_callback)(struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers);
 

Modified: team/group/manager_http_auth/main/ast_expr2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/manager_http_auth/main/ast_expr2.c?view=diff&rev=188475&r1=188474&r2=188475
==============================================================================
--- team/group/manager_http_auth/main/ast_expr2.c (original)
+++ team/group/manager_http_auth/main/ast_expr2.c Tue Apr 14 18:45:22 2009
@@ -128,7 +128,7 @@
 
 
 /* Copy the first part of user declarations.  */
-#line 1 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 1 "ast_expr2.y"
 
 /* Written by Pace Willisson (pace at blitz.com) 
  * and placed in the public domain.
@@ -486,13 +486,13 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 345 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 345 "ast_expr2.y"
 {
 	struct val *val;
 	struct expr_node *arglist;
 }
 /* Line 187 of yacc.c.  */
-#line 496 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 496 "ast_expr2.c"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -514,13 +514,13 @@
 
 
 /* Copy the second part of user declarations.  */
-#line 350 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 350 "ast_expr2.y"
 
 extern int		ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
 
 
 /* Line 216 of yacc.c.  */
-#line 524 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 524 "ast_expr2.c"
 
 #ifdef short
 # undef short
@@ -1473,119 +1473,119 @@
   switch (yytype)
     {
       case 4: /* "TOK_COLONCOLON" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1479 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1479 "ast_expr2.c"
 	break;
       case 5: /* "TOK_COND" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1484 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1484 "ast_expr2.c"
 	break;
       case 6: /* "TOK_OR" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1489 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1489 "ast_expr2.c"
 	break;
       case 7: /* "TOK_AND" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1494 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1494 "ast_expr2.c"
 	break;
       case 8: /* "TOK_NE" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1499 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1499 "ast_expr2.c"
 	break;
       case 9: /* "TOK_LE" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1504 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1504 "ast_expr2.c"
 	break;
       case 10: /* "TOK_GE" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1509 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1509 "ast_expr2.c"
 	break;
       case 11: /* "TOK_LT" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1514 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1514 "ast_expr2.c"
 	break;
       case 12: /* "TOK_GT" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1519 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1519 "ast_expr2.c"
 	break;
       case 13: /* "TOK_EQ" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1524 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1524 "ast_expr2.c"
 	break;
       case 14: /* "TOK_MINUS" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1529 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1529 "ast_expr2.c"
 	break;
       case 15: /* "TOK_PLUS" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1534 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1534 "ast_expr2.c"
 	break;
       case 16: /* "TOK_MOD" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1539 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1539 "ast_expr2.c"
 	break;
       case 17: /* "TOK_DIV" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1544 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1544 "ast_expr2.c"
 	break;
       case 18: /* "TOK_MULT" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1549 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1549 "ast_expr2.c"
 	break;
       case 19: /* "TOK_COMPL" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1554 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1554 "ast_expr2.c"
 	break;
       case 20: /* "TOK_TILDETILDE" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1559 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1559 "ast_expr2.c"
 	break;
       case 21: /* "TOK_EQTILDE" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1564 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1564 "ast_expr2.c"
 	break;
       case 22: /* "TOK_COLON" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1569 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1569 "ast_expr2.c"
 	break;
       case 23: /* "TOK_LP" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1574 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1574 "ast_expr2.c"
 	break;
       case 24: /* "TOK_RP" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1579 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1579 "ast_expr2.c"
 	break;
       case 25: /* "TOKEN" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1584 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1584 "ast_expr2.c"
 	break;
       case 29: /* "expr" */
-#line 368 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 368 "ast_expr2.y"
 	{  free_value((yyvaluep->val)); };
-#line 1589 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 1589 "ast_expr2.c"
 	break;
 
       default:
@@ -1908,7 +1908,7 @@
   switch (yyn)
     {
         case 2:
-#line 374 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 374 "ast_expr2.y"
     { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
               ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
               if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number )
@@ -1920,7 +1920,7 @@
     break;
 
   case 3:
-#line 382 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 382 "ast_expr2.y"
     {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
               ((struct parse_io *)parseio)->val->type = AST_EXPR_string;
 			  ((struct parse_io *)parseio)->val->u.s = strdup(""); 
@@ -1928,12 +1928,12 @@
     break;
 
   case 4:
-#line 389 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 389 "ast_expr2.y"
     { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;}
     break;
 
   case 5:
-#line 390 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 390 "ast_expr2.y"
     {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
                                  struct expr_node *t;
 								 DESTROY((yyvsp[(2) - (3)].val));
@@ -1943,7 +1943,7 @@
     break;
 
   case 6:
-#line 396 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 396 "ast_expr2.y"
     {struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
                                  struct expr_node *t;  /* NULL args should OK */
 								 DESTROY((yyvsp[(2) - (2)].val));
@@ -1953,7 +1953,7 @@
     break;
 
   case 7:
-#line 405 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 405 "ast_expr2.y"
     { (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan);
 		                            DESTROY((yyvsp[(2) - (4)].val));
 									DESTROY((yyvsp[(4) - (4)].val));
@@ -1963,12 +1963,12 @@
     break;
 
   case 8:
-#line 411 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 411 "ast_expr2.y"
     {(yyval.val) = (yyvsp[(1) - (1)].val);;}
     break;
 
   case 9:
-#line 412 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 412 "ast_expr2.y"
     { (yyval.val) = (yyvsp[(2) - (3)].val);
 	                       (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
 						   (yyloc).first_line=0; (yyloc).last_line=0;
@@ -1976,7 +1976,7 @@
     break;
 
   case 10:
-#line 416 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 416 "ast_expr2.y"
     { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
 						DESTROY((yyvsp[(2) - (3)].val));	
                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -1984,7 +1984,7 @@
     break;
 
   case 11:
-#line 420 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 420 "ast_expr2.y"
     { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -1992,7 +1992,7 @@
     break;
 
   case 12:
-#line 424 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 424 "ast_expr2.y"
     { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                     (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -2000,7 +2000,7 @@
     break;
 
   case 13:
-#line 428 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 428 "ast_expr2.y"
     { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
 						DESTROY((yyvsp[(2) - (3)].val));	
                          (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
@@ -2008,7 +2008,7 @@
     break;
 
   case 14:
-#line 432 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 432 "ast_expr2.y"
     { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                     (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2016,7 +2016,7 @@
     break;
 
   case 15:
-#line 436 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 436 "ast_expr2.y"
     { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2024,7 +2024,7 @@
     break;
 
   case 16:
-#line 440 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 440 "ast_expr2.y"
     { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2032,7 +2032,7 @@
     break;
 
   case 17:
-#line 444 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 444 "ast_expr2.y"
     { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2040,7 +2040,7 @@
     break;
 
   case 18:
-#line 448 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 448 "ast_expr2.y"
     { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                       (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2048,7 +2048,7 @@
     break;
 
   case 19:
-#line 452 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 452 "ast_expr2.y"
     { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2056,7 +2056,7 @@
     break;
 
   case 20:
-#line 456 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 456 "ast_expr2.y"
     { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); 
 						DESTROY((yyvsp[(1) - (2)].val));	
 	                        (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
@@ -2064,7 +2064,7 @@
     break;
 
   case 21:
-#line 460 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 460 "ast_expr2.y"
     { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); 
 						DESTROY((yyvsp[(1) - (2)].val));	
 	                        (yyloc).first_column = (yylsp[(1) - (2)]).first_column; (yyloc).last_column = (yylsp[(2) - (2)]).last_column; 
@@ -2072,7 +2072,7 @@
     break;
 
   case 22:
-#line 464 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 464 "ast_expr2.y"
     { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                       (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2080,7 +2080,7 @@
     break;
 
   case 23:
-#line 468 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 468 "ast_expr2.y"
     { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2088,7 +2088,7 @@
     break;
 
   case 24:
-#line 472 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 472 "ast_expr2.y"
     { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                      (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2096,7 +2096,7 @@
     break;
 
   case 25:
-#line 476 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 476 "ast_expr2.y"
     { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2104,7 +2104,7 @@
     break;
 
   case 26:
-#line 480 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 480 "ast_expr2.y"
     { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2112,7 +2112,7 @@
     break;
 
   case 27:
-#line 484 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 484 "ast_expr2.y"
     { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); 
 						DESTROY((yyvsp[(2) - (5)].val));	
 						DESTROY((yyvsp[(4) - (5)].val));	
@@ -2121,7 +2121,7 @@
     break;
 
   case 28:
-#line 489 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 489 "ast_expr2.y"
     { (yyval.val) = op_tildetilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); 
 						DESTROY((yyvsp[(2) - (3)].val));	
 	                        (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; 
@@ -2130,7 +2130,7 @@
 
 
 /* Line 1267 of yacc.c.  */
-#line 2134 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.c"
+#line 2134 "ast_expr2.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2350,7 +2350,7 @@
 }
 
 
-#line 495 "/home/tilghman/Asterisk/manager_http_auth/main/ast_expr2.y"
+#line 495 "ast_expr2.y"
 
 
 static struct expr_node *alloc_expr_node(enum node_type nt)

Modified: team/group/manager_http_auth/main/astobj2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/manager_http_auth/main/astobj2.c?view=diff&rev=188475&r1=188474&r2=188475
==============================================================================
--- team/group/manager_http_auth/main/astobj2.c (original)
+++ team/group/manager_http_auth/main/astobj2.c Tue Apr 14 18:45:22 2009
@@ -236,8 +236,6 @@
 
 	if (delta != 0) {
 		FILE *refo = fopen(REF_FILE,"a");
-		fprintf(refo, "%p %s%d   %s:%d:%s (%s)\n", user_data, (delta<0? "":"+"), delta, file, line, funcname, tag);
-		fflush(refo);
 		fprintf(refo, "%p %s%d   %s:%d:%s (%s) [@%d]\n", user_data, (delta<0? "":"+"), delta, file, line, funcname, tag, obj ? obj->priv_data.ref_counter : -1);
 		fclose(refo);
 	}

Modified: team/group/manager_http_auth/main/http.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/manager_http_auth/main/http.c?view=diff&rev=188475&r1=188474&r2=188475
==============================================================================
--- team/group/manager_http_auth/main/http.c (original)
+++ team/group/manager_http_auth/main/http.c Tue Apr 14 18:45:22 2009
@@ -187,7 +187,7 @@
 	char timebuf[80], etag[23];
 	struct ast_variable *v;
 	int not_modified = 0;
-	
+
 	if (method != AST_HTTP_GET && method != AST_HTTP_HEAD) {
 		ast_http_error(ser, 501, "Not Implemented", "Attempt to use unimplemented / unsupported method");
 		return -1;
@@ -207,7 +207,7 @@
 	if (strstr(uri, "/..")) {
 		goto out403;
 	}
-		
+
 	if ((ftype = strrchr(uri, '.'))) {
 		ftype++;
 	}
@@ -216,12 +216,12 @@
 	if (!mtype) {
 		snprintf(wkspace, sizeof(wkspace), "text/%s", ftype ? ftype : "plain");
 	}
-	
+
 	/* Cap maximum length */
 	if ((len = strlen(uri) + strlen(ast_config_AST_DATA_DIR) + strlen("/static-http/") + 5) > 1024) {
 		goto out403;
 	}
-		
+
 	path = alloca(len);
 	sprintf(path, "%s/static-http/%s", ast_config_AST_DATA_DIR, uri);
 	if (stat(path, &st)) {
@@ -230,7 +230,7 @@
 
 	if (S_ISDIR(st.st_mode)) {
 		goto out404;
-	}	
+	}
 
 	fd = open(path, O_RDONLY);
 	if (fd < 0) {
@@ -269,7 +269,8 @@
 		mtype,
 		etag,
 		timebuf);
-	
+
+	/* ast_http_send() frees http_header, so we don't need to do it before returning */
 	if (not_modified) {
 		ast_http_send(ser, method, 304, "Not Modified", http_header, NULL, 0, 1);
 	} else {
@@ -296,7 +297,7 @@
 		ast_http_error(ser, 501, "Not Implemented", "Attempt to use unimplemented / unsupported method");
 		return -1;
 	}
-	
+
 	if ( (out = ast_str_create(512)) == NULL) {
 		return -1;
 	}
@@ -341,7 +342,7 @@
 	.data = NULL,
 	.key = __FILE__,
 };
-	
+
 static struct ast_http_uri staticuri = {
 	.callback = static_callback,
 	.description = "Asterisk HTTP Static Delivery",
@@ -371,12 +372,12 @@
 	if (out) {
 		content_length += strlen(ast_str_buffer(out));
 	}
-	
+
 	if (fd) {
 		content_length += lseek(fd, 0, SEEK_END);
 		lseek(fd, 0, SEEK_SET);
 	}
-	
+
 	/* send http header */
 	fprintf(ser->f, "HTTP/1.1 %d %s\r\n"
 		"Server: Asterisk/%s\r\n"
@@ -409,14 +410,14 @@
 			}
 		}
 	}
-	
+
 	if (http_header) {
 		ast_free(http_header);
 	}
 	if (out) {
 		ast_free(out);
 	}
-	
+
 	fclose(ser->f);
 	ser->f = 0;
 	return;
@@ -427,8 +428,10 @@
 {
 	struct ast_str *http_headers = ast_str_create(128);
 	struct ast_str *out = ast_str_create(512);
-	
-	if (http_headers == NULL || out == NULL) {
+
+	if (!http_headers || !out) {
+		ast_free(http_headers);
+		ast_free(out);
 		return;
 	}
 
@@ -451,7 +454,7 @@
 		"<address>Asterisk Server</address>\r\n"
 		"</body></html>\r\n",
 		text ? text : "");
-	
+
 	ast_http_send(ser, AST_HTTP_UNKNOWN, 401, "Unauthorized", http_headers, out, 0, 0);
 	return;
 }
@@ -461,13 +464,15 @@
 {
 	struct ast_str *http_headers = ast_str_create(40);
 	struct ast_str *out = ast_str_create(256);
-	
-	if (http_headers == NULL && out == NULL) {
+
+	if (!http_headers || !out) {
+		ast_free(http_headers);
+		ast_free(out);
 		return;
 	}
 
 	ast_str_set(&http_headers, 0, "Content-type: text/html");
-	
+
 	ast_str_set(&out, 0,
 		"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
 		"<html><head>\r\n"
@@ -479,13 +484,13 @@
 		"<address>Asterisk Server</address>\r\n"
 		"</body></html>\r\n",
 			status_code, status_title, status_title, text);
-	
+
 	ast_http_send(ser, AST_HTTP_UNKNOWN, status_code, status_title, http_headers, out, 0, 0);
 	return;
 }
 
-/*! \brief 
- * Link the new uri into the list. 
+/*! \brief
+ * Link the new uri into the list.
  *
  * They are sorted by length of
  * the string, not alphabetically. Duplicate entries are not replaced,
@@ -497,7 +502,7 @@
 {
 	struct ast_http_uri *uri;
 	int len = strlen(urih->uri);
-	
+
 	AST_RWLIST_WRLOCK(&uris);
 
 	if ( AST_RWLIST_EMPTY(&uris) || strlen(AST_RWLIST_FIRST(&uris)->uri) <= len ) {
@@ -510,7 +515,7 @@
 		if (AST_RWLIST_NEXT(uri, entry) &&
 			strlen(AST_RWLIST_NEXT(uri, entry)->uri) <= len) {
 			AST_RWLIST_INSERT_AFTER(&uris, uri, urih, entry);
-			AST_RWLIST_UNLOCK(&uris); 
+			AST_RWLIST_UNLOCK(&uris);
 
 			return 0;
 		}
@@ -519,9 +524,9 @@
 	AST_RWLIST_INSERT_TAIL(&uris, urih, entry);
 
 	AST_RWLIST_UNLOCK(&uris);
-	
+
 	return 0;
-}	
+}
 
 void ast_http_uri_unlink(struct ast_http_uri *urih)
 {
@@ -557,10 +562,11 @@
 static void http_decode(char *s)
 {
 	char *t;
-	
+
 	for (t = s; *t; t++) {
-		if (*t == '+')
+		if (*t == '+') {
 			*t = ' ';
+		}
 	}
 
 	ast_uri_decode(s);
@@ -583,7 +589,7 @@
 			break;
 		}
 	}
-	
+
 	for (v = headers; v; v = v->next) {
 		if (!strcasecmp(v->name, "Content-Length")) {
 			content_length = atoi(v->value) + 1;
@@ -594,7 +600,7 @@
 	if (!content_length) {
 		return NULL;
 	}
-	
+
 	if (!(buf = alloca(content_length))) {
 		return NULL;
 	}
@@ -760,7 +766,7 @@
 
 	while ((cur = strsep(&cookies, ";"))) {
 		char *name, *val;
-		
+
 		name = val = cur;
 		strsep(&val, "=");
 
@@ -791,11 +797,11 @@
 struct ast_variable *ast_http_get_cookies(struct ast_variable *headers)
 {
 	struct ast_variable *v, *cookies=NULL;
-	
+
 	for (v = headers; v; v = v->next) {
                 if (!strncasecmp(v->name, "Cookie", 6)) {
-			if (cookies) { 
-				ast_variables_destroy(cookies); 
+			if (cookies) {
+				ast_variables_destroy(cookies);
 			}
 
 			cookies = parse_cookies((char *)v->value);
@@ -855,10 +861,7 @@
 		if (ast_strlen_zero(header_line)) {
 			break;
 		}
-	
-		/* Are ast_strdupa is needed here ? */
-		/* ast_variable_new allocate memory himself */
-		/* value = ast_strdupa(header_line); */
+
 		value = header_line;
 		name = strsep(&value, ":");
 		if (!value) {
@@ -885,7 +888,7 @@
 		ast_http_error(ser, 400, "Bad Request", "Invalid Request");
 		return NULL;
 	}
-	
+
 	handle_uri(ser, uri, http_method, headers);
 
 	/* Clean up all the header information pulled as well */




More information about the asterisk-commits mailing list