mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	Support websocket connections over HTTP proxy
This commit is contained in:
		
							parent
							
								
									80ffe13f3e
								
							
						
					
					
						commit
						f617b27110
					
				
					 2 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -219,7 +219,9 @@ namespace proxy {
 | 
				
			||||||
		/* replace headers */
 | 
							/* replace headers */
 | 
				
			||||||
		req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
 | 
							req.UpdateHeader("User-Agent", "MYOB/6.66 (AN/ON)");
 | 
				
			||||||
		/* add headers */
 | 
							/* add headers */
 | 
				
			||||||
		req.UpdateHeader("Connection", "close"); /* keep-alive conns not supported yet */
 | 
							auto h = req.GetHeader ("Connection");
 | 
				
			||||||
 | 
							if (h.find("upgrade") == std::string::npos && h.find("Upgrade") == std::string::npos)
 | 
				
			||||||
 | 
								req.UpdateHeader("Connection", "close"); /* close everything, except websocket */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -256,7 +256,11 @@ namespace client
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						if (!m_ConnectionSent && !line.compare(0, 10, "Connection"))
 | 
											if (!m_ConnectionSent && !line.compare(0, 10, "Connection"))
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							m_OutHeader << "Connection: close\r\n";
 | 
												if (line.find("upgrade") == std::string::npos && line.find("Upgrade") == std::string::npos)
 | 
				
			||||||
 | 
													m_OutHeader << "Connection: close\r\n"; /* close everything, except websocket */
 | 
				
			||||||
 | 
												else
 | 
				
			||||||
 | 
													m_OutHeader << line << "\r\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							m_ConnectionSent = true;
 | 
												m_ConnectionSent = true;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						else if (!m_ProxyConnectionSent && !line.compare(0, 16, "Proxy-Connection"))
 | 
											else if (!m_ProxyConnectionSent && !line.compare(0, 16, "Proxy-Connection"))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue