Changeset 129

Show
Ignore:
Timestamp:
02/15/06 15:44:02 (3 years ago)
Author:
conrad
Message:

add content_length function, add Content-Length header for from-memory sends

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fastphoto/trunk/src/cache.c

    r125 r129  
    7171    int ret; 
    7272 
    73     if ((ret = file_check (cachefile, &cache_mtime, NULL)) != 1) { 
     73    if ((ret = file_check (cachefile, &cache_mtime, &params->data_size)) != 1) { 
    7474        return ret; 
    7575    } 
  • fastphoto/trunk/src/cgi.c

    r125 r129  
    110110content_type_jpeg () 
    111111{ 
    112     puts (CONTENT_TYPE_JPEG); 
    113     fflush (stdout); 
    114     return 0; 
     112  printf (CONTENT_TYPE_JPEG); 
     113  return 0; 
    115114} 
     115 
     116int 
     117content_length (int len) 
     118{ 
     119  return printf ("Content-Length: %d\n", len); 
     120} 
     121 
     122int 
     123cgi_end_headers (void) 
     124{ 
     125  putchar('\n'); 
     126  fflush (stdout); 
     127  return 0; 
     128} 
  • fastphoto/trunk/src/cgi.h

    r100 r129  
    55 
    66int content_type_jpeg (void); 
     7int content_length (int len); 
     8int cgi_end_headers (void); 
    79 
    810int cgi_init (fastphoto_t * params); 
  • fastphoto/trunk/src/send.c

    r125 r129  
    1414#endif 
    1515 
     16#include "cgi.h" 
    1617#include "fastphoto.h" 
    1718 
     
    8182  } else { 
    8283    fprintf (stderr, "fastphoto: Sending from memory ...\n"); 
     84    content_length (params->data_size); 
     85    cgi_end_headers(); 
    8386    send_memory (params); 
    8487  }