Added support for overriding multiplexing behaviour of HTTP proxy connector.
This commit is contained in:
		
							parent
							
								
									bda368b75f
								
							
						
					
					
						commit
						537c3cff94
					
				
					 2 changed files with 7 additions and 1 deletions
				
			
		|  | @ -508,7 +508,7 @@ namespace Connector_HTTP { | |||
|     }else{ | ||||
|       long long int ret = Util::getMS(); | ||||
|       //success, check type of response
 | ||||
|       if (H.GetHeader("Content-Length") != "" || H.GetHeader("Transfer-Encoding") == "chunked"){ | ||||
|       if (H.GetHeader("MistMultiplex") != "No" && (H.GetHeader("Content-Length") != "" || H.GetHeader("Transfer-Encoding") == "chunked")){ | ||||
|         //known length - simply re-send the request with added headers and continue
 | ||||
|         DEBUG_MSG(DLVL_HIGH, "Proxying %s - known length or chunked transfer encoding", uid.c_str()); | ||||
|         H.SetHeader("X-UID", uid); | ||||
|  |  | |||
|  | @ -509,6 +509,10 @@ namespace Connector_HTTP { | |||
|                 std::stringstream rangeReply; | ||||
|                 rangeReply << "bytes " << byteStart << "-" << byteEnd << "/" << size; | ||||
|                 HTTP_S.SetHeader("Content-Length", byteEnd - byteStart + 1); | ||||
|                 //do not multiplex requests that are > 1MiB
 | ||||
|                 if (byteEnd - byteStart + 1 > 1024*1024){ | ||||
|                   HTTP_S.SetHeader("MistMultiplex", "No"); | ||||
|                 } | ||||
|                 HTTP_S.SetHeader("Content-Range", rangeReply.str()); | ||||
|                 /// \todo Switch to chunked?
 | ||||
|                 HTTP_S.SendResponse("206", "Partial content", conn); | ||||
|  | @ -516,6 +520,8 @@ namespace Connector_HTTP { | |||
|               } | ||||
|             }else{ | ||||
|               HTTP_S.SetHeader("Content-Length", byteEnd - byteStart + 1); | ||||
|               //do not multiplex requests that aren't ranged
 | ||||
|               HTTP_S.SetHeader("MistMultiplex", "No"); | ||||
|               /// \todo Switch to chunked?
 | ||||
|               HTTP_S.SendResponse("200", "OK", conn); | ||||
|               //HTTP_S.StartResponse(HTTP_R, conn);
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma