Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

string FlickrNet::Flickr::DoGetResponse ( string  url  )  [inline, private]

A private method which performs the actual HTTP web request if the details are not found within the cache.

Parameters:
url The URL to download.
Returns:
A FlickrNet.Response object.

Definition at line 276 of file Flickr.cs.

References HttpTimeout, and Proxy.

            {
                  HttpWebRequest req = null;
                  HttpWebResponse res = null;

                  // Initialise the web request
                  req = (HttpWebRequest)HttpWebRequest.Create(url);
                  req.Method = "POST";
                  req.ContentLength = 0;
                  req.UserAgent = UserAgent;
                  req.Proxy = Proxy;
                  req.Timeout = HttpTimeout;
                  req.KeepAlive = false;

                  try
                  {
                        // Get response from the internet
                        res = (HttpWebResponse)req.GetResponse();
                  }
                  catch(WebException ex)
                  {
                        if( ex.Status == WebExceptionStatus.ProtocolError )
                        {
                              HttpWebResponse res2 = (HttpWebResponse)ex.Response;
                              if( res2 != null )
                              {
                                    throw new FlickrException((int)res2.StatusCode, res2.StatusDescription);
                              }
                        }
                        throw new FlickrException(9999, ex.Message);
                  }

                  string responseString = string.Empty;

                  using (StreamReader sr = new StreamReader(res.GetResponseStream()))
                  {
                        responseString = sr.ReadToEnd();
                  }

                  return responseString;
            }


Generated by  Doxygen 1.6.0   Back to index