mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 00:20:46 +00:00 
			
		
		
		
	fix
This commit is contained in:
		
							parent
							
								
									e336cbfb2d
								
							
						
					
					
						commit
						7c970771c5
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
					@ -1148,15 +1148,14 @@ namespace transport
 | 
				
			||||||
			std::ostream out(&writebuff);
 | 
								std::ostream out(&writebuff);
 | 
				
			||||||
			out << req.to_string();
 | 
								out << req.to_string();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			boost::asio::async_write(conn->GetSocket(), writebuff, boost::asio::transfer_all(), [=](const boost::system::error_code & ec, std::size_t transferred) {
 | 
								boost::asio::async_write(conn->GetSocket(), writebuff.data(), boost::asio::transfer_all(), [=](const boost::system::error_code & ec, std::size_t transferred) {
 | 
				
			||||||
				(void) transferred;
 | 
									(void) transferred;
 | 
				
			||||||
				if(ec)
 | 
									if(ec)
 | 
				
			||||||
					LogPrint(eLogError, "NTCP: http proxy write error ", ec.message());
 | 
										LogPrint(eLogError, "NTCP: http proxy write error ", ec.message());
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			boost::asio::streambuf readbuff;
 | 
								boost::asio::streambuf * readbuff = new boost::asio::streambuf;
 | 
				
			||||||
			boost::asio::async_read_until(conn->GetSocket(), readbuff, "\r\n\r\n", [=, &readbuff] (const boost::system::error_code & ec, std::size_t transferred) {
 | 
								boost::asio::async_read_until(conn->GetSocket(), *readbuff, "\r\n\r\n", [=] (const boost::system::error_code & ec, std::size_t transferred) {
 | 
				
			||||||
				(void) transferred;
 | 
					 | 
				
			||||||
				if(ec)
 | 
									if(ec)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					LogPrint(eLogError, "NTCP: http proxy read error ", ec.message());
 | 
										LogPrint(eLogError, "NTCP: http proxy read error ", ec.message());
 | 
				
			||||||
| 
						 | 
					@ -1165,14 +1164,15 @@ namespace transport
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					readbuff.commit(transferred);
 | 
										readbuff->commit(transferred);
 | 
				
			||||||
					i2p::http::HTTPRes res;
 | 
										i2p::http::HTTPRes res;
 | 
				
			||||||
					if(res.parse(boost::asio::buffer_cast<const char*>(readbuff.data()), readbuff.size()) > 0)
 | 
										if(res.parse(boost::asio::buffer_cast<const char*>(readbuff->data()), readbuff->size()) > 0)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						if(res.code == 200)
 | 
											if(res.code == 200)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							timer->cancel();
 | 
												timer->cancel();
 | 
				
			||||||
							conn->ClientLogin();
 | 
												conn->ClientLogin();
 | 
				
			||||||
 | 
												delete readbuff;
 | 
				
			||||||
							return;
 | 
												return;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						else
 | 
											else
 | 
				
			||||||
| 
						 | 
					@ -1184,6 +1184,7 @@ namespace transport
 | 
				
			||||||
						LogPrint(eLogError, "NTCP: http proxy gave malformed response");
 | 
											LogPrint(eLogError, "NTCP: http proxy gave malformed response");
 | 
				
			||||||
					timer->cancel();
 | 
										timer->cancel();
 | 
				
			||||||
					conn->Terminate();
 | 
										conn->Terminate();
 | 
				
			||||||
 | 
										delete readbuff;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue