tinyblocks-socket, -ssl, -http e -archive: internet e arquivos compactados em blocos

socket: conexao TCP como TbStream (fluxo com classe read/write/close) e
blocos para conectar, enviar, receber e resolver endereco.
ssl: embrulha um TbStream TCP em TLS (OpenSSL), com SNI e certificado
conferido pelo sistema e pelo nome do host.
http: cliente HTTP/1.1 so sobre TbStream; https:// quando a ssl esta
carregada; Content-Length, chunked e redirecionamentos; GET e POST de
texto e download em segundo plano (.parte ate terminar) com progresso.
archive: lista e extrai .tar e .tar.gz (zlib), nomes longos GNU/pax;
recusa entradas com "../" ou caminho absoluto.

As camadas se acham pelas tabelas no lib_userdata, sem linkar umas com as
outras. test-http usa um servidor local (e a internet, se houver);
test-archive cria os arquivos com tar e Python.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mguinhosandClaude Opus 5.5 committed 2026-10-23 23:27:08 -03:00
1 parent 05fdb094ed
commit 066bb295ed
20 files changed
+1689 -3

No files matched your search

+23 -3
View File
@@ -86,10 +86,10 @@ CAT_LDFLAGS := $(foreach l,$(CAT_LIBS),-ltinyblocks-$(l))
CAT_INCS := $(foreach l,$(CAT_LIBS),-I$(LIBDIR)/tinyblocks-$(l)/include)
# Libraries que o editor registra como as de categoria, mas com varios
# fontes e o Makefile proprio (o harness nao as compila junto)
APP_LIBS := tensor ai
APP_LIBS := socket ssl http archive tensor ai
APP_A := $(foreach l,$(APP_LIBS),$(LIBDIR)/tinyblocks-$(l)/build/libtinyblocks-$(l).a)
APP_INCS := $(foreach l,$(APP_LIBS),-I$(LIBDIR)/tinyblocks-$(l)/include)
APP_LDLIBS := -lpthread
APP_LDLIBS := -lssl -lcrypto -lz -lpthread
ED_A := $(ED_DIR)/build/libtinyblocks-editor.a
GX_A := $(GX_DIR)/build/libtinyblocks-graphics.a
SD_A := $(SD_DIR)/build/libtinyblocks-sdl2.a
@@ -111,7 +111,7 @@ LIB_LDFLAGS := -L$(ED_DIR)/build -L$(GX_DIR)/build -L$(SD_DIR)/build \
editor run-editor run-sdl2 mylib vector customappearance graphics sdl2-backend test-editor \
appdir appimage run-appimage icon \
test-toml test-plugin test-blueprint test-a11y test-mcp test-mcp-server test-base64 test-curves test-meta test-ppm test-bmp test-png test-image test-vg test-svg test-jpg \
test-tensor test-ai test-syntax test-os test-value test-vars test-scratchblocks test-input test-stdlib test-regex test-markdown test-opentype \
test-tensor test-ai test-http test-archive test-syntax test-os test-value test-vars test-scratchblocks test-input test-stdlib test-regex test-markdown test-opentype \
category-libs category-sos libs app-libs \
lib-events lib-control lib-errors lib-input lib-operators lib-number lib-string lib-variables lib-vector lib-appearance lib-pen lib-fs lib-os \
lib-environ \
@@ -628,6 +628,26 @@ $(BUILD)/ai_test: tests/ai_test.c $(AI_SRCS) $(AI_DIR)/src/ai_blocks.c $(AI_DIR)
test-ai: $(BUILD)/ai_test ## Roda o teste da ai (ASan/UBSan)
./$(BUILD)/ai_test
# -- Teste de socket + ssl + http (servidor local; internet se houver) ---
NET_SRCS := $(LIBDIR)/tinyblocks-socket/src/tb_socket.c $(LIBDIR)/tinyblocks-ssl/src/tb_ssl.c $(LIBDIR)/tinyblocks-http/src/tb_http.c
NET_INCS := -I$(LIBDIR)/tinyblocks-socket/include -I$(LIBDIR)/tinyblocks-ssl/include -I$(LIBDIR)/tinyblocks-http/include
$(BUILD)/http_test: tests/http_test.c $(NET_SRCS) static
@mkdir -p $(BUILD)
$(CC) $(CFLAGS_DBG) $(NET_INCS) $(NET_SRCS) tests/http_test.c -o $@ \
-Wl,--start-group $(LIB_A) -Wl,--end-group -lssl -lcrypto -lpthread -lm
test-http: $(BUILD)/http_test ## Roda o teste de socket/ssl/http (ASan/UBSan)
./$(BUILD)/http_test
# -- Teste da library archive (.tar / .tar.gz) ---
$(BUILD)/archive_test: tests/archive_test.c $(LIBDIR)/tinyblocks-archive/src/tb_archive.c static
@mkdir -p $(BUILD)
$(CC) $(CFLAGS_DBG) -I$(LIBDIR)/tinyblocks-archive/include $(LIBDIR)/tinyblocks-archive/src/tb_archive.c \
tests/archive_test.c -o $@ -Wl,--start-group $(LIB_A) -Wl,--end-group -lz -lm
test-archive: $(BUILD)/archive_test ## Roda o teste da archive (ASan/UBSan)
./$(BUILD)/archive_test
# -- Teste da library curves ---
$(BUILD)/curves_test: tests/curves_test.c $(CV_DIR)/src/tb_curves.c static
@mkdir -p $(BUILD)