Gnutella Forums  

Go Back   Gnutella Forums > Discontinued Gnutella Client Forums > Qtella (Linux/Unix)
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Search Today's Posts Mark Forums Read

Qtella (Linux/Unix) Qtella has been discontinued. We highly recommend you use an actively developed client instead.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old March 12th, 2002
Unregistered
Guest
 
Posts: n/a
Default Your right to block $$ clients

If you don't want to contribute any $$ to commercial clients, or clients that block XoloX without reason, or clients that have guntella domination in mind, apply the following patches so you don't connect or share files with them.
It's now your choice.
Reply With Quote
  #2 (permalink)  
Old March 12th, 2002
Unregistered
Guest
 
Posts: n/a
Default

for the file "Upload.cpp" modify "Upload::initUpload()" and recompile, the mod is only a few lines
see "/////////// THIS IS THE MOD!!!!"

Code:
void Upload::initUpload()
{
  StringManipulation sm(_data);

  if(_data.substr(0,3) != "GET")
    {
      setState(Closed);
      return;
    }

  std::string::size_type  idx = sm.to_lower().find("/get/");

  if(idx == std::string::npos)
    {
      _socket->close();
      setState(Closed);
      return;
    }

  idx += 5;
  std::string::size_type  idx2 = _data.find("/", idx);

  if(idx == std::string::npos)
    {
      _socket->close();
      setState(Closed);
      return;
    }

  std::string sindex = _data.substr(idx, idx2-idx);

  std::strstream a;
  a << sindex << std::ends;
  a >> index;


  idx = sm.to_lower().find(" http", idx2);

  if(idx == std::string::npos)
    {
      _socket->close();
      setState(Closed);
      return;
    }

  filename = _data.substr(idx2+1, idx-idx2-1);



/////////// THIS IS THE MOD!!!!

  // keep this BS off my screen
  if( (idx = sm.to_lower().find("bearshare")) != std::string::npos )
    {
      _socket->close();
      setState(Closed);
      return;
    }




  if( (idx = sm.to_lower().find("user-agent:")) != std::string::npos )
    {
      idx = _data.find_first_not_of(" ", idx+11);
      idx2 = _data.find("\r\n", idx);
      client = _data.substr(idx, idx2-idx);
    }
  else
    client = "";


  if( (idx = sm.to_lower().find("range:")) != std::string::npos )
    {
      idx = _data.find_first_of("1234567890", idx+6);
      idx2 = _data.find("-", idx);
      std::string srange_start = _data.substr(idx, idx2-idx);
      
      std::strstream c;
      c << srange_start << std::ends;
      c >> range_start;

      idx = _data.find("\r\n", idx2);
      std::string s = _data.substr(idx2, idx - idx2 - 1);

//       if( (idx = _data.find_first_of("0123456789", idx2+1)) != std::string::npos )
      if( (idx = s.find_first_of("0123456789")) != std::string::npos )
	{
	  idx2 = s.find_first_not_of("0123456789", idx);
	  std::string srange_end = s.substr(idx, idx2 - idx - 1);

	  std::strstream b;
	  b << srange_end << std::ends;
	  b >> range_end;
	}
      else range_end = 0;
    }
  else
    {
      range_start = 0;
      range_end = 0;
    }

  if(index < _parent->_parent->vSharedFiles.size())
    if( _parent->_parent->vSharedFiles[index]->file == filename )
      {
	_parent->_parent->vSharedFiles[index]->requests++;
	std::strstream str;
	str << _parent->_parent->vSharedFiles[index]->requests << std::ends;
	_parent->_parent->vSharedFiles[index]->item->setText(2, str.str());
	str.freeze(false);
      }

  if(_parent->numberUploads() >= _parent->_parent->ui_spinbox_maxuploads->value())
    {
      std::strstream str;
      std::string    s;
      str << "HTTP/1.0 503 Busy\r\nServer: Qtella " << VERSION << "\r\n\r\n" << std::ends;
      s = str.str();
      str.freeze(false);
      _socket->writeBlock(s.c_str(), s.size());
      _socket->close();
      _state = Busy;
      return;
    }

  //
  std::string f = _parent->_parent->vSharedFiles[index]->directory;

  if(f.size() > 0) if( f[f.size()-1] != '/' ) f += '/';
  f += _parent->_parent->vSharedFiles[index]->file;

  item = new QListViewItem(_parent->_parent->ui_listview_uploads, _parent->_parent->vSharedFiles[index]->file.c_str());
  item->setText(2, _socket->peerAddress().toString());

  _file.setName(f.c_str());

  if( !_file.exists() )
    {
      std::string s;
      s = "HTTP/1.0 404 NOT FOUND\r\nServer: Qtella "+std::string(VERSION)+"\r\n\r\n";
      _socket->writeBlock(s.data(), s.size());
      _socket->close();
      setState(NotFound);
      return;
    }

  setState(Connected);

  if(range_end == 0) range_end = _file.size() - 1;

  _towrite = range_end - range_start + 1;

  std::string s("HTTP/1.0 200 OK\r\nContent-Length: ");
  std::strstream str;
  str << _file.size() << std::ends;  // must be file.size() !!
  s += std::string(str.str());
  str.freeze(false);
  s += std::string("\r\nContent-Type: application/binary\r\nServer: Qtella "+std::string(VERSION)+"\r\n\r\n");

  _socket->writeBlock(s.c_str(), s.size());

  if( !_file.open(IO_ReadOnly|IO_Raw) )
    {
      setState(Error);
      _socket->close();
      return;
    }

  _file.at(range_start);
  _written = 0;
}
Reply With Quote
  #3 (permalink)  
