1

Topic: Asynchronous Pluggable Protocol http-headings, post and put the data

All greetings! Started to understand with connected protocols. The filter was necessary. But after article Asynchronous Pluggable Protocol the Author (): Vadim Makutin Data: 6/12/2004 Understands creation and operation of own Internet protocol, the example of the application using such . how much is resulted it is an interesting piece. It is possible to take the data whence you want, and WebBrowser them displays. However in article it is not described as to inform WebBrowser in what format the data is transferred. Therefore I ask to help to understand with following questions: 1. How to inform WebBrowser, what the data it is page html or a picture png, or xml? In http protocol it does appropriate title - Content-type. How to transfer such title (and other titles of the http-report) in WebBrowser? 2. How to receive completely title of request of the http-report which sends WebBrowser and POST, PUT the data? Here I got to the bottom that this information can be learned through IInternetBindInfo, but for example, GetBindString does not return the full title and some separate, such as UserAgent or version OS. As to GetBindInfo clarified that POST and PUT the data is in the field stgmedData structures BINDINFO, and further a dark.

2

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, east, you wrote: E> 1. How to inform WebBrowser, what the data it is page html or a picture png, or xml? In http protocol it does appropriate title - Content-type. How to transfer such title (and other titles of the http-report) in WebBrowser? IProtocolSink. ReportProgress (BINDSTATUS_MIMETYPEAVAILABLE, MIMEType). IProtocolSink it is transferred in IInternetProtocolRoot. Start E> 2. How to receive completely title of request of the http-report which sends WebBrowser and POST, PUT the data? Here I got to the bottom that this information can be learned through IInternetBindInfo, but for example, GetBindString does not return the full title and some separate, such as UserAgent or version OS. As to GetBindInfo clarified that POST and PUT the data is in the field stgmedData structures BINDINFO, and further a dark. Imho, WebBrowser is not obliged to give a line BINDSTRING_USERAGENT. Everyones UserAgent is a specificity http (s). At you after all not http (s)?

3

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, Aniskin, you wrote: A> Hello, east, you wrote: E>> 1. How to inform WebBrowser, what the data it is page html or a picture png, or xml? In http protocol it does appropriate title - Content-type. How to transfer such title (and other titles of the http-report) in WebBrowser? A> IProtocolSink. ReportProgress (BINDSTATUS_MIMETYPEAVAILABLE, MIMEType). IProtocolSink it is transferred in IInternetProtocolRoot. Start Thanks! The main thing already in any code saw it and did not understand. E>> 2. How to receive completely title of request of the http-report which sends WebBrowser and POST, PUT the data? Here I got to the bottom that this information can be learned through IInternetBindInfo, but for example, GetBindString does not return the full title and some separate, such as UserAgent or version OS. As to GetBindInfo clarified that POST and PUT the data is in the field stgmedData structures BINDINFO, and further a dark. A> Imho, WebBrowser is not obliged to give a line BINDSTRING_USERAGENT. Everyones UserAgent is a specificity http (s). At you after all not http (s)? It is not critical, I for the general education asked, since it is not clear to enter what for some listings if them not to use. I can be mistaken, but for  and  on the basis of  the title is installed in Internet session from the register. Thanks for the help.

4

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, east, you wrote: A>> Imho, WebBrowser is not obliged to give a line BINDSTRING_USERAGENT. Everyones UserAgent is a specificity http (s). At you after all not http (s)? E> It is not critical, I for the general education asked, since it is not clear to enter what for some listings if them not to use. Did not check, but it is possible if you write and will superimpose standard http the protocol to you will be transferred UserAgent and other attributes http the protocol.

5

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

In general started to do the protocol and came up against such situation. In method Start I load the data in the buffer and I inform the browser that there is data. In method Read I give the data. However after several calls Read the browser creates again object of the protocol and on the new causes method Start. It turns out that the data completely did not boot in the browser and new session began. What can be? Who can prompts good  on asynchronous protocols that all trifles were described.

6

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, east, you wrote: E> In method Start I load the data in the buffer and I inform the browser that there is data. In method Read I give the data. However after several calls Read the browser creates again object of the protocol and on the new causes method Start. It turns out that the data completely did not boot in the browser and new session began. What can be? And as in what sequence you transfer in ProtocolSink. ReportProgress?

