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

List:       privoxy-commits
Subject:    [privoxy-commits] current parsers.c,1.247,1.248
From:       Fabian Keil <fabiankeil () users ! sourceforge ! net>
Date:       2012-09-04 8:32:34
Message-ID: E1T8oYm-0005or-3P () sfs-ml-3 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory vz-cvs-4.sog:/tmp/cvs-serv32466

Modified Files:
	parsers.c 
Log Message:
Let get_content_length() use a header value as input instead of the whole header

This makes it easier to use it in combination with get_header_value().


Index: parsers.c
===================================================================
RCS file: /cvsroot/ijbswa/current/parsers.c,v
retrieving revision 1.247
retrieving revision 1.248
diff -C2 -d -r1.247 -r1.248
*** parsers.c	27 Jul 2012 17:36:06 -0000	1.247
--- parsers.c	4 Sep 2012 08:32:32 -0000	1.248
***************
*** 1801,1805 ****
   *
   * Parameters  :
!  *          1  :  header = The Content-Length header.
   *          2  :  length = Storage to return the value.
   *
--- 1801,1805 ----
   *
   * Parameters  :
!  *          1  :  header_value = The Content-Length header value.
   *          2  :  length = Storage to return the value.
   *
***************
*** 1808,1820 ****
   *
   *********************************************************************/
! static jb_err get_content_length(const char *header, unsigned long long *length)
  {
-    assert(header[14] == ':');
- 
  #ifdef _WIN32
     assert(sizeof(unsigned long long) > 4);
!    if (1 != sscanf(header+14, ": %I64u", length))
  #else
!    if (1 != sscanf(header+14, ": %llu", length))
  #endif
     {
--- 1808,1818 ----
   *
   *********************************************************************/
! static jb_err get_content_length(const char *header_value, unsigned long long *length)
  {
  #ifdef _WIN32
     assert(sizeof(unsigned long long) > 4);
!    if (1 != sscanf(header_value, "%I64u", length))
  #else
!    if (1 != sscanf(header_value, "%llu", length))
  #endif
     {
***************
*** 1846,1853 ****
  {
     unsigned long long content_length = 0;
  
     assert(*(*header+14) == ':');
  
!    if (JB_ERR_OK != get_content_length(*header, &content_length))
     {
        log_error(LOG_LEVEL_ERROR, "Crunching invalid header: %s", *header);
--- 1844,1853 ----
  {
     unsigned long long content_length = 0;
+    const char *header_value;
  
     assert(*(*header+14) == ':');
  
!    header_value = *header + 15;
!    if (JB_ERR_OK != get_content_length(header_value, &content_length))
     {
        log_error(LOG_LEVEL_ERROR, "Crunching invalid header: %s", *header);
***************
*** 2379,2386 ****
  {
     unsigned long long content_length = 0;
  
     assert(*(*header+14) == ':');
  
!    if (JB_ERR_OK != get_content_length(*header, &content_length))
     {
        log_error(LOG_LEVEL_ERROR, "Crunching invalid header: %s", *header);
--- 2379,2388 ----
  {
     unsigned long long content_length = 0;
+    const char *header_value;
  
     assert(*(*header+14) == ':');
  
!    header_value = *header + 15;
!    if (JB_ERR_OK != get_content_length(header_value, &content_length))
     {
        log_error(LOG_LEVEL_ERROR, "Crunching invalid header: %s", *header);


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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