473,698 Members | 2,242 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Net::HTTP URI.parse

4 New Member
HI All,

i am new to ROR

i am writing Ruby code for calling API blogs

i have written ruby code for

creating a attachment xml by
Expand|Select|Wrap|Line Numbers
  1. require 'net/http'
  2. require 'uri'
  3.  
  4. url = URI.parse('https://localhost:3000/api/attachment/create.xml')
  5. req = Net::HTTP::Post.new(url.path)
  6. req.basic_auth 'a', 'a'
  7.  
  8. res = Net::HTTP.new(url.host, url.port).start {|http|
  9. http.request(req)}
  10.  
  11. case res
  12.   when Net::HTTPSuccess, Net::HTTPRedirection
  13.     puts res.body
  14.   else
  15.     res.error!
  16. end
  17.  
Actually this works fine wth http protocol,

My site is hosted in https protocol, can https protocol can be used in
the below format. if i try to convert this kind of URL i get a error
as

SocketError: getaddrinfo: Temporary failure in name resolution

plz help me in this
Jan 8 '11 #1
1 4658
numberwhun
3,509 Recognized Expert Moderator Specialist
To parse an HTTPS connection, you are going to want to use:

Expand|Select|Wrap|Line Numbers
  1. require "net/https"
  2.  
There is an example on this cheat sheet page.

There is also another example .

Regards,

Jeff
Jan 17 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6818
by: Kevin Kenny | last post by:
Dear All, I have a date time validation method thus: public static bool IsDate(string date, System.IFormatProvider provider) { try { DateTime.Parse(date, provider) return true; } catch (System.FormatException) return false;
3
1447
by: thomson | last post by:
Hi all, please help me out "IF 25000 users request a yahoo page, will 25000 sockets will be created" For the Server to know which client has requested what there has to be a socket with the client port no and IP address with the server port no and IP address. This is my knowledge.
4
1379
by: skOOb33 | last post by:
I am suspicious of the websites that the people I live with are using my computer for. Instead of buying software or downloading something visible to other users, I am wanting to create a vb program that "watches" what websites are visited. Since I have a background in vb, I see this to be easier. There are different accounts on the computer which I can access, I am thinking I will set this program up to start in the background and...
2
1723
by: PJ6 | last post by:
I can probably code this up manually myself but I'd prefer to use a built-in method that I'm sure exists... I have a message box client-side control (thanks, Steve Orr) that uses the JavaScript alert() method to pass text to a user in a dialogue box. Often I have messages containing text that JavaScript doesn't like, like single quote characters. Does ASP.NET have a method to parse text for JavaScript? Server.HTMLEncode doesn't seem to do...
0
4342
by: Divyakumar Jain,SAP Netweaver consultant | last post by:
Hi all, I have created an web service on SAP system. I have created a .net client using Micrsoft Visual Studio 2003 and .net frame work 2.0. in Visual Basic. In that .net client i have created web refrence for the web service. When i call the web service without using WSE 2.0 API i get following SOAP Fault message from the web service.
0
896
by: Friso Wiskerke | last post by:
Hi all, Instead of placing the Javascript in an page we've put the script in a separate .js file and reference it from the page where it's being used using a <script language="js" src="js/myscript.js" type="text/javascript"> tag. This works fine in regular sites but when you want to use master pages, what ofcourse we want, it will not function anymore. We encoutered the phenomenon called "name mangling" when using master pages. To...
1
6928
by: John Braham | last post by:
I have a slight wall headbutter which I'm hoping someone will have an idea for (I'd be very grateful!). Basically I'm trying to make a form post to an asp page programatically from within VB.NET 2005, the only data posted is one hidden field XMLDOC, which contains an xml file which the receiving page will respond to... I know, it's not a great way of doing this... I know I should be using a web service, but basically this is the way I...
1
1167
by: Morgan Cheng | last post by:
If a web server HTTP response is in chunked encoding, CLR client invocation on HttpWebResponse.Close will not return until the whole page is downloaded. If the page is huge, it looks the thread is stuck in HttpWebResponse.Close. An example URL is http://wx.msn.com. This might be a bug for CLR. I tried both 1.1 and 2.0. With the help of network sniffer, I found that CLR doesn't have RESET flag on invocation of HttpWebResponse.Close if the...
0
804
by: | last post by:
I regularly scrape content from sites that require cookie information for auth. When I am on a dev machine using VS.NET and test my scraping tools, the returned content indicates that the webpage login is me. Question #1: When I deploy my tools to a server, what user does the system "impersonate" for the purposes of browsing? Question #2: Could I log into the user account described in Q1, use IE for awhile, persist cookies via "Remember...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.