Why is my http call failing?

Discussion in 'Ruby' started by Thaddeus L Olczyk, Aug 19, 2006.

  1. The code is simple:

    Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    print(http.head('/yaml'))
    }

    The error I get is that an EINVAL exception was generated.

    Using telnet to preform the same request, everything seems fine.

    I am using the latest version of Ruby on Windows ( NT4 SP6 ).


    --------------------------------------------------
    Thaddeus L. Olczyk, PhD
    Think twice, code once.
     
    Thaddeus L Olczyk, Aug 19, 2006
    #1
    1. Advertising

  2. Thaddeus L Olczyk wrote:
    > The code is simple:
    >
    > Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    > print(http.head('/yaml'))
    > }
    >
    > The error I get is that an EINVAL exception was generated.
    >
    > Using telnet to preform the same request, everything seems fine.
    >
    > I am using the latest version of Ruby on Windows ( NT4 SP6 ).


    That code seems to work fine on linux with Ruby 1.8.4. I get:

    #<Net::HTTPOK:0xb7bef67c>=> nil

    And if I change to .get('/yaml').body I get the body of the page, as
    expected.

    --
    Posted via http://www.ruby-forum.com/.
     
    William Crawford, Aug 19, 2006
    #2
    1. Advertising

  3. William Crawford wrote:
    > Thaddeus L Olczyk wrote:
    >> The code is simple:
    >>
    >> Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    >> print(http.head('/yaml'))
    >> }
    >>
    >> The error I get is that an EINVAL exception was generated.
    >>
    >> Using telnet to preform the same request, everything seems fine.
    >>
    >> I am using the latest version of Ruby on Windows ( NT4 SP6 ).

    >
    > That code seems to work fine on linux with Ruby 1.8.4. I get:
    >
    > #<Net::HTTPOK:0xb7bef67c>=> nil
    >
    > And if I change to .get('/yaml').body I get the body of the page, as
    > expected.


    Works for me, too.

    Local firewall that explicitly blocks accesses from ruby and not from
    telnet? Just a wild guess...

    robert
     
    Robert Klemme, Aug 19, 2006
    #3
  4. Thaddeus L Olczyk wrote:
    > The code is simple:
    >
    > Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    > print(http.head('/yaml'))
    > }
    >
    > The error I get is that an EINVAL exception was generated.
    >
    > Using telnet to preform the same request, everything seems fine.
    >
    > I am using the latest version of Ruby on Windows ( NT4 SP6 ).


    What happens if you use a more recent version of Windows?

    --
    Posted via http://www.ruby-forum.com/.
     
    Francis Cianfrocca, Aug 19, 2006
    #4
  5. On Sat, 19 Aug 2006 12:28:28 +0200, Robert Klemme
    <> wrote:

    > everything seems fine.
    >>>
    >>> I am using the latest version of Ruby on Windows ( NT4 SP6 ).

    >>
    >> That code seems to work fine on linux with Ruby 1.8.4. I get:
    >>
    >> #<Net::HTTPOK:0xb7bef67c>=> nil
    >>
    >> And if I change to .get('/yaml').body I get the body of the page, as
    >> expected.

    >
    >Works for me, too.
    >
    >Local firewall that explicitly blocks accesses from ruby and not from
    >telnet? Just a wild guess...

    The firewall I use is zonealarm. It keeps prompting me to allow ruby
    to pass ( I keep saying yes ). In fact I even set remember this
    setting and yes. I had to remove ruby toi clear it.

    It seems to me there is some aspect of Windows networking that is
    not working right. It is something that most programs, if they use it,
    they do not rely on it. But ruby networking just relies on it. I'm
    hoping someone can tell me.

    --------------------------------------------------
    Thaddeus L. Olczyk, PhD
    Think twice, code once.
     
    Thaddeus L Olczyk, Aug 20, 2006
    #5
  6. Thaddeus L Olczyk

    James Britt Guest

    Francis Cianfrocca wrote:
    > Thaddeus L Olczyk wrote:
    >
    >>The code is simple:
    >>
    >>Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    >> print(http.head('/yaml'))
    >>}
    >>
    >>The error I get is that an EINVAL exception was generated.
    >>
    >>Using telnet to preform the same request, everything seems fine.
    >>
    >>I am using the latest version of Ruby on Windows ( NT4 SP6 ).

    >
    >
    > What happens if you use a more recent version of Windows?


    This works for me on WinXP and a somewhat recent version of Curt's
    Windows build:

    require 'net/http'

    Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    print(http.head('/yaml'))
    }
    #<Net::HTTPOK:0x2b4bff0>


    I have ZoneAlarm, but it's been tamed to allow Ruby code. I have the
    built-in Windows firewall turned off.


    --
    James Britt

    http://www.ruby-doc.org - Ruby Help & Documentation
    http://www.artima.com/rubycs/ - The Journal By & For Rubyists
    http://www.rubystuff.com - The Ruby Store for Ruby Stuff
    http://www.jamesbritt.com - Playing with Better Toys
     
    James Britt, Aug 20, 2006
    #6
  7. On Aug 19, 2006, at 4:35 PM, Thaddeus L Olczyk wrote:

    > On Sat, 19 Aug 2006 12:28:28 +0200, Robert Klemme
    > <> wrote:
    >
    >> everything seems fine.
    >>>>
    >>>> I am using the latest version of Ruby on Windows ( NT4 SP6 ).
    >>>
    >>> That code seems to work fine on linux with Ruby 1.8.4. I get:
    >>>
    >>> #<Net::HTTPOK:0xb7bef67c>=> nil
    >>>
    >>> And if I change to .get('/yaml').body I get the body of the page, as
    >>> expected.

    >>
    >> Works for me, too.
    >>
    >> Local firewall that explicitly blocks accesses from ruby and not from
    >> telnet? Just a wild guess...

    > The firewall I use is zonealarm. It keeps prompting me to allow ruby
    > to pass ( I keep saying yes ). In fact I even set remember this
    > setting and yes. I had to remove ruby toi clear it.
    >
    > It seems to me there is some aspect of Windows networking that is
    > not working right. It is something that most programs, if they use it,
    > they do not rely on it. But ruby networking just relies on it. I'm
    > hoping someone can tell me.
    >
    > --------------------------------------------------
    > Thaddeus L. Olczyk, PhD
    > Think twice, code once.
    >



    I have seen this same issue on windows before. ZoneAlarm interferes
    with ruby's socket access. You need to uninstall ZoneAlarm and it
    will work fine. Just disabling Zone Alarm will not work , you have to
    completely uninstall it.

    -Ezra
     
    Ezra Zygmuntowicz, Aug 20, 2006
    #7
  8. Thaddeus L Olczyk

    James Britt Guest

    Ezra Zygmuntowicz wrote:

    >
    > I have seen this same issue on windows before. ZoneAlarm interferes
    > with ruby's socket access. You need to uninstall ZoneAlarm and it will
    > work fine. Just disabling Zone Alarm will not work , you have to
    > completely uninstall it.


    Interesting. I have ZA installed on two different WinXP boxen, and a
    now-gone Win2k box, and never had an issue with Ruby getting out to the
    Internet.

    However, a recent version of ZA was annoying in one way or another, so I
    rolled back to a previous version. So perhaps the more current versions
    are Ruby-hostile, but it's never been an issue for me.


    --
    James Britt

    "If you don't write it down, it never happened."
    - (Unknown)
     
    James Britt, Aug 20, 2006
    #8
  9. On Aug 19, 2006, at 9:22 PM, James Britt wrote:

    > Ezra Zygmuntowicz wrote:
    >
    >> I have seen this same issue on windows before. ZoneAlarm
    >> interferes with ruby's socket access. You need to uninstall
    >> ZoneAlarm and it will work fine. Just disabling Zone Alarm will
    >> not work , you have to completely uninstall it.

    >
    > Interesting. I have ZA installed on two different WinXP boxen, and
    > a now-gone Win2k box, and never had an issue with Ruby getting out
    > to the Internet.
    >
    > However, a recent version of ZA was annoying in one way or another,
    > so I rolled back to a previous version. So perhaps the more
    > current versions are Ruby-hostile, but it's never been an issue
    > for me.
    >
    >
    > --
    > James Britt



    It has been a while since I've seen this issue as I don't use
    windows very often. But it was completely repeatable when I did have
    the issue at the end of last year.

    -Ezra
     
    Ezra Zygmuntowicz, Aug 20, 2006
    #9
  10. On Sun, 20 Aug 2006 11:32:14 +0900, in comp.lang.ruby you wrote:

    >
    >On Aug 19, 2006, at 4:35 PM, Thaddeus L Olczyk wrote:
    >
    >> On Sat, 19 Aug 2006 12:28:28 +0200, Robert Klemme
    >> <> wrote:
    >>
    >>> everything seems fine.
    >>>>>
    >>>>> I am using the latest version of Ruby on Windows ( NT4 SP6 ).
    >>>>
    >>>> That code seems to work fine on linux with Ruby 1.8.4. I get:
    >>>>
    >>>> #<Net::HTTPOK:0xb7bef67c>=> nil
    >>>>
    >>>> And if I change to .get('/yaml').body I get the body of the page, as
    >>>> expected.
    >>>
    >>> Works for me, too.
    >>>
    >>> Local firewall that explicitly blocks accesses from ruby and not from
    >>> telnet? Just a wild guess...

    >> The firewall I use is zonealarm. It keeps prompting me to allow ruby
    >> to pass ( I keep saying yes ). In fact I even set remember this
    >> setting and yes. I had to remove ruby toi clear it.
    >>
    >> It seems to me there is some aspect of Windows networking that is
    >> not working right. It is something that most programs, if they use it,
    >> they do not rely on it. But ruby networking just relies on it. I'm
    >> hoping someone can tell me.
    >>
    >> --------------------------------------------------
    >> Thaddeus L. Olczyk, PhD
    >> Think twice, code once.
    >>

    >
    >
    > I have seen this same issue on windows before. ZoneAlarm interferes
    >with ruby's socket access. You need to uninstall ZoneAlarm and it
    >will work fine. Just disabling Zone Alarm will not work , you have to
    >completely uninstall it.
    >
    >-Ezra

    Hmmm.
    Hard to say. If you disble it as a service, it should have no effect.
    Anyway I'm hesitant to disable my firewall unless I have something
    else in place. I wish there were a way ( like Posix's strace ) to
    trace system calls and see exactl;y what is going wrong.


    --------------------------------------------------
    Thaddeus L. Olczyk, PhD
    Think twice, code once.
     
    Thaddeus L Olczyk, Aug 20, 2006
    #10
  11. Thaddeus L Olczyk wrote:
    > On Sun, 20 Aug 2006 11:32:14 +0900, in comp.lang.ruby you wrote:
    >
    >> On Aug 19, 2006, at 4:35 PM, Thaddeus L Olczyk wrote:
    >>
    >>> On Sat, 19 Aug 2006 12:28:28 +0200, Robert Klemme
    >>> <> wrote:
    >>>
    >>>> everything seems fine.
    >>>>>> I am using the latest version of Ruby on Windows ( NT4 SP6 ).
    >>>>> That code seems to work fine on linux with Ruby 1.8.4. I get:
    >>>>>
    >>>>> #<Net::HTTPOK:0xb7bef67c>=> nil
    >>>>>
    >>>>> And if I change to .get('/yaml').body I get the body of the page, as
    >>>>> expected.
    >>>> Works for me, too.
    >>>>
    >>>> Local firewall that explicitly blocks accesses from ruby and not from
    >>>> telnet? Just a wild guess...
    >>> The firewall I use is zonealarm. It keeps prompting me to allow ruby
    >>> to pass ( I keep saying yes ). In fact I even set remember this
    >>> setting and yes. I had to remove ruby toi clear it.
    >>>
    >>> It seems to me there is some aspect of Windows networking that is
    >>> not working right. It is something that most programs, if they use it,
    >>> they do not rely on it. But ruby networking just relies on it. I'm
    >>> hoping someone can tell me.
    >>>
    >>> --------------------------------------------------
    >>> Thaddeus L. Olczyk, PhD
    >>> Think twice, code once.
    >>>

    >>
    >> I have seen this same issue on windows before. ZoneAlarm interferes
    >> with ruby's socket access. You need to uninstall ZoneAlarm and it
    >> will work fine. Just disabling Zone Alarm will not work , you have to
    >> completely uninstall it.
    >>
    >> -Ezra

    > Hmmm.
    > Hard to say. If you disble it as a service, it should have no effect.
    > Anyway I'm hesitant to disable my firewall unless I have something
    > else in place. I wish there were a way ( like Posix's strace ) to
    > trace system calls and see exactl;y what is going wrong.


    You can try Kerio Personal Firewall - personally I like it better than
    ZA because it offers more precise control IMHO (disclaimer: I haven't
    tested ZA thoroughly so I may have missed some advanced features).

    http://www.sunbelt-software.com/Kerio.cfm

    Kind regards

    robert
     
    Robert Klemme, Aug 20, 2006
    #11
  12. On Sun, 20 Aug 2006 10:45:04 +0200, Robert Klemme
    <> wrote:

    >Thaddeus L Olczyk wrote:
    >> On Sun, 20 Aug 2006 11:32:14 +0900, in comp.lang.ruby you wrote:
    >>
    >>> On Aug 19, 2006, at 4:35 PM, Thaddeus L Olczyk wrote:
    >>>
    >>>> On Sat, 19 Aug 2006 12:28:28 +0200, Robert Klemme
    >>>> <> wrote:
    >>>>
    >>>>> everything seems fine.
    >>>>>>> I am using the latest version of Ruby on Windows ( NT4 SP6 ).
    >>>>>> That code seems to work fine on linux with Ruby 1.8.4. I get:
    >>>>>>
    >>>>>> #<Net::HTTPOK:0xb7bef67c>=> nil
    >>>>>>
    >>>>>> And if I change to .get('/yaml').body I get the body of the page, as
    >>>>>> expected.
    >>>>> Works for me, too.
    >>>>>
    >>>>> Local firewall that explicitly blocks accesses from ruby and not from
    >>>>> telnet? Just a wild guess...
    >>>> The firewall I use is zonealarm. It keeps prompting me to allow ruby
    >>>> to pass ( I keep saying yes ). In fact I even set remember this
    >>>> setting and yes. I had to remove ruby toi clear it.
    >>>>
    >>>> It seems to me there is some aspect of Windows networking that is
    >>>> not working right. It is something that most programs, if they use it,
    >>>> they do not rely on it. But ruby networking just relies on it. I'm
    >>>> hoping someone can tell me.
    >>>>
    >>>> --------------------------------------------------
    >>>> Thaddeus L. Olczyk, PhD
    >>>> Think twice, code once.
    >>>>
    >>>
    >>> I have seen this same issue on windows before. ZoneAlarm interferes
    >>> with ruby's socket access. You need to uninstall ZoneAlarm and it
    >>> will work fine. Just disabling Zone Alarm will not work , you have to
    >>> completely uninstall it.
    >>>
    >>> -Ezra

    >> Hmmm.
    >> Hard to say. If you disble it as a service, it should have no effect.
    >> Anyway I'm hesitant to disable my firewall unless I have something
    >> else in place. I wish there were a way ( like Posix's strace ) to
    >> trace system calls and see exactl;y what is going wrong.

    >
    >You can try Kerio Personal Firewall - personally I like it better than
    >ZA because it offers more precise control IMHO (disclaimer: I haven't
    >tested ZA thoroughly so I may have missed some advanced features).
    >
    >http://www.sunbelt-software.com/Kerio.cfm
    >
    >Kind regards
    >
    > robert

    I removed ZA and installed Sygate. No difference.
    (Before and after I installed Sygate. )

    --------------------------------------------------
    Thaddeus L. Olczyk, PhD
    Think twice, code once.
     
    Thaddeus L Olczyk, Aug 21, 2006
    #12
  13. EINVAL and C calls (Was: Why is my http call failing?)

    I've gone further. This following call snippet fails:

    require 'socket'

    t=TCPSocket.open("code.whytheluckystiff.net",80)
    str1='GET /yaml HTTP/1.1\r\n\r\n'
    t.write(str1)

    of course with an EINVAL error.

    AFAIC write a calling a C function. So why would calling
    a C function cause a EINVAL ( this is not rhetorical ).

    I believe earlier calls have probably been executed earlier in the
    same library ( the open works ).

    Suggestions?

    On Sat, 19 Aug 2006 09:44:16 GMT, Thaddeus L Olczyk <>
    wrote:

    >The code is simple:
    >
    >Net::HTTP.start("code.whytheluckystiff.net",80) { |http|
    > print(http.head('/yaml'))
    >}
    >
    >The error I get is that an EINVAL exception was generated.
    >
    >Using telnet to preform the same request, everything seems fine.
    >
    >I am using the latest version of Ruby on Windows ( NT4 SP6 ).

    Let me add that it is the one click installer available from rubyforge
    --------------------------------------------------
    Thaddeus L. Olczyk, PhD
    Think twice, code once.
     
    Thaddeus L Olczyk, Aug 25, 2006
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Ohlund

    PDL function call failing

    Mark Ohlund, May 2, 2004, in forum: Perl
    Replies:
    1
    Views:
    477
    Slaven Rezic
    May 2, 2004
  2. John Burke
    Replies:
    2
    Views:
    1,501
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    903
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,966
    Smokey Grindel
    Dec 2, 2006
  5. Replies:
    0
    Views:
    113
Loading...

Share This Page