|
1 | 1 | //silver_chain_scope_start |
2 | | -//mannaged by silver chain: https://github.com/OUIsolutions/SilverChain |
| 2 | +//DONT MODIFY THIS COMMENT |
| 3 | +//this import is computationally generated |
| 4 | +//mannaged by SilverChain: https://github.com/OUIsolutions/SilverChain |
3 | 5 | #include "../imports/imports.fdeclare.h" |
4 | 6 | //silver_chain_scope_end |
5 | 7 |
|
@@ -39,7 +41,27 @@ LuaCEmbedResponse *private_lua_bear_fetch(LuaCEmbed *args){ |
39 | 41 | } |
40 | 42 | BearHttpsRequest_set_method(request, metod); |
41 | 43 | } |
42 | | - |
| 44 | + |
| 45 | + |
| 46 | + int http_version = LuaCEmbedTable_get_type_prop(entrie_table, "http_version"); |
| 47 | + if(http_version != LUA_CEMBED_NIL){ |
| 48 | + char *http_version_str = LuaCembedTable_get_string_prop(entrie_table, "http_version"); |
| 49 | + if(LuaCEmbed_has_errors(args)){ |
| 50 | + BearHttpsRequest_free(request); |
| 51 | + return LuaCEmbed_send_error(LuaCEmbed_get_error_message(args)); |
| 52 | + } |
| 53 | + if(strcmp(http_version_str, "1.0") == 0){ |
| 54 | + BearHttpsRequest_set_http_protocol(request, BEARSSL_HTTPS_HTTP1_0); |
| 55 | + } |
| 56 | + else if(strcmp(http_version_str, "1.1") == 0){ |
| 57 | + BearHttpsRequest_set_http_protocol(request, BEARSSL_HTTPS_HTTP1_1); |
| 58 | + } |
| 59 | + else{ |
| 60 | + BearHttpsRequest_free(request); |
| 61 | + return LuaCEmbed_send_error("Invalid http version provided"); |
| 62 | + } |
| 63 | + |
| 64 | + } |
43 | 65 | bool content_type_setted = false; |
44 | 66 | int body_type =LuaCEmbedTable_get_type_prop(entrie_table, "body"); |
45 | 67 |
|
|
0 commit comments