Hi,

I writing a MJPEG server from scratch with socket an i want to port it to Apache 2.4.x...

I write a simple filter using using below code.

I install it on apache an it work if i return a simple xml content...

With MJPEG i need to send one time a header : "HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace; boundary=--boundary\r\n"

And for each image i need to return.

"\r\n--boundary\r\nContent-Type: image/jpeg\r\nContent-Length: %d\r\n\r\n" follow by jpeg data...

i found on the document this function : "ap_send_interim_response" that seem to send multiple block before the final return OK;

Is it the right way or there's a more simple way to send header and all boundary data block ?

Thanks,

WCoder

Code :
ap_hook_handler ( OnMethodeHandler, NULL, NULL, APR_HOOK_LAST );

static int OnMethodeHandler ( request_rec * pRequest )
{
// Split path ad get handler (filename & extension).
char szHandler [_MAX_PATH] = { "" };
char szExtension [_MAX_PATH] = { "" };
_splitpath ( strlwr ( const_cast<char *>( pRequest -> filename )), NULL, NULL, szHandler, szExtension );

// Check if url is a mjpeg ressource file.
if ( strcmp ( szExtension, ".mjpg" ) != 0 )
{
// Not for plugin.
hResult = DECLINED;

// Do not process.
return DECLINED;
}

// Check if it's a get methode ?
if ( pRequest -> method_number != M_GET )
{
APACHE_LOG("Insupported query type !");

// Not supported...
hResult = HTTP_NOT_IMPLEMENTED;

// Generate exception.
throw ( 0 );
}

.....

// Every things ok.
return OK;
}