Subscribe

Useragent

  1. 2009-09-10 09:06:05 PDT
    Hello,is there a way to make that the xbt tracker return the useragent to the tracker?
    I've seen that in the revision 1982 the source code is very different from the older,like the 2007 edition,so I don't know how to detect the useragent in the 1982 revision.
    How to fix this?
  2. 2009-09-10 09:18:58 PDT
    You'll have to update the code you had.
  3. 2009-09-10 09:26:50 PDT
    Yes,I've tried,but without successfull.
    I've tried to do this:
    add std::string m_agent; into connection.h
    add case 3:
    {
    std::string v(reinterpret_cast<const char*>(b), a - b);
    if (boost::istarts_with(v, "user-agent:"))
    m_agent = boost::trim_copy(v.substr(11));
    }
    m_state += *a == '\n' ? 2 : 1;
    break;
    and
    ti.m_agent = m_agent;

    into connection.cpp in the correct position.
    But it doesn't work,when the tracker update the useragent table into the db,it create a blank space and I don't know why.

    Does my method is correct or is there another one?
  4. 2009-09-10 09:37:46 PDT
    More code than that is needed, it doesn't automagically copy it into the DB.
  5. 2009-09-10 09:46:17 PDT
    Yes,of course,into server.cpp I've added in the query
    m_database.query("insert into " + table_name(table_files_users)......
    ...
    ...
    + " useragent = values(m_agent),"
    ...
    But,the problem is into the connection.cpp in my opinion,because the different code is only in connection.h and connection.cpp
    Do you know how to make thata m_agent contains the correct value of the useragent?
    The update to the db is correct,because I've added others many mods,and all works good.
  6. 2009-09-10 09:47:09 PDT
    Don't know. Just debug the code and fix it. :p
  7. 2009-09-10 09:50:39 PDT
    How can I debug it to fix it?
  8. 2009-09-10 10:09:52 PDT
    lol, I know what debug meaning,i asked you if there was a way to use a xbt debugging tool,to see all the variables and other problems.
  9. 2010-12-17 12:19:37 PST
    what is b std::string v(reinterpret_cast<const char*>(b), a - b);
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.