Skip to content

Commit 54f8c03

Browse files
http_version
1 parent e6440bb commit 54f8c03

12 files changed

Lines changed: 57 additions & 13 deletions

src/json/dump/fdeclare.dump.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.types.h"
46
//silver_chain_scope_end
57

src/json/dump/fdefine.dump.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.fdeclare.h"
46
//silver_chain_scope_end
57

src/json/dump/types.keyIndexPair.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.macros.h"
46
//silver_chain_scope_end
57

src/json/extra/fdeclare.extra.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.types.h"
46
//silver_chain_scope_end
57
bool private_lua_bear_table_is_object(LuaCEmbedTable *table);

src/json/extra/fdefine.extra.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.fdeclare.h"
46
//silver_chain_scope_end
57

src/json/load/fdeclare.load.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.types.h"
46
//silver_chain_scope_end
57

src/json/load/fdefine.load.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../../imports/imports.fdeclare.h"
46
//silver_chain_scope_end
57

src/macros.ptr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "imports/imports.dependencie.h"
46
//silver_chain_scope_end
57

src/requests/fdeclare.requests.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../imports/imports.types.h"
46
//silver_chain_scope_end
57
LuaCEmbedResponse *private_lua_bear_file_stream(LuaCEmbed *args);

src/requests/fdefine.requests.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//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
35
#include "../imports/imports.fdeclare.h"
46
//silver_chain_scope_end
57

@@ -39,7 +41,27 @@ LuaCEmbedResponse *private_lua_bear_fetch(LuaCEmbed *args){
3941
}
4042
BearHttpsRequest_set_method(request, metod);
4143
}
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+
}
4365
bool content_type_setted = false;
4466
int body_type =LuaCEmbedTable_get_type_prop(entrie_table, "body");
4567

0 commit comments

Comments
 (0)