- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Is it weird that I'm more upset I screwed up one of the examples than that people didn't like the writing overall? :laughing:
Admin
I figure that if nobody is complaining about the writing, then nobody is reading it to begin with.
Admin
I think I still have the crown for that one.
Admin
Why don't we talk about something less controversial, like politics, or religion...
Admin
I just thought your description of this website was hilarious.
Hmmm....I'd say you must be new here, but you really are.
Admin
This is a terrible idea for several reasons:
...probably a bunch of others....
Admin
10. When handed an invalid URL, in 99% of the cases, you're not getting any response code. A response code means there actually is a HTTP server over there, which is a pretty lucky occurrence if you're just going in a random direction.
Admin
410 is my favorite reply code, it's supposed to be used to say that the page has deliberately been removed. Not an error, just Gone.
Admin
I am sorry -- but for non-trivial tasks -- you're better off with a full set of parser combinators; they're far more expressive and readable, especially if they mimic EBNF syntax.
Admin
Like useful parts of Discourse!
Admin
FTFY
Admin
Keep Calm and Ignore the Front-page Trolls (sorry, can't be arsed to update avatar for this).
Admin
Both of these aren't valid URIs (I'm going to substitute "URI" for "URL", since there's no general mechanism to determine whether a URI is an URL).
I'm pretty sure the language of URIs is regular, though. Here's a script I wrote a while ago that uses a regular expression derived from the official grammar to match URIs (and relative URI references): https://gist.github.com/SpecLad/4514342.
And here's the expression itself: http://pastebin.com/SgMi0xRp. It's a bit longer than it needs to be, because I used
/x
.Admin
Honestly, the state of the data setup in my work's demo environment rankles me far more XD
Admin
http://i.ytimg.com/vi/-DT7bX-B1Mg/hqdefault.jpg
Admin
Don't get me started on regex validating of emails.
After years of people googling the best regex, there are now many sites that won't allow the new TLDs or restricted them to {2,4} between two and four characters.
[email protected] is not well liked.
Admin
Too late: http://what.thedailywtf.com/t/til-plus-email-validation-and-people-parts/7613/. I'm not sure where in the conversation email validation comes up; maybe 1/4 of the way.
Admin
I want to stick a comment in an email address and see how far that flies in today's world...
Filed under: but the RFC has syntax for it!
Admin
Given that there are far more ways to make it wrong than make it right, and the framework's already done the heavy lifting for you, I've very confused as to why someone wouldn't just create a System.Uri initialized to the string to test it for validity... given that it's going to be done that way later anyway. If you get an exception, you have your answer! If you only support http, then you can test the scheme once you have the Uri.
Someone had a screwdriver in his hand and still insisted on grabbing the hammer when he saw a screw.
Admin
I want a teapot that says ERROR 418 on it. I've tried to look for one but all I could find is a t-shirt. There must be someone selling such a thing, surely?
Admin
It probably wouldn't be hard for a local shop to put that text on a regular teapot.
Admin
Admin
If so, Google doesn't seem to know about it. I want one, too.
Admin
The second becomes a valid URI after Punycode conversion, which browsers will do automatically.
Also, I'm pretty sure everyone missed another false match case:
You probably don't have a uri handler for that installed.
Admin
Valid as an abbreviation for an HTTP URL maybe. But not a URL. RFC 3986 says all URLs contain the ':' character.
Admin
That is a bad idea on so many different levels, most of which @monkeyArms covered. But, you can get at least one person to support it. Paging @Rhywden.
Admin
Because this is not in any way abusable as a CSRF vector in the same way, say, using a URL minifier is?
But again, you can still do basic validation before you even do that.
Admin
When you see it matches htftp://www.google.com , you know the validation is not doing it's work.
EDIT: Edit to see whether it shows all the time of edit.
Admin
It's never a valid URL regardless of context. You can add http:// to make it a valid URL if that suits your purposes, as most browsers do, but it's not a valid URL until you do that.
No scheme.
Admin
Admin
.. Dang, I was pretty sure it was
sftp
but it seems that they both (ftps and sftp
) exist.Admin
It doesn't, though. Why would you say it does? It's pretty clear from the regex itself that it doesn't (well, "clear", relative to regexes, anyway) so regex 101 wasn't required but it's a quick way to show it.
Admin
Admin
It's a valid URL. You probably don't have a handler for the
htftp
scheme though.Admin
I think you may have missed the joke, or maybe the emoji aren't showing on your browser or something....
Because @lucas buggered off?
Is the comment about @ signs?
Admin
(1) This reminds me of something I saw many, many years ago (some time like 1984), in upstate New York. At that time NY allowed custom license plates with up to eight letters/digits, and a guy obviously worked nights a lot - he had NITESHFT as his plate, and you had to look twice to see that SHFT wasn't SHIFT. (It's easier to see on a computer screen than it was on the plate itself.)
Admin
(source)
Admin
More or less, although I remember it as looking denser than that (which helped the illusion).
Admin
Why are you parsing a URL if it is not going to be used? I take on board everything that has been said by monkeyArms, but why would I want to store a list of URLs some of which don't point to anything? The only reason for the list is that at some point someone is going to try to use it. Of course there are many, many problems with physically testing URLs, such as getting bizarre pages back from wireless access points and the like, but just storing untested but semantically valid URLs has its own gotchas - for instance if an attacker was trying to load a list of URLs which were intended for later registration to facilitate malware distribution.
Admin
two entirely different protocols. (never use ftps if you can avoid it. sftp is far more secure)
Admin
it's W3. what did you expect?
Admin
Excessive weird?
Admin
to begin with.
Admin
http://www=www:99999:99999:99999 is a valid URL? Now that's new to me....
Admin
Here are a few valid ones:
Admin
Format of a valid URL:
Admin
Make sure your stuff doesn't contain spaces, though. They are dangerous. If we allow spaces in URLs, the terrorists will have won. And it's bad for the children and the polar bears.
Admin
##Dr .%20 or: how I learned to stop worrying and love having yet another method to encode problematic characters.
Admin
That's not valid, because though it satisfies the generic URL interpretation, it fails the HTTP-specific interpretation. Each scheme interprets the scheme-specific part in its own way.
If you'd written “
foobar://www=www:99999:99999:99999
”, you'd probably have been OK. :D