Skip to content

Commit

Permalink
add:添加http method支持限制
Browse files Browse the repository at this point in the history
  • Loading branch information
Dozingfiretruck committed Jan 23, 2024
1 parent 6007626 commit 1313b92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/network/libhttp/luat_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,10 @@ int luat_http_client_start(luat_http_ctrl_t *http_ctrl, const char *url, uint8_t
#ifdef __LUATOS__
int http_set_url(luat_http_ctrl_t *http_ctrl, const char* url, const char* method) {
const char *tmp = url;
if (strcmp("POST", method) != 0 && strcmp("GET", method) != 0 && strcmp("PUT", method) != 0){
LLOGE("NOT SUPPORT %s",method);
return -1;
}
if (!strncmp("https://", url, strlen("https://"))) {
http_ctrl->is_tls = 1;
tmp += strlen("https://");
Expand Down
1 change: 0 additions & 1 deletion components/network/libhttp/luat_lib_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ static int l_http_request(lua_State *L) {
http_ctrl->is_post = 1;
}


const char *url = luaL_checklstring(L, 2, &len);
// http_ctrl->url = luat_heap_malloc(len + 1);
// memset(http_ctrl->url, 0, len + 1);
Expand Down

0 comments on commit 1313b92

Please sign in to comment.