Changeset 10364
- Timestamp:
- 09/15/08 16:24:07 (5 years ago)
- Location:
- src/router/httpd
- Files:
-
- 5 edited
-
httpd.c (modified) (8 diffs)
-
httpd.h (modified) (1 diff)
-
modules/broadcom.c (modified) (2 diffs)
-
modules/nvramsr.c (modified) (2 diffs)
-
xyssl/library/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/router/httpd/httpd.c
r10363 r10364 179 179 char *text ); 180 180 static void send_headers( int status, char *title, char *extra_header, 181 char *mime_type, long length );181 char *mime_type, long length ,char *attach_file); 182 182 static int b64_decode( const char *str, unsigned char *space, int size ); 183 183 static int match( const char *pattern, const char *string ); … … 313 313 314 314 // jimmy, https, 8/4/2003, fprintf -> wfprintf, fflush -> wfflush 315 send_headers( status, title, extra_header, "text/html", 0 );315 send_headers( status, title, extra_header, "text/html", 0 ,NULL); 316 316 ( void )wfprintf( conn_fp, 317 317 "<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>\n<BODY BGCOLOR=\"#cc9999\"><H4>%d %s</H4>\n", … … 324 324 static void 325 325 send_headers( int status, char *title, char *extra_header, char *mime_type, 326 long length )326 long length , char *attach_file) 327 327 { 328 328 time_t now; 329 329 char timebuf[100]; 330 331 // jimmy, https, 8/4/2003, fprintf -> wfprintf332 330 wfprintf( conn_fp, "%s %d %s\r\n", PROTOCOL, status, title ); 331 if( mime_type != ( char * )0 ) 332 wfprintf( conn_fp, "Content-Type: %s\r\n", mime_type ); 333 334 333 335 wfprintf( conn_fp, "Server: %s\r\n", SERVER_NAME ); 334 336 now = time( ( time_t * ) 0 ); 335 337 strftime( timebuf, sizeof( timebuf ), RFC1123FMT, gmtime( &now ) ); 336 338 wfprintf( conn_fp, "Date: %s\r\n", timebuf ); 339 wfprintf( conn_fp, "Connection: close\r\n" ); 340 if (attach_file) 341 wfprintf( conn_fp, "Content-Disposition: attachment; filename=%s\r\n", attach_file ); 337 342 if( extra_header != ( char * )0 && *extra_header ) 338 343 wfprintf( conn_fp, "%s\r\n", extra_header ); 339 if( mime_type != ( char * )0 )340 wfprintf( conn_fp, "Content-Type: %s\r\n", mime_type );341 344 if( length != 0 ) 342 345 wfprintf( conn_fp, "Content-Length: %ld\r\n", length ); 343 wfprintf( conn_fp, "Connection: close\r\n" );344 346 wfprintf( conn_fp, "\r\n" ); 345 347 } … … 479 481 } 480 482 481 void483 static void 482 484 //do_file(char *path, FILE *stream) 483 do_file ( struct mime_handler *handler, char *path, webs_t stream, char *query) //jimmy, https, 8/4/2003485 do_file_2( struct mime_handler *handler, char *path, webs_t stream, char *query,char *attach ) //jimmy, https, 8/4/2003 484 486 { 485 487 … … 521 523 if( !handler->send_headers ) 522 524 send_headers( 200, "Ok", handler->extra_header, 523 handler->mime_type, ftell( fp ) );525 handler->mime_type, ftell( fp ) ,attach); 524 526 fseek( fp, 0, SEEK_SET ); 525 527 while( ( c = getc( fp ) ) != EOF ) … … 534 536 if( !handler->send_headers ) 535 537 send_headers( 200, "Ok", handler->extra_header, 536 handler->mime_type, len );538 handler->mime_type, len ,attach); 537 539 int a; 538 540 char buf[128]; … … 550 552 } 551 553 #endif 554 } 555 556 557 void 558 //do_file(char *path, FILE *stream) 559 do_file( struct mime_handler *handler, char *path, webs_t stream, char *query ) //jimmy, https, 8/4/2003 560 { 561 562 do_file_2(handler,path,stream,query,NULL); 563 } 564 void 565 //do_file(char *path, FILE *stream) 566 do_file_attach( struct mime_handler *handler, char *path, webs_t stream, char *query,char *attachment ) //jimmy, https, 8/4/2003 567 { 568 569 do_file_2(handler,path,stream,query,attachment); 552 570 } 553 571 … … 1041 1059 if( handler->send_headers ) 1042 1060 send_headers( 200, "Ok", handler->extra_header, 1043 handler->mime_type, 0 );1061 handler->mime_type, 0,NULL ); 1044 1062 } 1045 1063 if( handler->output ) -
src/router/httpd/httpd.h
r10356 r10364 87 87 /* Regular file handler */ 88 88 extern void do_file (struct mime_handler *handler,char *path, webs_t stream, char *query); 89 extern void do_file_attach (struct mime_handler *handler,char *path, webs_t stream, char *query, char *attachment); 89 90 90 91 /* GoAhead 2.1 compatibility */ -
src/router/httpd/modules/broadcom.c
r10356 r10364 1497 1497 { 1498 1498 system2( "cat /dev/mtd/0 > /tmp/cfe.bin" ); 1499 do_file (handler, "/tmp/cfe.bin", stream, NULL);1499 do_file_attach(handler, "/tmp/cfe.bin", stream, NULL,"cfe.bin" ); 1500 1500 unlink( "/tmp/cfe.bin" ); 1501 1501 } … … 2164 2164 #ifdef HAVE_DDLAN 2165 2165 {"nvrambak.bin*", "application/octet-stream", no_cache, NULL, nv_file_out, 2166 do_auth2, 1},2166 do_auth2,0}, 2167 2167 {"nvrambak**.bin*", "application/octet-stream", no_cache, NULL, 2168 2168 nv_file_out, 2169 do_auth2, 1},2169 do_auth2,0}, 2170 2170 {"nvram.cgi*", "text/html", no_cache, nv_file_in, sr_config_cgi, NULL,1}, 2171 2171 #else 2172 2172 {"nvrambak.bin*", "application/octet-stream", no_cache, NULL, nv_file_out, 2173 do_auth, 1},2173 do_auth,0}, 2174 2174 {"nvrambak**.bin*", "application/octet-stream", no_cache, NULL, 2175 2175 nv_file_out, 2176 do_auth, 1},2176 do_auth,0}, 2177 2177 {"nvram.cgi*", "text/html", no_cache, nv_file_in, sr_config_cgi, do_auth,1}, 2178 2178 #endif -
src/router/httpd/modules/nvramsr.c
r10356 r10364 296 296 backupcount++; 297 297 } 298 wfwrite( sign, 6, 1, wp ); 299 wfputc( backupcount & 255, wp ); // high byte 300 wfputc( backupcount >> 8, wp ); // low byte 298 FILE *fp = fopen("/tmp/nvrambak.bin","wb"); 299 300 fwrite( sign, 6, 1, fp ); 301 fputc( backupcount & 255, fp ); // high byte 302 fputc( backupcount >> 8, fp ); // low byte 301 303 while( strlen( p ) != 0 ) 302 304 { … … 308 310 char *name = p; 309 311 310 wfputc( strlen( name ), wp );312 fputc( strlen( name ), fp ); 311 313 312 314 for( i = 0; i < strlen( name ); i++ ) 313 wfputc( name[i], wp );315 fputc( name[i], fp ); 314 316 char *val = nvram_safe_get( name ); 315 317 316 wfputc( strlen( val ) & 255, wp );317 wfputc( strlen( val ) >> 8, wp );318 fputc( strlen( val ) & 255, fp ); 319 fputc( strlen( val ) >> 8, fp ); 318 320 for( i = 0; i < strlen( val ); i++ ) 319 wfputc( val[i], wp );321 fputc( val[i], fp ); 320 322 321 323 p += len + 1; 322 324 } 323 325 free( buf ); 324 326 fclose(fp); 327 do_file_attach(handler,"/tmp/nvrambak.bin",wp,query,"nvrambak.bin"); 328 eval("rm","-f","/tmp/nvrambak.bin"); 325 329 return; 326 330 } -
src/router/httpd/xyssl/library/Makefile
r10362 r10364 28 28 29 29 libxyssl.a: $(OBJS) 30 @echo " $(AR) $@";$(AR) r $@ $(OBJS)30 $(AR) r $@ $(OBJS) 31 31 32 32 shared: libxyssl.so 33 33 34 34 libxyssl.so: $(OBJS) 35 @echo " $(LD) $@";$(LD) -shared -o $@ $^35 $(LD) -shared -o $@ $^ 36 36 37 37 .c.o: 38 @echo " $(CC) $<";$(CC) $(CFLAGS) -c $<38 $(CC) $(CFLAGS) -c $< 39 39 40 40 clean:
Note: See TracChangeset
for help on using the changeset viewer.
