mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	corrected content length
This commit is contained in:
		
							parent
							
								
									6c11f943d0
								
							
						
					
					
						commit
						183ae42a54
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		|  | @ -152,9 +152,10 @@ private def multipart(file, env : HTTP::Server::Context) | |||
|     endb = fileb - 1 | ||||
|   end | ||||
| 
 | ||||
|   if startb < endb && endb <= fileb | ||||
|   if startb < endb && endb < fileb | ||||
|     content_length = 1 + endb - startb | ||||
|     env.response.status_code = 206 | ||||
|     env.response.content_length = endb - startb | ||||
|     env.response.content_length = content_length | ||||
|     env.response.headers["Accept-Ranges"] = "bytes" | ||||
|     env.response.headers["Content-Range"] = "bytes #{startb}-#{endb}/#{fileb}" # MUST | ||||
| 
 | ||||
|  | @ -172,7 +173,7 @@ private def multipart(file, env : HTTP::Server::Context) | |||
|       file.skip(startb) | ||||
|     end | ||||
| 
 | ||||
|     IO.copy(file, env.response, endb - startb) | ||||
|     IO.copy(file, env.response, content_length) | ||||
|   else | ||||
|     env.response.content_length = fileb | ||||
|     env.response.status_code = 200 # Range not satisfable, see 4.4 Note | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue