mirror of
				https://github.com/TeamPiped/piped-proxy.git
				synced 2024-08-14 23:50:45 +00:00 
			
		
		
		
	Add range header handling for ump streams.
See https://github.com/TeamPiped/Piped/issues/3196
This commit is contained in:
		
							parent
							
								
									75f7c4e8cd
								
							
						
					
					
						commit
						2295ad3d94
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		
							
								
								
									
										10
									
								
								src/main.rs
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/main.rs
									
										
									
									
									
								
							| 
						 | 
					@ -142,7 +142,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // parse query string
 | 
					    // parse query string
 | 
				
			||||||
    let query = QString::from(req.query_string());
 | 
					    let mut query = QString::from(req.query_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[cfg(feature = "qhash")]
 | 
					    #[cfg(feature = "qhash")]
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -236,6 +236,14 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let mime_type = query.get("mime").map(|s| s.to_string());
 | 
					    let mime_type = query.get("mime").map(|s| s.to_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if is_ump && !query.has("range") {
 | 
				
			||||||
 | 
					        if let Some(range) = req.headers().get("range") {
 | 
				
			||||||
 | 
					            let range = range.to_str().unwrap();
 | 
				
			||||||
 | 
					            let range = range.replace("bytes=", "");
 | 
				
			||||||
 | 
					            query.add_pair(("range", range));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let qs = {
 | 
					    let qs = {
 | 
				
			||||||
        let collected = query
 | 
					        let collected = query
 | 
				
			||||||
            .into_pairs()
 | 
					            .into_pairs()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue