@ -73,7 +73,7 @@ static bool process_envelope( struct outbox_envelope* env )
}
struct http_signature hs ;
if ( ! http_signature_make ( inbox , keys , & hs /*, postdata */ ) ) {
if ( ! http_signature_make ( inbox , keys , & hs , postdata ) ) {
printf ( " ! Failed to make HTTP signature \n " ) ;
goto failed ;
}
@ -82,7 +82,7 @@ static bool process_envelope( struct outbox_envelope* env )
snprintf ( date_header , sizeof ( date_header ) , " Date: %s " , hs . date ) ;
char sign_header [ 512 ] ;
snprintf ( sign_header , sizeof ( sign_header ) , " Signature: keyId= \" https://%s/owner/actor#mainKey \" ,headers= \" (request-target) host date \" ,signature= \" %s \" " ,
snprintf ( sign_header , sizeof ( sign_header ) , " Signature: keyId= \" https://%s/owner/actor#mainKey \" ,headers= \" (request-target) host date content-length digest \" ,signature= \" %s \" " ,
g_server_name ,
hs . signature
) ;
@ -90,6 +90,12 @@ static bool process_envelope( struct outbox_envelope* env )
char user_agent [ 512 ] ;
snprintf ( user_agent , sizeof ( user_agent ) , " User-Agent: curl (Apogee/0.1; +https://%s/) " , g_server_name ) ;
char digest_header [ 512 ] ;
snprintf ( digest_header , sizeof ( digest_header ) , " Digest: %s " , hs . digest ) ;
char content_length_header [ 512 ] ;
snprintf ( content_length_header , sizeof ( content_length_header ) , " Content-Length: %d " , hs . content_length ) ;
printf ( " Performing post to %s \n " , inbox ) ;
long status_code = - 1 ;
const void * request [ ] = {
@ -97,6 +103,8 @@ static bool process_envelope( struct outbox_envelope* env )
HTTP_REQ_HEADER , user_agent ,
HTTP_REQ_HEADER , date_header ,
HTTP_REQ_HEADER , sign_header ,
HTTP_REQ_HEADER , content_length_header ,
HTTP_REQ_HEADER , digest_header ,
HTTP_REQ_HEADER , " Content-Type: application/activity+json " ,
HTTP_REQ_POSTDATA , postdata ,
HTTP_REQ_RESULT_STATUS , & status_code ,
@ -105,8 +113,10 @@ static bool process_envelope( struct outbox_envelope* env )
// POST to inbox
printf ( " \n \n Request result: \n " ) ;
fflush ( stdout ) ;
http_client_do ( request ) ;
printf ( " \n \n " ) ;
fflush ( stdout ) ;
http_signature_free ( & hs ) ;