Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6959083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:13:31+00:00 2026-05-27T15:13:31+00:00

I am trying to communicate with a badly designed web server, but still I

  • 0

I am trying to communicate with a badly designed web server, but still I want to deal with it. The thing is, when I submit my login form, it tries to embed messages inside the URI, which makes the URI library stop.

The server redirects me to

/path/ConvolutedNameForMenuPage.menu?name=bmenu.P_MainMnu&msg=WELCOME+<b>Welcome,+Jonathan+Allard,+to+our+poorly+designed+Administrative+Systems!<%2Fb>Dec+07,+201102%3A27+PM

That’s right, it’s trying to pass me unparsed HTML code inside the redirect URI, which I am supposed to request in order to get it back. Sheesh, standards!

And now the URI library, visibly passionately upset by such bad practice, exclaims

URI::InvalidURIError: bad URI(is not URI?): /path/ConvolutedNameForMenuPage.menu?name=bmenu.P_MainMnu&msg=WELCOME+<b>Welcome,+Jonathan+Allard,+to+our+poorly+designed+Administrative+Systems!<%2Fb>Dec+07,+201102%3A27+PM   from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/uri/generic.rb:1202:in `rescue in merge'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/uri/generic.rb:1199:in `merge'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mechanize-2.0.1/lib/mechanize/page/meta_refresh.rb:32:in `parse'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mechanize-2.0.1/lib/mechanize/page/meta_refresh.rb:41:in `from_node'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mechanize-2.0.1/lib/mechanize/page.rb:282:in `block in meta_refresh'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:239:in `block in each'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:238:in `upto'
from /home/jon/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:238:in `each'

I feel your pain, URI lib.

Now, how do I catch this, parse back the URI correctly (or just drop it altogether) and submit back as if nothing happened? Or is this a bug somewhere between URI and Mechanize?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:13:32+00:00Added an answer on May 27, 2026 at 3:13 pm

    After some digging in the code, I have found where the issue comes from.

    As I explained in #177:

    in
    /lib/mechanize/page/meta_refresh.rb:40

    class Mechanize::Page::MetaRefresh
    
    def self.parse content, base_uri
      return unless content =~ CONTENT_REGEXP
    
      delay, refresh_uri = $1, $3
    
      dest = base_uri
      dest += refresh_uri if refresh_uri     # Oops!
    
      return delay, dest
    end
    

    The referenced line will raise URI::InvalidURIError if refresh_uri
    contains illegal symbols (such as <). I don’t quite know where the
    sanitize should be done though.

    The URI#merge of my error log is hidden in the += operator on the oops line, if you wondered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experiencing issues when trying to communicate with a web server (Apache 2.2.17) using
I'm new to Flash and trying to communicate with an app engine server but
I'm trying to communicate with a third party server using curl. The authentication system
I'm trying to communicate with u rban airship API using a ROR web application.
I'm trying to communicate with a server that uses DataInputStream.readUTF and DataOutputStream.writeUTF. I did
I'm getting a 503 response from a server that I'm trying to communicate with.
I'm trying to communicate with Flash Media Server through the Responder class because I
I was trying to communicate with 2 PC emulators. But after that I found
I am trying to communicate with a telnet server via socket programming with wxWidgets
I have a server I am trying t communicate to and it requires the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.