7

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, Aniskin, you wrote: A> Hello, east, you wrote: E>> In method Start I load the data in the buffer and I inform the browser that there is data. In method Read I give the data. However after several calls Read the browser creates again object of the protocol and on the new causes method Start. It turns out that the data completely did not boot in the browser and new session began. What can be? A> and as in what sequence you transfer in ProtocolSink. ReportProgress? Simply I transfer mime-type. The code about such, precisely I do not remember, since the project on other computer. HRESULT STDMETHODCALLTYPE CMyProtocol:: Start (/* [in] */LPCWSTR szUrl,/* [in] */IInternetProtocolSink __ RPC_FAR *pOIProtSink,/* [in] */IInternetBindInfo __ RPC_FAR *pOIBindInfo,/* [in] */DWORD grfPI,/* [in] */DWORD dwReserved) {ATLTRACE (_T ("CMyProtocol:: Start () \n"));//it is loaded the data m_BD.Load (szUrl); pOIProtSink-> ReportProgress (BINDSTATUS_MIMETYPEAVAILABLE, m_BD.m_sMimeType);//it is informed on that that is what to display pOIProtSink-> ReportData (BSCF_FIRSTDATANOTIFICATION, 0, m_BD.m_DataLen); return S_OK;}

8

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, east, you wrote: E> the Code about the such. BindInfo can contain flag BINDF_NEEDFILE. In this case it is required to create a temporary file in which it is necessary to write down the transmittable data. I normally write to the Explorer cache (CreateUrlCacheEntry/CommitUrlCacheEntry).

9

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, Aniskin, you wrote: A> BindInfo can contain flag BINDF_NEEDFILE. In this case it is required to create a temporary file in which it is necessary to write down the transmittable data. I normally write to the Explorer cache (CreateUrlCacheEntry/CommitUrlCacheEntry). I.e. to write down the data in  and not to inform, what the data is ready, that was not caused Read? Or how? Though judging by article the Author (: Vadim Makutin Data: 6/12/2004 Understands creation and operation of own Internet protocol, the example of the application using such . is resulted it should be simple, as I made. All works normally when data it is not enough, but when of them 20, there is a situation described above. Where generally it is possible to esteem about operation of the asynchronous protocol on more detailed? Can at whom there is a code of normally operating protocol? And that in a network found pair of variants, anything there did not understand and to understand there is no possibility since do not work, produce errors.

10

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, east, you wrote: E> I.e. to write down the data in  and not to inform, what the data is ready, that was not caused Read? To inform that there is a file call ProtocolSink. ReportProgress (BINDSTATUS_CACHEFILENAMEAVAILABLE), and at arrival given to write them in this file. Thus if Read it is caused, and to give data retrieveds. I do following calls: ProtocolSink. ReportProgress (BINDSTATUS_FINDINGRESOURCE, PWideChar (Url)); ProtocolSink. ReportProgress (BINDSTATUS_CONNECTING, PWideChar (Url)); ProtocolSink. ReportProgress (BINDSTATUS_SENDINGREQUEST, PWideChar (Url)); ProtocolSink. ReportProgress (BINDSTATUS_MIMETYPEAVAILABLE, PWideChar (Response. MIMEType)); ProtocolSink. ReportProgress (BINDSTATUS_CACHEFILENAMEAVAILABLE, PWideChar (Stream. FileName)); ProtocolSink. ReportData (BSCF_FIRSTDATANOTIFICATION, 0, 0); ProtocolSink. ReportData (BSCF_INTERMEDIATEDATANOTIFICATION, Saved, Size);//Many times ProtocolSink. ReportData (BSCF_LASTDATANOTIFICATION or BSCF_DATAFULLYAVAILABLE, Saved, Size); ProtocolSink. ReportResult (S_OK, Response. Status, nil); All it happens from a separate flow.

11

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

Hello, Aniskin, you wrote: A> to Inform that there is a file call ProtocolSink. ReportProgress (BINDSTATUS_CACHEFILENAMEAVAILABLE), and at arrival given to write them in this file. Thus if Read it is caused, and to give data retrieveds. A> I do following calls: A> ProtocolSink. ReportProgress (BINDSTATUS_FINDINGRESOURCE, PWideChar (Url)); A> ProtocolSink. ReportProgress (BINDSTATUS_CONNECTING, PWideChar (Url)); A> ProtocolSink. ReportProgress (BINDSTATUS_SENDINGREQUEST, PWideChar (Url)); A> ProtocolSink. ReportProgress (BINDSTATUS_MIMETYPEAVAILABLE, PWideChar (Response. MIMEType)); A> ProtocolSink. ReportProgress (BINDSTATUS_CACHEFILENAMEAVAILABLE, PWideChar (Stream. FileName)); A> ProtocolSink. ReportData (BSCF_FIRSTDATANOTIFICATION, 0, 0); A> ProtocolSink. ReportData (BSCF_INTERMEDIATEDATANOTIFICATION, Saved, Size);//Many times A> ProtocolSink. ReportData (BSCF_LASTDATANOTIFICATION or BSCF_DATAFULLYAVAILABLE, Saved, Size); A> ProtocolSink. ReportResult (S_OK, Response. Status, nil); A> All it happens from a separate flow. In general here it I carried out a separate flow static UINT LoadSrc (LPVOID pParam) {THREAD* pLoad = (THREAD *) pParam; pLoad-> pSink-> ReportProgress (BINDSTATUS_CONNECTING, pLoad-> sUrl); pLoad-> pSink-> ReportProgress (BINDSTATUS_SENDINGREQUEST, pLoad-> sUrl); pLoad-> pSink-> ReportProgress (BINDSTATUS_BEGINDOWNLOADDATA, pLoad-> sUrl); pLoad-> BD-> Send (pLoad-> sUrl); CString ct = pLoad-> BD-> GetRawHeader (_T ("Content-Type:")); pLoad-> pSink-> ReportProgress (BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, ct); pLoad-> pSink-> ReportData (BSCF_DATAFULLYAVAILABLE, 0, pLoad-> BD-> m_ulDataLen); pLoad-> pSink-> ReportResult (S_OK, 0, NULL); return 0;} As one would expect, changed nothing. All the same the browser two times causes method Start in different flows. Such situation if in Start simply to return S_OK the browser hangs is watched. If to cause ReportData or ReportResult Start the second time in other flow is caused and therefore all remaining methods and as consequence page are caused is not found also errors. Can at whom there is a working code of the asynchronous protocol?

12

Re: Asynchronous Pluggable Protocol http-headings, post and put the data

E> in general here it I carried out separate flow E> E> static UINT LoadSrc (LPVOID pParam) E> {E> THREAD* pLoad = (THREAD *) pParam; E> pLoad-> pSink-> ReportProgress (BINDSTATUS_CONNECTING, pLoad-> sUrl); E> pLoad-> pSink-> ReportProgress (BINDSTATUS_SENDINGREQUEST, pLoad-> sUrl); E> pLoad-> pSink-> ReportProgress (BINDSTATUS_BEGINDOWNLOADDATA, pLoad-> sUrl); E> pLoad-> BD-> Send (pLoad-> sUrl); E> CString ct = pLoad-> BD-> GetRawHeader (_T ("Content-Type:" )); E> pLoad-> pSink-> ReportProgress (BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, ct); E> pLoad-> pSink-> ReportData (BSCF_DATAFULLYAVAILABLE, 0, pLoad-> BD-> m_ulDataLen); E> pLoad-> pSink-> ReportResult (S_OK, 0, NULL); E> return 0; E>} E> E> As one would expect, changed nothing. All the same the browser two times causes method Start in different flows. Such situation if in Start simply to return S_OK the browser hangs is watched. If to cause ReportData or ReportResult Start the second time in other flow is caused and therefore all remaining methods and as consequence page are caused is not found also errors. E> can at whom there is a working code of the asynchronous protocol? As it is not a shame to recognize, but the error at me was in other place. Incorrectly received mime-type. Here because of it and  errors. The above-stated code works normally while glitches did not note. It is possible to deduce it both in a separate flow, and in method Start.