[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-commits
Subject:    [privoxy-commits] current jcc.c,1.429,1.430 parsers.c,1.290,1.291
From:       Fabian Keil <fabiankeil () users ! sourceforge ! net>
Date:       2014-07-25 11:56:56
Message-ID: E1XAe7O-0008Fn-72 () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16051

Modified Files:
	jcc.c parsers.c 
Log Message:
Let sed() failures result in an error response

While at it, make sure fatal parse errors are reported
to the caller right away.


Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.429
retrieving revision 1.430
diff -C2 -d -r1.429 -r1.430
*** jcc.c	25 Jul 2014 11:55:11 -0000	1.429
--- jcc.c	25 Jul 2014 11:56:54 -0000	1.430
***************
*** 1710,1716 ****
     if (JB_ERR_OK != err)
     {
!       /* XXX: Should be handled in sed(). */
!       assert(err == JB_ERR_PARSE);
!       log_error(LOG_LEVEL_FATAL, "Failed to parse client headers.");
     }
     csp->flags |= CSP_FLAG_CLIENT_HEADER_PARSING_DONE;
--- 1710,1719 ----
     if (JB_ERR_OK != err)
     {
!       log_error(LOG_LEVEL_ERROR, "Failed to parse client request from %s.",
!          csp->ip_addr_str);
!       log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 400 0",
!          csp->ip_addr_str, csp->http->cmd);
!       write_socket(csp->cfd, CHEADER, strlen(CHEADER));
!       return JB_ERR_PARSE;
     }
     csp->flags |= CSP_FLAG_CLIENT_HEADER_PARSING_DONE;
***************
*** 2595,2599 ****
              if (JB_ERR_OK != sed(csp, FILTER_SERVER_HEADERS))
              {
!                log_error(LOG_LEVEL_FATAL, "Failed to parse server headers.");
              }
              hdr = list_to_text(csp->headers);
--- 2598,2608 ----
              if (JB_ERR_OK != sed(csp, FILTER_SERVER_HEADERS))
              {
!                log_error(LOG_LEVEL_CLF,
!                   "%s - - [%T] \"%s\" 502 0", csp->ip_addr_str, http->cmd);
!                write_socket(csp->cfd, INVALID_SERVER_HEADERS_RESPONSE,
!                   strlen(INVALID_SERVER_HEADERS_RESPONSE));
!                free_http_request(http);
!                mark_server_socket_tainted(csp);
!                return;
              }
              hdr = list_to_text(csp->headers);

Index: parsers.c
===================================================================
RCS file: /cvsroot/ijbswa/current/parsers.c,v
retrieving revision 1.290
retrieving revision 1.291
diff -C2 -d -r1.290 -r1.291
*** parsers.c	25 Jul 2014 11:56:02 -0000	1.290
--- parsers.c	25 Jul 2014 11:56:54 -0000	1.291
***************
*** 1116,1120 ****
   *
   * Returns     :  JB_ERR_OK in case off success, or
!  *                JB_ERR_MEMORY on out-of-memory error.
   *
   *********************************************************************/
--- 1116,1121 ----
   *
   * Returns     :  JB_ERR_OK in case off success, or
!  *                JB_ERR_MEMORY on some out-of-memory errors, or
!  *                JB_ERR_PARSE in case of fatal parse errors.
   *
   *********************************************************************/
***************
*** 1142,1148 ****
     }
  
!    while ((err == JB_ERR_OK) && (v->str != NULL))
     {
!       for (p = csp->headers->first; (err == JB_ERR_OK) && (p != NULL); p = p->next)
        {
           /* Header crunch()ed in previous run? -> ignore */
--- 1143,1149 ----
     }
  
!    while (v->str != NULL)
     {
!       for (p = csp->headers->first; p != NULL; p = p->next)
        {
           /* Header crunch()ed in previous run? -> ignore */
***************
*** 1154,1157 ****
--- 1155,1162 ----
           {
              err = v->parser(csp, &(p->str));
+             if (err != JB_ERR_OK)
+             {
+                return err;
+             }
           }
        }


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic