Interesting URL parsing



  • This is from some URL parsing code in DSpace (www.dspace.org):

    int lastDot = host.lastIndexOf(".");

    (i.e. having a host name without dots will give you an exception a few lines further)

     




  • Oh my... in the above post, where there is DSPACE, you should read it XXXXXXX (it's a great software and doesn't deserve to be mentioned explicitly like this)



  • @cangulo said:

    Oh my... in the above post, where there is DSPACE, you should read it XXXXXXX (it's a great software and doesn't deserve to be mentioned explicitly like this)

     

    Well, the cats out of the bag now.  I have friends who work for a university library and they use DSPACE.  They seem to like it OK.  Isn't DSPACE Open Source and/or Free Software?  Maybe you can be the hero that removes the WTF. 



  • @cangulo said:

    Oh my... in the above post, where there is DSPACE, you should read it XXXXXXX (it's a great software and doesn't deserve to be mentioned explicitly like this)

    Looks open-sourcey. Just submit a patch, dude.  

    You could always hyperlink it and declare a "Week of DSPACE bugs" if it falls on deaf ears.



  • @cangulo said:

    Oh my... in the above post, where there is DSPACE, you should read it XXXXXXX (it's a great software and doesn't deserve to be mentioned explicitly like this)

    All software that does stupid things deserves to be explicitly mentioned, in order to correct the misapprehensions of people like you. 



  • @sootzoo said:

    @cangulo said:

    Oh my... in the above post, where there is DSPACE, you should read it XXXXXXX (it's a great software and doesn't deserve to be mentioned explicitly like this)

    Looks open-sourcey. Just submit a patch, dude.  

    You could always hyperlink it and declare a "Week of DSPACE bugs" if it falls on deaf ears.

    dSpace? Open-source? The embedded controls industry would love you if you could get dSpace open-source. Although, dSpace would hate it.  dSpace is included with The MathWorks in my Evil Empire Nobody Knows About Because They're Not Microsoft.  Extremely expensive, privately owned software, and it's most definitely not open source. Things like patent-encumbered come to mind (I still hate the guy that is preventing a visual diff tool for Simulink because of his patent...).

     

    EDIT: Oh, geez... I just realized the difference between dspace.com and dspace.org.

    Scary!
     



  • @too_many_usernames said:

    @sootzoo said:

    @cangulo said:

    Oh my... in the above post, where there is DSPACE, you should read it XXXXXXX (it's a great software and doesn't deserve to be mentioned explicitly like this)

    Looks open-sourcey. Just submit a patch, dude.  

    You could always hyperlink it and declare a "Week of DSPACE bugs" if it falls on deaf ears.

    dSpace? Open-source? The embedded controls industry would love you if you could get dSpace open-source. Although, dSpace would hate it.  dSpace is included with The MathWorks in my Evil Empire Nobody Knows About Because They're Not Microsoft.  Extremely expensive, privately owned software, and it's most definitely not open source. Things like patent-encumbered come to mind (I still hate the guy that is preventing a visual diff tool for Simulink because of his patent...).

     

    EDIT: Oh, geez... I just realized the difference between dspace.com and dspace.org.

    Scary!
     

     

    That's really interesting, though, that there's http://www.dspace.org and http://www.dspace.com, and both products are called dspace (ignoring capitalization), and both are software.  It looks like the commerical one for embedded applications is dSpace.  The open source electronic repository one is DSpace.  I realize that capitalization is important for copyright and trademark, but it's still surprising that whoever was first didn't poke the other one and say, "Uhh, we were here first."


     



  • I did fix it as soon as I spotted the bug.

    Like I said, it's good software. I feel bad for mentioning it.

    My mistake, not submitting the edit 0.0000000000001 second after the first post. This should really be changed.People need a little time to think before editing the post.

    I needed to share it with someone, since my coworkers don't care much about this kind of thing (anyone who cares would love to see our current inhouse PHP web application 'framework').

    I just found interesting to see a copyright notice of a big company on the top of the file and then this kind of strange code.



  • Maybe it's just me, but there is nothing inherently wrong with

    int lastDot = host.lastIndexOf(".");

    Maybe there is a bug a few lines further, where they use it without checking the result.
     

     



  • @cangulo said:

    My mistake, not submitting the edit 0.0000000000001 second after the first post. This should really be changed.People need a little time to think before editing the post.

      IRL, you're required to think before you open your mouth.  It's a good habit to maintain on teh Intarnets.




  • @ammoQ said:

    Maybe it's just me, but there is nothing inherently wrong with

    int lastDot = host.lastIndexOf(".");

    Maybe there is a bug a few lines further, where they use it without checking the result.
     

    I'd say that this line indicates an incorrect assumption about hostnames. So, even without seeing enough context to see the actual bug, it still suggests a WTF. Why would you need to know the index of the last dot? Even with proper domain names, this isn't necessarily meaningful information.

    There was an e-mail virus a while back that made incorrect assumptions about domain names in the e-mails it sent out - it tried to address the administrator of the domain, not a sub domain, by taking the last two dotted parts. This was pretty broken when it came to nominet .co.uk or .org.uk domains. I would assume (assumption being the mother of all WTFs) that whoever wrote this code made a similar incorrect assumption to whoever wrote the virus.

    Of course, you are technically correct. I'm just making assumptions. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.