Added event-driven server.
[jagi.git] / src / jagi / scgi / Scgi.java
index 5e219b0..f7f57d2 100644 (file)
@@ -26,9 +26,8 @@ public class Scgi {
        return(data);
     }
 
-    public static Map<ByteBuffer, ByteBuffer> readhead(ReadableByteChannel sk) throws IOException {
+    public static Map<ByteBuffer, ByteBuffer> splithead(ByteBuffer ns) {
        Map<ByteBuffer, ByteBuffer> ret = new HashMap<>();
-       ByteBuffer ns = readns(sk);
        ByteBuffer k = null;
        for(int i = 0, p = 0; i < ns.limit(); i++) {
            if(ns.get(i) == 0) {
@@ -45,4 +44,8 @@ public class Scgi {
        }
        return(ret);
     }
+
+    public static Map<ByteBuffer, ByteBuffer> readhead(ReadableByteChannel sk) throws IOException {
+       return(splithead(readns(sk)));
+    }
 }