Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-server
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-server
Commits
b43dfc58
Commit
b43dfc58
authored
6 years ago
by
armatusmiles
Browse files
Options
Downloads
Patches
Plain Diff
[*] change response format in dap_enc_http to json
parent
12863e2c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
enc_server/dap_enc_http.c
+16
-1
16 additions, 1 deletion
enc_server/dap_enc_http.c
enc_server/dap_enc_http.h
+2
-2
2 additions, 2 deletions
enc_server/dap_enc_http.h
with
18 additions
and
3 deletions
enc_server/dap_enc_http.c
+
16
−
1
View file @
b43dfc58
...
...
@@ -35,6 +35,7 @@
#include
"dap_enc_base64.h"
#include
"dap_enc_msrln.h"
#include
"http_status_code.h"
#include
<json-c/json.h>
#define LOG_TAG "dap_enc_http"
...
...
@@ -46,9 +47,23 @@ int enc_http_init()
void
enc_http_deinit
()
{
}
static
void
_enc_http_write_reply
(
struct
dap_http_simple
*
cl_st
,
const
char
*
encrypt_id
,
const
char
*
encrypt_msg
)
{
struct
json_object
*
jobj
=
json_object_new_object
();
json_object_object_add
(
jobj
,
"encrypt_id"
,
json_object_new_string
(
encrypt_id
));
json_object_object_add
(
jobj
,
"encrypt_msg"
,
json_object_new_string
(
encrypt_msg
));
const
char
*
json_str
=
json_object_to_json_string
(
jobj
);
dap_http_simple_reply
(
cl_st
,
(
void
*
)
json_str
,
(
size_t
)
strlen
(
json_str
));
json_object_put
(
jobj
);
}
void
dap_enc_http_json_response_format_enable
(
bool
);
/**
* @brief enc_http_proc Enc http interface
* @param cl_st HTTP Simple client instance
...
...
@@ -89,7 +104,7 @@ void enc_http_proc(struct dap_http_simple *cl_st, void * arg)
size_t
encrypt_id_size
=
dap_enc_base64_encode
(
key_ks
->
id
,
DAP_ENC_KS_KEY_ID_SIZE
,
encrypt_id
,
DAP_ENC_DATA_TYPE_B64
);
encrypt_id
[
encrypt_id_size
]
=
'\0'
;
dap
_http_
simpl
e_reply
_f
(
cl_st
,
"%s %s"
,
encrypt_id
,
encrypt_msg
);
_enc
_http_
writ
e_reply
(
cl_st
,
encrypt_id
,
encrypt_msg
);
dap_enc_key_delete
(
msrln_key
);
...
...
This diff is collapsed.
Click to expand it.
enc_server/dap_enc_http.h
+
2
−
2
View file @
b43dfc58
...
...
@@ -62,8 +62,8 @@ typedef struct enc_http_delegate{
struct
dap_http_client
*
http
;
}
enc_http_delegate_t
;
int
enc_http_init
();
void
enc_http_deinit
();
int
enc_http_init
(
void
);
void
enc_http_deinit
(
void
);
size_t
enc_http_reply
(
enc_http_delegate_t
*
dg
,
void
*
data
,
size_t
data_size
);
size_t
enc_http_reply_f
(
enc_http_delegate_t
*
dg
,
const
char
*
data
,
...);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment