1999-07-16
1999-07-16 13:24:27 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
9f85df6e9bd9a46738260b2b58061605e14a8ff1
(73 lines)
(+39/-34)
[
Show
| Annotate
]
Branch: 5.2
Minor optimization.
Rev: server/protocols/http.pike:1.145
6: Inside #if defined(MAGIC_ERROR)
#ifdef MAGIC_ERROR
inherit "highlight_pike";
#endif
- constant cvs_version = "$Id: http.pike,v 1.144 1999/07/16 06:22:54 neotron Exp $";
+ constant cvs_version = "$Id: http.pike,v 1.145 1999/07/16 13:24:27 grubba Exp $";
// HTTP protocol module.
#include <config.h>
private inherit "roxenlib";
320:
return 1;
}
- string trailer;
- switch(sscanf(line+" ", "%s %s %s %s", method, f, clientprot, trailer))
+ string trailer, trailer_trailer;
+ switch(sscanf(line+" ", "%s %s %s %s %s",
+ method, f, clientprot, trailer, trailer_trailer))
{
- case 1:
- // PING...
- if(method == "PING")
- break;
- // only PING is valid here.
- return 1;
-
- case 2:
- // HTTP/0.9
- clientprot = prot = "HTTP/0.9";
- if(method != "PING")
- method = "GET"; // 0.9 only supports get.
- s = data = ""; // no headers or extra data...
- break;
-
+ case 5:
+ // Stupid sscanf!
+ if (trailer_trailer != "") {
+ // Get rid of the extra space from the sscanf above.
+ trailer += " " + trailer_trailer[..sizeof(trailer_trailer)-2];
+ }
+ /* FALL_THROUGH */
case 4:
- // Stupid sscanf! If trailer == "" it's a valid request. Really! Grrr.
- if(strlen(trailer)) {
+
// Got extra spaces in the URI.
// All the extra stuff is now in the trailer.
int end;
- // Get rid of the extra space from the sscanf above.
- trailer = trailer[..sizeof(trailer) - 2];
+
f += " " + clientprot;
// Find the last space delimiter.
358:
f += " " + trailer[..sizeof(trailer) - (end + 1)];
clientprot = trailer[sizeof(trailer) - end ..];
}
- }
+
/* FALL_THROUGH */
case 3:
// >= HTTP/1.0
378:
return 0;
}
break;
+
+ case 2:
+ // HTTP/0.9
+ clientprot = prot = "HTTP/0.9";
+ if(method != "PING")
+ method = "GET"; // 0.9 only supports get.
+ s = data = ""; // no headers or extra data...
+ break;
+
+ case 1:
+ // PING...
+ if(method == "PING")
+ break;
+ // only PING is valid here.
+ return 1;
+
default:
// Too many or too few entries -> Hum.
return 1;