Hey guys ,

  I'm writing an extension which needs to do a  Google Account
Authentication [
http://code.google.com/apis/accounts/AuthForInstalledApps.html]
I'm having a bit of trouble establishing a HTTP connection (basically
make a POST to the google serverl) from  the extension using javascript
and xpcom
Let me first outline what I'm currently doing and then ask my
questions.
 Here are the steps involved as I see it :

Establish channel
---------------------------

* Covert target url string to nsIURI [using newURI method from
nsIIOService]
* Create a channel from the Uri [using newChannelFromURI method from
nsIIOService]

Create Listener
-------------------
*A streamListener implementing the following functions :
onStartRequest, onDataAvailable  , onStopRequest , onChannelRedirect ,
getInterface , onProgress , onStatus , onRedirect and QueryInterface
*Specify a callback function for this listener

Open channel
------------------
*Open channel specifying a listener I created as parameter ; using the
asyncOpen method on the channel object.

Create InputStream
---------------------------
* of type nsIStringInputStream
* add data to the stream using the setData method

Create upload channel
------------------------------
* of type nsIUploadChannel
* Call setUpload stream method with the created input stream as
parameter

*****************************************************************************************************8

Questions :

* Have I got the steps right ? Am I overdoing/missing something ?
* For making a HTTP connection, I would guess the nsIHttpChannel has to
be involved somehow ; but I am not currently using it anywhere in my
code . Where would I use it ?
* The steps outlined so far establish are for sending data ; how do I
get back error messages/acknowledgements from the server after POSTing
?
* Is it ok if i cross-post this in the dev-extensions and the dev-mdc
groups or is that frowned upon ?:)

Am a n00b, so please be nice :)

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to