@@ -44,7 +44,7 @@ binary_raw_response_handler(const void *cookie, protocol_binary_request_header *
44
44
protocol_binary_response_header * response ) {
45
45
memcached_protocol_client_st * client = (void * ) cookie ;
46
46
47
- if (client -> root -> pedantic
47
+ if (response && client -> root -> pedantic
48
48
&& !memcached_binary_protocol_pedantic_check_response (request , response )) {
49
49
return PROTOCOL_BINARY_RESPONSE_EINVAL ;
50
50
}
@@ -53,6 +53,10 @@ binary_raw_response_handler(const void *cookie, protocol_binary_request_header *
53
53
return PROTOCOL_BINARY_RESPONSE_EINTERNAL ;
54
54
}
55
55
56
+ if (!response ) {
57
+ return PROTOCOL_BINARY_RESPONSE_SUCCESS ;
58
+ }
59
+
56
60
size_t len = sizeof (protocol_binary_response_header ) + htonl (response -> response .bodylen );
57
61
size_t offset = 0 ;
58
62
char * ptr = (void * ) response ;
@@ -917,6 +921,20 @@ stat_command_handler(const void *cookie, protocol_binary_request_header *header,
917
921
918
922
rval = client -> root -> callback -> interface .v1 .stat (cookie , (void * ) (header + 1 ), keylen ,
919
923
stat_response_handler );
924
+ if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS ) {
925
+ /* END message */
926
+ protocol_binary_response_no_extras response = {
927
+ .message = {
928
+ .header .response =
929
+ {
930
+ .magic = PROTOCOL_BINARY_RES ,
931
+ .opcode = PROTOCOL_BINARY_CMD_STAT ,
932
+ .status = htons (PROTOCOL_BINARY_RESPONSE_SUCCESS ),
933
+ .opaque = header -> request .opaque ,
934
+ },
935
+ }};
936
+ rval = response_handler (cookie , header , & response );
937
+ }
920
938
} else {
921
939
rval = PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND ;
922
940
}
@@ -941,6 +959,9 @@ version_command_handler(const void *cookie, protocol_binary_request_header *head
941
959
memcached_protocol_client_st * client = (void * ) cookie ;
942
960
if (client -> root -> callback -> interface .v1 .version ) {
943
961
rval = client -> root -> callback -> interface .v1 .version (cookie , version_response_handler );
962
+ if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS ) {
963
+ rval = response_handler (cookie , header , NULL );
964
+ }
944
965
} else {
945
966
rval = PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND ;
946
967
}
0 commit comments