{"id":20572921,"url":"https://github.com/zlgopen/awtk-http-client","last_synced_at":"2025-03-06T10:23:24.926Z","repository":{"id":55826234,"uuid":"245905754","full_name":"zlgopen/awtk-http-client","owner":"zlgopen","description":"http client for awtk","archived":false,"fork":false,"pushed_at":"2021-09-14T00:59:41.000Z","size":20562,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T21:17:37.261Z","etag":null,"topics":["awtk","http","https"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zlgopen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-08T23:38:11.000Z","updated_at":"2021-09-14T00:59:49.000Z","dependencies_parsed_at":"2022-08-15T07:31:03.995Z","dependency_job_id":null,"html_url":"https://github.com/zlgopen/awtk-http-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-http-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-http-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-http-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-http-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zlgopen","download_url":"https://codeload.github.com/zlgopen/awtk-http-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242188754,"owners_count":20086430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["awtk","http","https"],"created_at":"2024-11-16T05:24:35.618Z","updated_at":"2025-03-06T10:23:24.903Z","avatar_url":"https://github.com/zlgopen.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# awtk-http-client\n\n### 1. 编译：\n\n1. 获取 awtk 并编译\n\n```\ngit clone https://github.com/zlgopen/awtk.git\ncd awtk; scons; cd -\n```\n\n2. 获取 awtk-http-client 并编译\n```\ngit clone https://github.com/zlgopen/awtk-http-client.git\ncd awtk-http-client\n```\n\n* 生成资源\n\n```\npython ./scripts/update_res.py all\n```\n\n\u003e 或者通过 designer 生成资源\n\n\n* 编译PC版本\n\n```\nscons\n```\n\n* 编译LINUX FB版本\n\n```\nscons LINUX_FB=true\n```\n\n\u003e 完整编译选项请参考[编译选项](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/build_options.md)\n\n### 2. 运行 Demo：\n\n* HTTP 请求的 demo\n\n```\n./bin/demo_http\n```\n\n### 3. 基本用法\n\n目前实现了 GET/POST/DELETE/PUT 四种方法，可以满足常见的 REST API 调用。但不适合大文件传输和同时大量并发请求。\n\n**接受事件的回调函数的原型：**\n\n```\ntypedef ret_t (*http_request_on_event_t)(void* ctx, http_request_t* request, http_response_t* resp);\n```\n\n**发起请求的函数：**\n\n```\nret_t http_request(http_request_t* request);\n```\n\n如：\n\n```c\n  request = http_request_create_get(url, on_http_event, widget);\n  http_request(request);\n\n```\n\n以下几点值得注意：\n\n* resp-\u003edone 为 TRUE 表示请求成功完成。\n* resp-\u003efail 为 TRUE 表示请求失败。\n* resp-\u003edone 或者 resp-\u003efail 为 TRUE 表示请求完成了，此时才可以释放 request 对象。\n* resp-\u003ebody 是返回的内容。\n* resp-\u003ebody_size 是返回的内容的长度。\n* resp-\u003estatus_code 是 HTTP 响应码。\n* resp-\u003eheader 是响应头。\n* 设置 request-\u003eabort 标志来取消请求，取消请求是异步。\n\n\u003e 具体用法请参考：demos/demo_http.c \n\n### 4. 支持平台\n\n* windows\n* linux\n* macos\n* android\n* ios\n* web\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzlgopen%2Fawtk-http-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzlgopen%2Fawtk-http-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzlgopen%2Fawtk-http-client/lists"}