Old March 12th, 2002
Unregistered
Guest
 
Posts: n/a
Default

in the file "Servent.cpp" change "Servent::slotReadyRead()" as below:

Code:
void Servent::slotReadyRead()
{
  char   cbuff[4096+10];

  _last_input = time(NULL);

  do
    {
      int rd = _socket->readBlock(cbuff, 4096);
      _buffer.append(cbuff, rd);
    }
  while(_socket->bytesAvailable() > 0);

  if( (state() == Waiting) && (_buffer.find("\r\n\r\n") != std::string::npos) )
    {
      _header = _buffer.substr(0, _buffer.find("\r\b\r\n"));

      std::string b = _buffer;

      if( _buffer.substr(0, 9) != "GNUTELLA/" )
	{
	  slotError(-1);
	  return;
	}

      _buffer.erase(0, 9);

      // get version

      std::string::size_type idx = _buffer.find(" ");
      if( idx == std::string::npos )
	{
	  slotError(-1);
	  return;
	}

      _version = _buffer.substr(0, idx);

      _buffer.erase(0, idx + 1); // delete version number with space from buffer

      // get status code

      idx = _buffer.find(" ");
      if( idx == std::string::npos )
	{
	  slotError(-1);
	  return;
	}

      std::string status = _buffer.substr(0, idx);
      _buffer.erase(0, idx + 1); // delete status code with space from buffer


/////////////////////// THIS IS THE MOD !!!!!!


      // keep that BS off my screen!
      idx = _buffer.find("BearShare");
      if( idx != std::string::npos )
	{
	  slotError(-1);
	  return;
	}



      // get user agent information

      idx = _buffer.find("User-Agent:");
      if( idx != std::string::npos )
	{
	  _buffer.erase(0, idx + 11);
	  idx = _buffer.find_first_not_of(" ");
	  _buffer.erase(0, idx);
	  idx = _buffer.find("\r\n");
	  _user_agent = _buffer.substr(0, idx);
	}

      if( status != "200")
	{
	  slotError(-1);
	  return;
	}

      // status code is 200 ok

      idx = _buffer.find("\r\n\r\n"); // find end of header
      _buffer.erase(0, idx + 4);      // delete header from buffer

      setState(Connected);

      std::string r("GNUTELLA/0.6 200 OK\r\n\r\n");
      sendMessageDirect(r);

      int ttl = _parent->_parent->ui_spinbox_ttl->value();
      Ping p(1, 0, _id);
      sendMessageDirect(p._data);  // send initial ping
      _parent->_statistic.out_ping_n++;
      _parent->_statistic.out_ping_b += p._data.size();
      return;
    }

  else

    while( _buffer.size() >= HEADER_SIZE )
      {
	Q_UINT32 payload  = Message::str_uint32(_buffer.substr(19, 4).data());

	if(payload > 20000)
	  {
	    _buffer.erase();
	    slotError(-1);
	    return;
	  }

	if( _buffer.size() >= (HEADER_SIZE + payload) )
	  {
	    _input++;

	    if(_message_buffer.size() < 30)
	      _message_buffer.push_back(_buffer.substr(0, HEADER_SIZE + payload));

	    _buffer.erase(0, HEADER_SIZE + payload);
	    _bytes_in += HEADER_SIZE + payload;
	  }
	else
	  return;
      }
}
Reply With Quote
  #4 (permalink)  
Old April 5th, 2002
Gentoo Linux Developer
 
Join Date: March 9th, 2002
Location: Belgium, Gent
Posts: 13
verwilst is flying high
Question

wtf?
Reply With Quote
  #5 (permalink)  
Old June 7th, 2002
Mini-God
 
Join Date: June 3rd, 2002
Location: Hell.. Literally
Posts: 241
Gamer is flying high
Default

Zip is a wonderful format you know.. So are text files
Reply With Quote
  #6 (permalink)  
Old June 8th, 2002
Gnutella Veteran
 
Join Date: March 24th, 2002
Location: Virginia
Posts: 101
tshdos is flying high
Default

Quote:
Originally posted by Gamer
Zip is a wonderful format you know.. So are text files
Unregistered users cannot post attachments.

This thread has been dead for over 2 months. Let it go.
Reply With Quote
  #7 (permalink)  
Old June 8th, 2002
Unregistered
Guest
 
Posts: n/a
Default

Has this been added to the latest release?
Reply With Quote
  #8 (permalink)  
Old June 8th, 2002
Gnutella Aficionado
 
Join Date: March 13th, 2002
Location: Aachen
Posts: 832
Taliban is flying high
Default

of course not!
Reply With Quote
  #9 (permalink)  
Old June 8th, 2002
Unregistered
Guest
 
Posts: n/a
Default

why not?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Isp Block HYDROGLOCK Connection Problems 3 June 29th, 2006 10:19 AM
The IP or some way to block it. shade11 General Gnutella / Gnutella Network Discussion 5 March 14th, 2006 11:11 AM
Block host should block them form uploading too Sleepless New Feature Requests 0 February 13th, 2006 06:47 PM
Clients blocking other clients Zultrax General Gnutella Development Discussion 5 June 1st, 2004 01:41 AM
How can i block most clients ??? Unregistered General Gnutella / Gnutella Network Discussion 2 June 24th, 2001 06:53 PM


All times are GMT -7. The time now is 06:07 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.