Menu

cookie is invalid

Help
Ramonus
2006-05-23
2013-04-27
  • Ramonus

    Ramonus - 2006-05-23

    Hello,

    With the latest version of HTMLParser some pages can not be processed, because a IllegalArgumentException (part of stacktrace below) is thrown. This is because the cookie is invalid. This is probably indeed the case, however, the complete parse process is aborted because of this exception. How can I avoid this? Or is this a bug? With version 1.5 this problem does not occure.

    Regards,

    Ramon

    10:48:44,648 ERROR HtmlWebResourceParser:245 - java.lang.IllegalArgumentException: invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB - invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB
    java.lang.IllegalArgumentException: invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB
        at org.htmlparser.http.Cookie.<init>(Cookie.java:138)
        at org.htmlparser.http.ConnectionManager.parseCookies(ConnectionManager.java:1069)
        at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:588)
        at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:767)
        at org.htmlparser.Parser.<init>(Parser.java:304)
        at org.htmlparser.Parser.<init>(Parser.java:316)

     
    • Derrick Oswald

      Derrick Oswald - 2006-05-23

      If it doesn't occur in version 1.5 it's probably a bug.

       
      • Ramonus

        Ramonus - 2006-05-29

        Can I report it in the bugtracker?

        Ramon

         
        • Derrick Oswald

          Derrick Oswald - 2006-05-29

          Hmmm, I'm not sure it's a bug now.
          Looking at the code, the isToken() check is complaining that the cookie can't contain any characters from the set:
            "()<>@,;:\\\"/[]?={} \t"
          ...so spaces aren't allowed.

          You could catch the exception and retry with cookie processing disabled.

           
    • Derrick Oswald

      Derrick Oswald - 2006-05-30

      I've added code to handle bad cookie names.
      It traps cookie name problems, but ignores any following cookies.
      This will be available in the next build.

       
      • Ramonus

        Ramonus - 2006-05-30

        Great! My opinion is that this is the right thing to do, you don't want to halt the parse process because of crappy cookies.

        Ramon

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.