Branch: Tag:

2010-05-23

2010-05-23 19:25:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fixed handling of the empty path followed by a query string.
Thanks to Mirar for the original test case (LysLysKOM 18502470).

Rev: lib/modules/Standards.pmod/URI.pike:1.33
Rev: lib/modules/Standards.pmod/testsuite.in:1.19

4:   //! absolute form, as defined in RFC 2396 and RFC 3986.      // Implemented by Johan Sundström and Johan Schön. - // $Id: URI.pike,v 1.32 2009/09/17 17:25:11 grubba Exp $ + // $Id: URI.pike,v 1.33 2010/05/23 19:25:52 grubba Exp $      #pragma strict_types   
52:      // Parse authority component (according to RFC 1738, § 3.1)   // Updated to RFC 3986 $ 3.2. + // NOTE: Censors the userinfo from the @[authority] variable.   protected void parse_authority()   {    // authority = [ userinfo "@" ] host [ ":" port ]
249:    if(sscanf(uri, "//%[^/]%s", authority, uri))    {    DEBUG("Found authority %O", authority); +  int q = search(authority, "?", search(authority, "@")+1); +  if (q >= 0) { +  // There's a question mark in the host and port section +  // of the authority. This happens when the path is empty +  // and there's a query part afterwards. +  // Example: http://foo?bar +  uri = authority[q..] + uri; +  authority = authority[..q-1]; +  DEBUG("Adjusted authority %O", authority);    } -  +  }       // Parse query information    // query = *( pchar / "/" / "?" )