serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1701864 - in /serf/branches/get-remaining: ./ buckets/ test/
Date Tue, 08 Sep 2015 19:57:09 GMT
Author: rhuijben
Date: Tue Sep  8 19:57:09 2015
New Revision: 1701864

URL: http://svn.apache.org/r1701864
Log:
On the get-remaining branch: Add a default get_remaining implementation
to avoid triggering a segfault when somebody tries to call this function
on a bucket that doesn't support this feature.

Add ### TODO on several callbacks that have the same problem,
caused by just being a #define to NULL.

* buckets/buckets.c
  (serf_default_get_remaining): New function.
  
* buckets/chunk_buckets.c
  (serf_bucket_type_chunk):
* buckets/copy_buckets.c
  (serf_bucket_type_copy):
* buckets/dechunk_buckets.c
  (serf_bucket_type_dechunk):
* buckets/deflate_buckets.c
  (serf_bucket_type_deflate):
* buckets/request_buckets.c
  (serf_bucket_type_request):
* buckets/response_body_buckets.c
  (serf_bucket_type_response_body):
* buckets/response_buckets.c
  (serf_bucket_type_response):
* buckets/socket_buckets.c
  (serf_bucket_type_socket):
* buckets/ssl_buckets.c
  (serf_bucket_type_ssl_encrypt,
   serf_bucket_type_ssl_decrypt):
     Set default get_remaining handler.
   
* serf_bucket_util.h
  (serf_default_get_remaining): New function.

* test/mock_sock_buckets.c
  (serf_bucket_type_mock_socket): Set get_remaining handler.

Modified:
    serf/branches/get-remaining/buckets/buckets.c
    serf/branches/get-remaining/buckets/chunk_buckets.c
    serf/branches/get-remaining/buckets/copy_buckets.c
    serf/branches/get-remaining/buckets/dechunk_buckets.c
    serf/branches/get-remaining/buckets/deflate_buckets.c
    serf/branches/get-remaining/buckets/request_buckets.c
    serf/branches/get-remaining/buckets/response_body_buckets.c
    serf/branches/get-remaining/buckets/response_buckets.c
    serf/branches/get-remaining/buckets/socket_buckets.c
    serf/branches/get-remaining/buckets/ssl_buckets.c
    serf/branches/get-remaining/serf_bucket_util.h
    serf/branches/get-remaining/test/mock_sock_buckets.c

Modified: serf/branches/get-remaining/buckets/buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/buckets.c (original)
+++ serf/branches/get-remaining/buckets/buckets.c Tue Sep  8 19:57:09 2015
@@ -129,6 +129,10 @@ void serf_default_destroy_and_data(serf_
     serf_default_destroy(bucket);
 }
 
+apr_uint64_t *serf_default_get_remaining(serf_bucket_t *bucket)
+{
+    return SERF_LENGTH_UNKNOWN;
+}
 
 serf_bucket_t * serf_buckets_are_v2(serf_bucket_t *bucket,
                                     const serf_bucket_type_t *type)

Modified: serf/branches/get-remaining/buckets/chunk_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/chunk_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/chunk_buckets.c (original)
+++ serf/branches/get-remaining/buckets/chunk_buckets.c Tue Sep  8 19:57:09 2015
@@ -255,6 +255,6 @@ const serf_bucket_type_t serf_bucket_typ
     serf_chunk_peek,
     serf_chunk_destroy,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_chunk_set_config,
 };

Modified: serf/branches/get-remaining/buckets/copy_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/copy_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/copy_buckets.c (original)
+++ serf/branches/get-remaining/buckets/copy_buckets.c Tue Sep  8 19:57:09 2015
@@ -198,6 +198,6 @@ const serf_bucket_type_t serf_bucket_typ
     serf_copy_peek,
     serf_copy_destroy,
     serf_copy_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_copy_set_config,
 };

Modified: serf/branches/get-remaining/buckets/dechunk_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/dechunk_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/dechunk_buckets.c (original)
+++ serf/branches/get-remaining/buckets/dechunk_buckets.c Tue Sep  8 19:57:09 2015
@@ -205,13 +205,13 @@ static apr_status_t serf_dechunk_set_con
 const serf_bucket_type_t serf_bucket_type_dechunk = {
     "DECHUNK",
     serf_dechunk_read,
-    serf_dechunk_readline,
+    serf_dechunk_readline /* ### TODO */,
     serf_default_read_iovec,
     serf_default_read_for_sendfile,
     serf_buckets_are_v2,
-    serf_dechunk_peek,
+    serf_dechunk_peek /* ### TODO */,
     serf_dechunk_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_dechunk_set_config,
 };

