libblade_la_SOURCES += src/blade_mastermgr.c src/blade_connectionmgr.c src/blade_sessionmgr.c src/blade_restmgr.c
libblade_la_SOURCES += src/blade_identity.c src/blade_rpc.c src/blade_connection.c src/blade_session.c
libblade_la_SOURCES += src/blade_protocol.c src/blade_subscription.c src/blade_channel.c
-libblade_la_SOURCES += src/blade_transport.c src/blade_transport_wss.c
+libblade_la_SOURCES += src/blade_transport.c src/blade_transport_wss.c src/blade_web.c
libblade_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(PCRE_CFLAGS)
libblade_la_LDFLAGS = -version-info 0:1:0 -lncurses -lpthread -lm -lconfig -lcivetweb $(AM_LDFLAGS)
library_include_HEADERS += src/include/blade_mastermgr.h src/include/blade_connectionmgr.h src/include/blade_sessionmgr.h src/include/blade_restmgr.h
library_include_HEADERS += src/include/blade_identity.h src/include/blade_rpc.h src/include/blade_connection.h src/include/blade_session.h
library_include_HEADERS += src/include/blade_protocol.h src/include/blade_subscription.h src/include/blade_channel.h
-library_include_HEADERS += src/include/blade_transport.h src/include/blade_transport_wss.h
+library_include_HEADERS += src/include/blade_transport.h src/include/blade_transport_wss.h src/include/blade_web.h
library_include_HEADERS += src/include/unqlite.h test/tap.h
BUILT_SOURCES=$(CIVETWEB_LIB) $(LIBKS)
ks_status_t ret = KS_STATUS_SUCCESS;
ks_pool_t *pool = NULL;
blade_webrequest_t *bwreq = NULL;
- struct mg_request_info *info = NULL;
+ const struct mg_request_info *info = NULL;
char buf[1024];
int bytes = 0;
}
for (int index = 0; index < info->num_headers; ++index) {
- struct mg_header *header = &info->http_headers[index];
+ const struct mg_header *header = &info->http_headers[index];
ks_hash_insert(bwreq->headers, (void *)ks_pstrdup(pool, header->name), (void *)ks_pstrdup(pool, header->value));
}
ks_assert(value);
ks_hash_insert(bwreq->headers, (void *)ks_pstrdup(ks_pool_get(bwreq), header), (void *)ks_pstrdup(ks_pool_get(bwreq), value));
-
+
return KS_STATUS_SUCCESS;
}
// @todo make sure key and value are URL encoded
mg_url_encode(key, buf, sizeof(buf));
ks_sb_printf(pathAndQuery, "%c%s=", firstQuery ? '?' : '&', buf);
-
+
mg_url_encode(value, buf, sizeof(buf));
ks_sb_append(pathAndQuery, buf);
char *auth = NULL;
char encoded[1024];
ks_pool_t *pool = NULL;
- char *tok = NULL;
+ const char *tok = NULL;
ks_assert(host);
ks_assert(path);
cJSON_Delete(json);
if ((ret = blade_webrequest_send(bwreq, secure, host, port, &bwres)) != KS_STATUS_SUCCESS) goto done;
-
+
if ((ret = blade_webresponse_content_json_get(bwres, &json)) != KS_STATUS_SUCCESS) goto done;
if ((tok = cJSON_GetObjectCstr(json, "access_token")) == NULL) {
char *auth = NULL;
char encoded[1024];
ks_pool_t *pool = NULL;
- char *tok = NULL;
+ const char *tok = NULL;
ks_assert(host);
ks_assert(path);
bwres->status_code = ks_pstrdup(pool, status);
bwres->status_message = ks_pstrdup(pool, mg_get_response_code_text(NULL, atoi(status)));
-
+
ks_hash_create(&bwres->headers, KS_HASH_MODE_CASE_INSENSITIVE, KS_HASH_FLAG_NOLOCK | KS_HASH_FLAG_DUP_CHECK | KS_HASH_FLAG_FREE_KEY | KS_HASH_FLAG_FREE_VALUE, pool);
ks_assert(bwres->headers);
ks_status_t ret = KS_STATUS_SUCCESS;
ks_pool_t *pool = NULL;
blade_webresponse_t *bwres = NULL;
- struct mg_request_info *info = NULL;
+ const struct mg_request_info *info = NULL;
char buf[1024];
int bytes = 0;
ks_pool_set_cleanup(bwres, NULL, blade_webresponse_cleanup);
for (int index = 0; index < info->num_headers; ++index) {
- struct mg_header *header = &info->http_headers[index];
+ const struct mg_header *header = &info->http_headers[index];
ks_hash_insert(bwres->headers, (void *)ks_pstrdup(pool, header->name), (void *)ks_pstrdup(pool, header->value));
}