Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions ngx_x_rid_header_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <ngx_http_variables.h>

#if (NGX_FREEBSD)
#error FreeBSD is not supported yet, sorry.
#include <uuid.h>
#elif (NGX_LINUX)
#include <uuid.h>
#elif (NGX_SOLARIS)
Expand All @@ -26,7 +26,23 @@ ngx_int_t ngx_x_rid_header_get_variable(ngx_http_request_t *r, ngx_http_variable
}

#if (NGX_FREEBSD)
#error FreeBSD is not supported yet, sorry.
char *p_tmp;
uuid_t uuid;
uint32_t uuid_status;
uuid_create(&uuid, &uuid_status);
if ( uuid_status != uuid_s_ok ) {
return -1;
}
uuid_to_string(&uuid, (char **)&p_tmp, &uuid_status);
if ( uuid_status != uuid_s_ok ) {
return -1;
}

if ( memmove(p, p_tmp, 37) < 0 ) {
free(p_tmp);
return -1;
}
free(p_tmp);
#elif (NGX_LINUX)
uuid_t* uuid;
if ( uuid_create(&uuid) ) {
Expand Down