From f04296de38c2806d9f15bc343ca5d281c010d008 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Mon, 16 Mar 2009 18:43:42 +0000 Subject: [PATCH] * Fork request handling for resized images. --- upnphttp.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/upnphttp.c b/upnphttp.c index 8191d1d..fc4f04a 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -1119,19 +1119,24 @@ SendResp_resizedimg(struct upnphttp * h, char * object) char *path, *file_path; char *resolution, *tn; char *key, *val; - char *saveptr, *item; + char *saveptr, *item = NULL; char *pixelshape = NULL; int rows=0, ret; gdImagePtr imsrc = 0, imdst = 0; ExifData *ed; ExifLoader *l; +#if USE_FORK + pid_t newpid = 0; + newpid = fork(); + if( newpid ) + return; +#endif memset(header, 0, 1500); path = strdup(object); if( strtok_r(path, "?", &saveptr) ) { item = strtok_r(NULL, "&", &saveptr); - //continue; } while( item != NULL ) { @@ -1234,8 +1239,9 @@ SendResp_resizedimg(struct upnphttp * h, char * object) #else gdImageCopyResampled(imdst, imsrc, 0, 0, 0, 0, dstw, dsth, imsrc->sx, imsrc->sy); #endif - #endif + #else boxfilter_resize(imdst, imsrc, 0, 0, 0, 0, dstw, dsth, imsrc->sx, imsrc->sy); + #endif data = (char *)gdImageJpegPtr(imdst, &size, 99); DPRINTF(E_INFO, L_HTTP, "size: %d\n", size); strftime(date, 30,"%a, %d %b %Y %H:%M:%S GMT" , gmtime(&curtime)); @@ -1268,6 +1274,9 @@ SendResp_resizedimg(struct upnphttp * h, char * object) gdImageDestroy(imdst); DPRINTF(E_INFO, L_HTTP, "Done serving %s\n", file_path); sqlite3_free_table(result); +#if USE_FORK + _exit(0); +#endif } void