Skip to content

Commit a46599d

Browse files
committed
Merge branch 'npc1054657282/feat/patch-bolt'
2 parents e3f4ed9 + cca4e1b commit a46599d

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

lib/src/client_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ const struct neo4j_plan_table_colors *neo4j_plan_table_ansi_colors =
7676
&_neo4j_plan_table_ansi_colors;
7777

7878
static version_spec_t neo4j_supported_versions[4] = {
79-
{5, 0, 0}, {4, 0, 0}, {3, 0, 0}, {1, 0, 0}
79+
{5, 0, 0}, {4, 4, 0}, {3, 0, 0}, {1, 0, 0}
8080
};
8181

82-
static const char neo4j_supported_versions_string[] = "5.0,4.0,3.0,1.0";
82+
static const char neo4j_supported_versions_string[] = "5.0,4.4,3.0,1.0";
8383

8484
static ssize_t default_password_callback(void *userdata, char *buf, size_t n);
8585

lib/src/connection.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ neo4j_connection_t *establish_connection(const char *hostname,
319319

320320
neo4j_log_info(logger, "connected (%p) to %s:%u%s", (void *)connection,
321321
hostname, port, connection->insecure? " (insecure)" : "");
322-
neo4j_log_debug(logger, "connection %p using protocol version %d",
323-
(void *)connection, protocol_version);
322+
neo4j_log_debug(logger, "connection %p using protocol version %d.%d",
323+
(void *)connection, protocol_version, protocol_minor_version);
324324
neo4j_atomic_bool_set(&(connection->poison_tx),false);
325325
return connection;
326326

@@ -457,8 +457,8 @@ int negotiate_protocol_version(neo4j_iostream_t *iostream,
457457
return -1;
458458
}
459459
agreed_version = ntohl(agreed_version);
460-
*protocol_version = agreed_version & 0007;
461-
*protocol_minor_version = (agreed_version & 0700) >> 8;
460+
*protocol_version = agreed_version & 0x0007;
461+
*protocol_minor_version = (agreed_version & 0x0700) >> 8;
462462
return 0;
463463
}
464464

@@ -1232,6 +1232,19 @@ int initialize(neo4j_connection_t *connection)
12321232
req->argv = req->_argv;
12331233
req->argc = 2;
12341234
}
1235+
else if (connection->version == 4 && connection->minor_version == 4)
1236+
{
1237+
neo4j_value_t patch_bolt[1] = {neo4j_string("utc")};
1238+
neo4j_map_entry_t auth_token[5] =
1239+
{ neo4j_map_entry("user_agent", neo4j_string(config->client_id)),
1240+
neo4j_map_entry("scheme", neo4j_string("basic")),
1241+
neo4j_map_entry("principal", neo4j_string(config->username)),
1242+
neo4j_map_entry("credentials", neo4j_string(config->password)),
1243+
neo4j_map_entry("patch_bolt", neo4j_list(patch_bolt, 1)) };
1244+
req->_argv[0] = neo4j_map(auth_token, 5);
1245+
req->argv = req->_argv;
1246+
req->argc = 1;
1247+
}
12351248
else
12361249
{
12371250
neo4j_map_entry_t auth_token[4] =

lib/test/check_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ START_TEST (test_neo4j_config_set_supported_versions)
3333
neo4j_config_t *config = neo4j_new_config();
3434
ck_assert(config->supported_versions != NULL);
3535
ck_assert_str_eq
36-
(neo4j_config_get_supported_versions(config), "5.0 4.0 3.0 1.0 "); // default
36+
(neo4j_config_get_supported_versions(config), "5.0 4.4 3.0 1.0 "); // default
3737
ck_assert_int_eq
3838
(neo4j_config_set_supported_versions(config, "5.4"),0);
3939
ck_assert_int_eq
@@ -73,7 +73,7 @@ START_TEST (test_neo4j_config_set_supported_versions)
7373
ck_assert_int_eq
7474
(neo4j_config_set_supported_versions(config, "5.4,4.3-4,3,crap"),-1);
7575
ck_assert_str_eq
76-
(neo4j_config_get_supported_versions(config), "5.0 4.0 3.0 1.0 "); // default
76+
(neo4j_config_get_supported_versions(config), "5.0 4.4 3.0 1.0 "); // default
7777

7878

7979

lib/test/check_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct received_response
3030

3131

3232
#define EXPECTED_VERSIONS_DEFAULT \
33-
{ htonl(0x000005), htonl(0x000004), htonl(0x000003), htonl(0x000001) }
33+
{ htonl(0x000005), htonl(0x000404), htonl(0x000003), htonl(0x000001) }
3434

3535
#define STUB_FAILURE_CODE -99
3636

0 commit comments

Comments
 (0)