Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
native_spawn_temp_body.c File Reference

Writes multipart request bodies to temporary files and removes them during cleanup. More...

#include "native_spawn_temp_body.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define pharos_spawn_temp_body_write   write
#define pharos_spawn_temp_body_close   close
#define pharos_spawn_temp_body_unlink   unlink
#define pharos_spawn_temp_body_strdup   strdup

Functions

int write_native_temp_body_file (const char *body, size_t body_len, char **temp_body_path_out)
 Writes a request body to a temporary file for multipart request execution.
void cleanup_native_temp_body_file (char **temp_body_path_io)
 Removes a temporary request-body file and clears its stored path.

Detailed Description

Writes multipart request bodies to temporary files and removes them during cleanup.

Definition in file native_spawn_temp_body.c.

Macro Definition Documentation

◆ pharos_spawn_temp_body_close

#define pharos_spawn_temp_body_close   close

Definition at line 20 of file native_spawn_temp_body.c.

Referenced by write_native_temp_body_file().

◆ pharos_spawn_temp_body_strdup

#define pharos_spawn_temp_body_strdup   strdup

Definition at line 22 of file native_spawn_temp_body.c.

Referenced by write_native_temp_body_file().

◆ pharos_spawn_temp_body_unlink

#define pharos_spawn_temp_body_unlink   unlink

◆ pharos_spawn_temp_body_write

#define pharos_spawn_temp_body_write   write

Definition at line 19 of file native_spawn_temp_body.c.

Referenced by write_native_temp_body_file().

Function Documentation

◆ cleanup_native_temp_body_file()

void cleanup_native_temp_body_file ( char ** temp_body_path_io)

Removes a temporary request-body file and clears its stored path.

Parameters
temp_body_path_ioIn-out pointer to the owned temp file path string.

Definition at line 61 of file native_spawn_temp_body.c.

References pharos_spawn_temp_body_unlink.

Referenced by free_http_request_native(), and spawn_app_request().

◆ write_native_temp_body_file()

int write_native_temp_body_file ( const char * body,
size_t body_len,
char ** temp_body_path_out )

Writes a request body to a temporary file for multipart request execution.

Parameters
bodyRequest body bytes to persist.
body_lenNumber of bytes in body.
temp_body_path_outDestination for the allocated temp file path.
Returns
0 on success, or a non-zero status code on failure.

Definition at line 35 of file native_spawn_temp_body.c.

References pharos_spawn_temp_body_close, pharos_spawn_temp_body_strdup, pharos_spawn_temp_body_unlink, and pharos_spawn_temp_body_write.

Referenced by spawn_app_request().