e764efe5d0e596213c72e69f028df0a667d0a83c
markd
  Mon Jun 29 00:43:22 2020 +0000
gfClient working with blat server running under xinetd

diff --git src/gfServer/gfServer.c src/gfServer/gfServer.c
index d848d66..160dde0 100644
--- src/gfServer/gfServer.c
+++ src/gfServer/gfServer.c
@@ -1051,44 +1051,45 @@
     dynError("EOF from client");
 buf[readSize] = '\0';
 }
 
 
 static void dynReadQuery(char **commandRet, int *qsizeRet, char **genomeNameRet)
 /* read query request from stdin, same as server expect includes database
  * Format is:
  *  signature command qsize genome
  */
 {
 char buf[256];
 dynReadBytes(buf, sizeof(buf));
 logDebug("query: %s", buf);
 
-static int nwords = 4;
+if (!startsWith(gfSignature(), buf))
+    dynError("query does not start with signature, got '%s'", buf);
+
+static int nwords = 3;
 char *words[nwords];
 int numWords = chopByWhite(buf, words, nwords);
 if (numWords != nwords)
     dynError("expected %d words in request, got %d", nwords, numWords);
-if (!sameString(words[0], gfSignature()))
-    dynError("query does not start with signature, got '%s'", words[0]);
-
-if (!(sameString("query", words[1]) || 
-      sameString("protQuery", words[1]) || sameString("transQuery", words[1])))
-    dynError("invalid command '%s'", words[1]);
-*commandRet = cloneString(words[1]);
-*qsizeRet = atoi(words[2]);
-*genomeNameRet = cloneString(words[3]);
+char *command = buf + strlen(gfSignature());
+if (!(sameString("query", command) || 
+      sameString("protQuery", command) || sameString("transQuery", command)))
+    dynError("invalid command '%s'", command);
+*commandRet = cloneString(command);
+*qsizeRet = atoi(words[1]);
+*genomeNameRet = cloneString(words[2]);
 }
 
 static struct dnaSeq* dynReadQuerySeq(int qSize, boolean isTrans, boolean queryIsProt)
 /* read the DNA sequence from the query, filtering junk  */
 {
 struct dnaSeq *seq;
 AllocVar(seq);
 seq->size = qSize;
 seq->dna = needLargeMem(qSize+1);
 if (gfReadMulti(STDIN_FILENO, seq->dna, qSize) != qSize)
     dynError("read of %d bytes of query sequence failed", qSize);
 
 if (queryIsProt)
     {
     seq->size = aaFilteredSize(seq->dna);