Modified: serf/branches/get-remaining/buckets/deflate_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/deflate_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/deflate_buckets.c (original)
+++ serf/branches/get-remaining/buckets/deflate_buckets.c Tue Sep  8 19:57:09 2015
@@ -451,13 +451,13 @@ static apr_status_t serf_deflate_set_con
 const serf_bucket_type_t serf_bucket_type_deflate = {
     "DEFLATE",
     serf_deflate_read,
-    serf_deflate_readline,
+    serf_deflate_readline /* ### TODO */,
     serf_default_read_iovec,
     serf_default_read_for_sendfile,
     serf_buckets_are_v2,
-    serf_deflate_peek,
+    serf_deflate_peek /* ### TODO */,
     serf_deflate_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_deflate_set_config,
 };

Modified: serf/branches/get-remaining/buckets/request_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/request_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/request_buckets.c (original)
+++ serf/branches/get-remaining/buckets/request_buckets.c Tue Sep  8 19:57:09 2015
@@ -245,7 +245,7 @@ const serf_bucket_type_t serf_bucket_typ
     serf_request_peek,
     serf_request_destroy,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_request_set_config,
 };
 

Modified: serf/branches/get-remaining/buckets/response_body_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/response_body_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/response_body_buckets.c (original)
+++ serf/branches/get-remaining/buckets/response_body_buckets.c Tue Sep  8 19:57:09 2015
@@ -149,6 +149,6 @@ const serf_bucket_type_t serf_bucket_typ
     serf_response_body_peek,
     serf_response_body_destroy,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_response_body_set_config,
 };

Modified: serf/branches/get-remaining/buckets/response_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/response_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/response_buckets.c (original)
+++ serf/branches/get-remaining/buckets/response_buckets.c Tue Sep  8 19:57:09 2015
@@ -542,9 +542,9 @@ const serf_bucket_type_t serf_bucket_typ
     serf_default_read_iovec,
     serf_default_read_for_sendfile,
     serf_buckets_are_v2,
-    serf_response_peek,
+    serf_response_peek /* ### TODO */,
     serf_response_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_response_set_config,
 };

Modified: serf/branches/get-remaining/buckets/socket_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/socket_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/socket_buckets.c (original)
+++ serf/branches/get-remaining/buckets/socket_buckets.c Tue Sep  8 19:57:09 2015
@@ -119,6 +119,6 @@ const serf_bucket_type_t serf_bucket_typ
     serf_socket_peek,
     serf_default_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_default_ignore_config,
 };

Modified: serf/branches/get-remaining/buckets/ssl_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/buckets/ssl_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/buckets/ssl_buckets.c (original)
+++ serf/branches/get-remaining/buckets/ssl_buckets.c Tue Sep  8 19:57:09 2015
@@ -2161,7 +2161,7 @@ const serf_bucket_type_t serf_bucket_typ
     serf_ssl_peek,
     serf_ssl_encrypt_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_ssl_set_config,
 };
 
@@ -2175,6 +2175,6 @@ const serf_bucket_type_t serf_bucket_typ
     serf_ssl_peek,
     serf_ssl_decrypt_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_ssl_set_config,
 };

Modified: serf/branches/get-remaining/serf_bucket_util.h
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/serf_bucket_util.h?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/serf_bucket_util.h (original)
+++ serf/branches/get-remaining/serf_bucket_util.h Tue Sep  8 19:57:09 2015
@@ -103,6 +103,14 @@ void serf_default_destroy_and_data(
     serf_bucket_t *bucket);
 
 /**
+ * Default implementation of the @see get_remaining functionality.
+ *
+ * This function will just return SERF_LENGTH_UNKNOWN.
+ */
+apr_uint64_t *serf_default_get_remaining(
+    serf_bucket_t *bucket);
+
+/**
  * Default implementation of the @see set_config functionality.
  *
  * This function will not do anything, it should be used in buckets

Modified: serf/branches/get-remaining/test/mock_sock_buckets.c
URL: http://svn.apache.org/viewvc/serf/branches/get-remaining/test/mock_sock_buckets.c?rev=1701864&r1=1701863&r2=1701864&view=diff
==============================================================================
--- serf/branches/get-remaining/test/mock_sock_buckets.c (original)
+++ serf/branches/get-remaining/test/mock_sock_buckets.c Tue Sep  8 19:57:09 2015
@@ -95,6 +95,6 @@ const serf_bucket_type_t serf_bucket_typ
     serf_mock_sock_peek,
     serf_default_destroy_and_data,
     serf_default_read_bucket,
-    NULL,
+    serf_default_get_remaining,
     serf_mock_sock_set_config,
 };



Mime
View raw message