largefile patch added
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@79 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
		| @@ -367,7 +367,7 @@ http_SendMessage( IN SOCKINFO * info, | |||||||
|                     return UPNP_E_FILE_READ_ERROR; |                     return UPNP_E_FILE_READ_ERROR; | ||||||
|                 } |                 } | ||||||
|             } else if( Instr && Instr->IsRangeActive ) { |             } else if( Instr && Instr->IsRangeActive ) { | ||||||
|                 if( fseek( Fp, Instr->RangeOffset, SEEK_CUR ) != 0 ) { |                 if( fseeko( Fp, Instr->RangeOffset, SEEK_CUR ) != 0 ) { | ||||||
|                     free( ChunkBuf ); |                     free( ChunkBuf ); | ||||||
|                     return UPNP_E_FILE_READ_ERROR; |                     return UPNP_E_FILE_READ_ERROR; | ||||||
|                 } |                 } | ||||||
| @@ -1762,6 +1762,7 @@ http_SendStatusResponse( IN SOCKINFO * info, | |||||||
| *				memory ptr | *				memory ptr | ||||||
| *		'c':	(no args) appends CRLF "\r\n" | *		'c':	(no args) appends CRLF "\r\n" | ||||||
| *		'd':	arg = int number		// appends decimal number | *		'd':	arg = int number		// appends decimal number | ||||||
|  | *		'h':	arg = off_t number		// appends off_t number | ||||||
| *		't':	arg = time_t * gmt_time	// appends time in RFC 1123 fmt | *		't':	arg = time_t * gmt_time	// appends time in RFC 1123 fmt | ||||||
| *		'D':	(no args) appends HTTP DATE: header | *		'D':	(no args) appends HTTP DATE: header | ||||||
| *		'S':	(no args) appends HTTP SERVER: header | *		'S':	(no args) appends HTTP SERVER: header | ||||||
| @@ -1797,6 +1798,7 @@ http_MakeMessage( INOUT membuffer * buf, | |||||||
|     char c; |     char c; | ||||||
|     char *s = NULL; |     char *s = NULL; | ||||||
|     int num; |     int num; | ||||||
|  |     off_t bignum; | ||||||
|     size_t length; |     size_t length; | ||||||
|     time_t *loc_time; |     time_t *loc_time; | ||||||
|     time_t curr_time; |     time_t curr_time; | ||||||
| @@ -1884,6 +1886,16 @@ http_MakeMessage( INOUT membuffer * buf, | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         else if( c == 'h' )     // off_t | ||||||
|  |         { | ||||||
|  |             bignum = ( off_t )va_arg( argp, off_t ); | ||||||
|  |  | ||||||
|  |             sprintf( tempbuf, "%lld", bignum ); | ||||||
|  |             if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) { | ||||||
|  |                 goto error_handler; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|         else if( c == 't' || c == 'D' ) // date |         else if( c == 't' || c == 'D' ) // date | ||||||
|         { |         { | ||||||
|             if( c == 'D' ) { |             if( c == 'D' ) { | ||||||
| @@ -1925,12 +1937,12 @@ http_MakeMessage( INOUT membuffer * buf, | |||||||
|  |  | ||||||
|         else if( c == 'N' ) { |         else if( c == 'N' ) { | ||||||
|             // content-length header |             // content-length header | ||||||
|             num = ( int )va_arg( argp, int ); |             bignum = ( off_t )va_arg( argp, off_t ); | ||||||
|  |  | ||||||
|             assert( num >= 0 ); |             assert( bignum >= 0 ); | ||||||
|             if( http_MakeMessage |             if( http_MakeMessage | ||||||
|                 ( buf, http_major_version, http_minor_version, "sdc", |                 ( buf, http_major_version, http_minor_version, "shc", | ||||||
|                   "CONTENT-LENGTH: ", num ) != 0 ) { |                   "CONTENT-LENGTH: ", bignum ) != 0 ) { | ||||||
|                 goto error_handler; |                 goto error_handler; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -1996,9 +2008,9 @@ http_MakeMessage( INOUT membuffer * buf, | |||||||
|                      "<html><body><h1>", |                      "<html><body><h1>", | ||||||
|                      status_code, http_get_code_text( status_code ), |                      status_code, http_get_code_text( status_code ), | ||||||
|                      "</h1></body></html>" ); |                      "</h1></body></html>" ); | ||||||
|             num = strlen( tempbuf ); |             bignum = strlen( tempbuf ); | ||||||
|  |  | ||||||
|             if( http_MakeMessage( buf, http_major_version, http_minor_version, "NTcs", num, // content-length |             if( http_MakeMessage( buf, http_major_version, http_minor_version, "NTcs", bignum, // content-length | ||||||
|                                   "text/html",  // content-type |                                   "text/html",  // content-type | ||||||
|                                   tempbuf ) != 0 )  // body |                                   tempbuf ) != 0 )  // body | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -632,7 +632,7 @@ get_file_info( IN const char *filename, | |||||||
|     rc = get_content_type( filename, &info->content_type ); |     rc = get_content_type( filename, &info->content_type ); | ||||||
|  |  | ||||||
|     DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, |     DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, | ||||||
|                          "file info: %s, length: %d, last_mod=%s readable=%d\n", |                          "file info: %s, length: %lld, last_mod=%s readable=%d\n", | ||||||
|                          filename, info->file_length, |                          filename, info->file_length, | ||||||
|                          asctime( gmtime( &info->last_modified ) ), |                          asctime( gmtime( &info->last_modified ) ), | ||||||
|                          info->is_readable ); ) |                          info->is_readable ); ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Oxy
					Oxy