×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    http filter - what's this used for?

    sample code :
    http://www.developer.nokia.com/Commu...terExample.zip

    here is the main class
    class CSampleFilter : public CEComFilter, public MHTTPFilter, public MHTTPDataSupplier

    my question:
    Will this filter all the out-going http request? either from browser or other third-party application?
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: http filter - what's this used for?

    Yes, it filters all requests which are made using the HTTP framework (RHTTPXy classes).

  3. #3
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: http filter - what's this used for?

    Also provided of course that the HTTP filter does have capabilities defined that include all capabilities defined for the loading process. Basically if it does not have, then it will not be loaded for the process doing the HTTP query, and of course it then will not get thoes transactions.

  4. #4
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: http filter - what's this used for?

    I signed the sis file in the link, and I tested with N8. the filter plugin is loaded when I am browsing the web page(http request), but why in the log file, no http request uri is printed. Only the plugin is load and unloaded printed.
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: http filter - what's this used for?

    I suppose that example only has one log file, thus it would need to be changed in a way that it dynamically names the log file. Currently depending on the device, it might get the download manager to be loaded first, which indeed means tat you don't get logs from the Web browser.

  6. #6
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: http filter - what's this used for?

    I have two browser in N8. One is the nokia built-in browser, one is the brower that I download from the OVI(also nokia browser). The OVi browser works fine, all the http request is logged, but why the nokia built-in borwser does not work?
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: http filter - what's this used for?

    please read #5 and understand that the logging is faulty.

  8. #8
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: http filter - what's this used for?

    OK, I replace the log file with the RDebug::Print. The browser dwonloaded from ovi works well, all the out-going http are printed. But the build-in browser printed
    "Looadd me"
    "Unloaded"
    "Bye bye"

    This means, MHFRunL function is not called. Or Maybe the dll is not loaded.

    I use the All -Tcb capability
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  9. #9
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: http filter - what's this used for?

    I would suggest re-checking it still, I have never had problems with build in browser on any versions of the platform, also feel free to check inside the plug-in that which process actually loaded you.

  10. #10
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: http filter - what's this used for?

    Here is the code, not too much:

    #include <e32base.h>
    #include <f32file.h>
    #include <e32debug.h>

    //#include <mw/eikenv.h>
    #include <ecom/ecom.h>
    #include <ecom/implementationproxy.h>
    #include <mw/http/cecomfilter.h>
    #include <mw/http/mhttpfilter.h>
    #include <mw/http/rhttptransaction.h>
    #include <mw/http/mhttpdatasupplier.h>
    #include <mw/http/thttpfilteriterator.h>
    #include <mw/http/rhttpheaders.h>

    // CONSTANTS
    const TInt KMaxHeaderNameLength = 32;
    const TInt KMaxHeaderValueLength = 128;
    const TInt KBufSize = 32;

    _LIT8(KSampleFilterName, "SampleFilter");

    class CSampleFilter : public CEComFilter, public MHTTPFilter, public MHTTPDataSupplier
    {
    public:
    static CEComFilter* CreateFilterL(TAny* aHttpSession);

    // virtuals from the HTTP filter M classes
    void MHFUnload(RHTTPSession aSession, THTTPFilterHandle aHandle);
    void MHFLoad(RHTTPSession aSession, THTTPFilterHandle aHandle);
    void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
    void MHFSessionRunL(const THTTPSessionEvent& aEvent);
    TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
    TInt MHFSessionRunError(TInt aError, const THTTPSessionEvent& aEvent);

    // methods inherited from MHTTPDataSupplier
    TBool GetNextDataPart(TPtrC8& aDataPart);
    TInt OverallDataSize();
    void ReleaseData();
    TInt Reset();

    ~CSampleFilter();
    private:
    void ConstructL(RHTTPSession& aHttpSession);

    private:
    THTTPFilterHandle iFilterHandle;
    RStringF iFilterName;
    TBool isLast;
    HBufC8* iPostData;
    TInt iOverallDataSize;
    MHTTPDataSupplier* iBody;
    };

    CEComFilter* CSampleFilter::CreateFilterL(TAny* aHttpSession)
    {
    // The CEcomFilter class passes us a pointer to the RHTTPSession so we can install ourselves
    RHTTPSession* session = reinterpret_cast<RHTTPSession*>(aHttpSession);
    CSampleFilter* self = new (ELeave) CSampleFilter;
    CleanupStack::PushL(self);
    self->ConstructL(*session);
    CleanupStack::Pop(self);

    return self;
    }

    CSampleFilter::~CSampleFilter()
    {

    RDebug::Printf("Bye bye\n");
    if(iPostData)
    {
    delete iPostData;
    iPostData = 0;
    }
    iFilterName.Close();
    }

    // install this filter in to the current session
    void CSampleFilter::ConstructL(RHTTPSession& aSession)
    {
    iFilterName = aSession.StringPool().OpenFStringL(KSampleFilterName);
    aSession.FilterCollection().AddFilterL(*this, THTTPEvent::EAnyTransactionEvent,
    RStringF(), KAnyStatusCode, EClientFilters, iFilterName);
    }


    void CSampleFilter::MHFUnload(RHTTPSession aSession, THTTPFilterHandle aHandle)
    {
    RDebug::Printf("Unloaded\n");
    delete this;
    }


    void CSampleFilter::MHFLoad(RHTTPSession aSession, THTTPFilterHandle aHandle)
    {
    iFilterHandle = aHandle;
    RDebug::Printf("Looadd me\n");
    }

    void CSampleFilter::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
    {
    RDebug::Printf("http transaction is entered\n");
    TBuf8<255> hejlpper;
    TInt errNo(KErrNone);

    switch ( aEvent.iStatus )
    {
    case THTTPEvent::ESubmit:
    {
    const TDesC8& my_uri = aTransaction.Request().URI().UriDes();
    RDebug::Printf("Demo Filter: New transaction submitted, URI: %S", &my_uri);
    }
    break;

    default:

    {
    RDebug::Printf("other THTTPEvent\n");
    }
    break;
    }
    }

    void CSampleFilter::MHFSessionRunL(const THTTPSessionEvent& aEvent)
    {
    RDebug::Printf("MHFSessionRunL\n");
    }

    TInt CSampleFilter::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent)
    {
    RDebug::Printf("MHFRunError\n");
    return KErrNone;
    }

    TInt CSampleFilter::MHFSessionRunError(TInt aError, const THTTPSessionEvent& aEvent)
    {
    RDebug::Printf("MHFSessionRunError\n");
    return KErrNone;
    }

    // The standard ECOM initialisation stuff

    const TImplementationProxy KImplementationTable[] =
    {
    IMPLEMENTATION_PROXY_ENTRY(0xA00033E4, CSampleFilter::CreateFilterL)
    };

    EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
    {
    aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
    return KImplementationTable;
    }

    //Over-ridden function of MHTTPDataSupplier
    TInt CSampleFilter::OverallDataSize()
    {
    return iOverallDataSize;
    }

    //Over-ridden function of MHTTPDataSupplier
    void CSampleFilter::ReleaseData()
    {
    RDebug::Printf("ReleaseData\n");

    if(iBody)
    {
    iBody->ReleaseData();
    }

    if(iPostData)
    {
    delete iPostData;
    iPostData = 0;
    }
    }

    TInt CSampleFilter::Reset()
    {
    RDebug::Printf("Reset\n");
    return KErrNone;
    }

    //Over-ridden function of MHTTPDataSupplier
    TBool CSampleFilter::GetNextDataPart(TPtrC8& aDataPart)
    {
    RDebug::Printf("GetNextDataPart\n");
    if(iPostData)
    {
    aDataPart.Set(iPostData->Des());
    }
    return isLast;
    }
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  11. #11
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: http filter - what's this used for?

    Quote Originally Posted by symbianyucca View Post
    I would suggest re-checking it still, I have never had problems with build in browser on any versions of the platform, also feel free to check inside the plug-in that which process actually loaded you.
    It is the DownloadMgrServer that load the dll, I guess.
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  12. #12
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: http filter - what's this used for?

    It often rather pointless to help people who don't do what was asked. As you noticed, you did again look into a wrong process, so please do try paying attention on what has been suggested. You could have saved couple of days by actually trying what was suggested, all and all, I did update the example, so this should not come up again in the future.

    Anyway, please in future, do try what is suggested, and see that you actually get it done in correct way.

  13. #13
    Super Contributor
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190

    Re: http filter - what's this used for?

    Quote Originally Posted by symbianyucca View Post
    It often rather pointless to help people who don't do what was asked. As you noticed, you did again look into a wrong process, so please do try paying attention on what has been suggested. You could have saved couple of days by actually trying what was suggested, all and all, I did update the example, so this should not come up again in the future.

    Anyway, please in future, do try what is suggested, and see that you actually get it done in correct way.
    I am afraid of you.
    and for the RDebug, it also works now. that is because the debug tools have problem.
    [I][COLOR="Orange"]xhsoldier[/COLOR][/I]
    [email]xhsoldier@gmail.com[/email]/[email]xhsoldier@163.com[/email]

  14. #14
    Registered User
    Join Date
    Apr 2013
    Posts
    4

    Re: http filter - what's this used for?

    On which version the sample code is for? I am trying to Run it on Emulator of S60 5th Ed and application is getting terminated immediately on doing Run.

  15. #15
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: http filter - what's this used for?

    That should work on S60 5th Ed.Try launching the emulator & open app it by clicking on the app icon rather then directly launching the exe & see what crash message you get.

Similar Threads

  1. Http filter to modify out going http request .
    By redzvika in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2010-05-02, 14:49
  2. http filter
    By tulimiero in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2009-03-23, 15:51
  3. Using Http Filter
    By tulimiero in forum Symbian
    Replies: 0
    Last Post: 2009-03-05, 16:11
  4. How to get the URL with HTTP filter
    By liuxingyu_best in forum Symbian Networking & Messaging (Closed)
    Replies: 18
    Last Post: 2008-10-21, 17:50
  5. Replies: 2
    Last Post: 2008-09-30, 11:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×