URI.parse hex encoded URI

Hi all and my first greetings to this mailing list,

I’ve a small problem with rubies URI.parse(string) function. It throws
me an
exception when I try to parse an URI like: https://.
which
contains hex encoded characters. Unfortunately it’s no option to decode
uri
before parsing.
How could this matter be solved?

Thanks for your help.

Karsten

Content preview: Hi, On 03.06.2011 10:25, Burger Karsten (LET) wrote: >
Hi
all and my first greetings to this mailing list, > > I’ve a small
problem
with rubies URI.parse(string) function. It throws me an > exception
when I
try to parse an URI like: https://. which > contains
hex encoded
characters. Unfortunately it’s no option to decode uri > before
parsing.

How could this matter be solved? […]

Content analysis details: (-2.9 points, 5.0 required)

pts rule name description



-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
X-Cloudmark-Analysis: v=1.1
cv=tMVj8KYobzzX0EiRnC7vY2isLrCxFvdg4RrHWPZXwJ0= c=1 sm=0
a=CPlwVjms4CEA:10 a=h4ye1aZCbTUA:10 a=IkcTkHD0fZMA:10
a=H1CdzyOPijOLKt__AJ0A:9 a=0c290sD_MWSgNofvOMgA:7 a=QEXdDO2ut3YA:10
a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Precedence: bulk
Lines: 23
List-Id: ruby-talk.ruby-lang.org
List-Software: fml [fml 4.0.3 release (20011202/4.0.3)]
List-Post: mailto:[email protected]
List-Owner: mailto:[email protected]
List-Help: mailto:[email protected]?body=help
List-Unsubscribe: mailto:[email protected]?body=unsubscribe
Received-SPF: none (Address does not pass the Sender Policy Framework)
SPF=FROM;
[email protected];
remoteip=::ffff:221.186.184.68;
remotehost=carbon.ruby-lang.org;
helo=carbon.ruby-lang.org;
receiver=eq4.andreas-s.net;

Hi,

On 03.06.2011 10:25, Burger Karsten (LET) wrote:

Hi all and my first greetings to this mailing list,

I’ve a small problem with rubies URI.parse(string) function. It throws me an
exception when I try to parse an URI like: https://. which
contains hex encoded characters. Unfortunately it’s no option to decode uri
before parsing.
How could this matter be solved?

I’m no export on URI but I’ve been using it in a few projects lately
which included also studying the source to understand certain parts.
From my conclusion you’re out of luck, URI and friends adhere to the RFC
and what you ask for simply isn’t as per the RFC (see the source of
uri/common.rb for yourself about all the regexp used in there). What you
have is encoded and you need to decode it.

No idea why your restriction is that you cannot decode it before handing
over to URI.parse, but since you choose to use ruby you also know you
can monkey patch URI.parse, so …

  • Markus

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs