httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Subra A Narayanan" <aswat...@gmail.com>
Subject Trying to generate Content-MD5 header
Date Tue, 11 Mar 2008 20:31:03 GMT
Hello all,

I have posted this question in the 'apr-dev' mailing list as well. Hoping
someone here can answer my question.

I have an apache module which receives various HTTP requests and processes
it. The incoming HTTP requests (PUT, POST) have the Content-MD5 header set.
I want to compute the md5 hash of the request body to verify that it matches
with the Content-MD5 header. Also, when responding to a GET request, I want
to compute the md5 hash of the response body and set the Content-MD5 header
again.

I thought I could use the functions defined in the apr_md5.h file. I started
out to write a test program but I am not even able to compile. I must be
making some obvious mistake but I am not able to figure it out. I would
appreciate any help. Here is the relevant information:

******Compiler Command***********

*
gcc -I /usr/include/apr-0/ -L /usr/lib/ -l apr-0 aprmd5test.c*


*********************************

******This is the error I get:***********
*/tmp/ccSamLQy.o(.text+0x6b): In function `main':
: undefined reference to `apr_md5'

collect2: ld returned 1 exit status
*
*********************************************

************And here is my test program:*************


#include <apr.h>
#include <apr_md5.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

#include <string.h>



*//char *base64(const unsigned char *input, int length);*

int main(int argc, char **argv)
{
	void *buf;
	unsigned long n = 17;
	buf = malloc(n);
	int fd = open("test", O_RDONLY);
	read(fd, buf, n);

	unsigned char md5Hash[16];
	apr_md5(md5Hash, buf, n);

	printf("md5: *%s*\n", md5Hash);

        free(buf);

}

***********************************************************

Thanks,
Subra

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message