summaryrefslogtreecommitdiff
path: root/src/http_decoder_utils.cpp
diff options
context:
space:
mode:
authorlijia <[email protected]>2024-06-18 16:45:35 +0800
committerlijia <[email protected]>2024-06-20 18:51:47 +0800
commit05e8c9db6912dc95de9691e9b90e549a4c3beffe (patch)
treeed5d4b3392bdd577986d26ac8d5c6da21f9c2b2a /src/http_decoder_utils.cpp
parent7d6170a23027aff0ebf2e7832dc11e4bbdce57ea (diff)
feat: TSG-20446, support http tunnel with CONNECT method.
Diffstat (limited to 'src/http_decoder_utils.cpp')
-rw-r--r--src/http_decoder_utils.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/http_decoder_utils.cpp b/src/http_decoder_utils.cpp
index 5686e2d..6d71bdb 100644
--- a/src/http_decoder_utils.cpp
+++ b/src/http_decoder_utils.cpp
@@ -12,6 +12,17 @@ char *safe_dup(const char *str, size_t len)
return dup;
}
+int strncasecmp_safe(const char *fix_s1, const char *dyn_s2, size_t fix_n1, size_t dyn_n2)
+{
+ if (fix_s1 == NULL || dyn_s2 == NULL) {
+ return -1;
+ }
+ if(fix_n1 != dyn_n2){
+ return -1;
+ }
+ return strncasecmp(fix_s1, dyn_s2, fix_n1);
+}
+
const char *http_message_type_to_string(enum http_message_type type)
{
const char *sname = "unknown_msg_type";
@@ -134,4 +145,13 @@ int http_event_is_req(enum http_event event)
break;
}
return -1;
+}
+
+int stellar_session_mq_get_topic_id_reliable(struct stellar *st, const char *topic_name, session_msg_free_cb_func *msg_free_cb, void *msg_free_arg)
+{
+ int topic_id = stellar_session_mq_get_topic_id(st, topic_name);
+ if(topic_id < 0){
+ topic_id = stellar_session_mq_create_topic(st, topic_name, msg_free_cb, msg_free_arg);
+ }
+ return topic_id;
} \ No newline at end of file