Strip the leading slash of the rest string.
[ashd.git] / lib / req.c
index da367a3..0ede229 100644 (file)
--- a/lib/req.c
+++ b/lib/req.c
@@ -89,6 +89,17 @@ char *getheader(struct hthead *head, char *name)
     return(NULL);
 }
 
+void replrest(struct hthead *head, char *rest)
+{
+    char *tmp;
+    
+    /* Do not free the current rest string yet, so that the new one
+     * can a subpart of the old one. */
+    tmp = head->rest;
+    head->rest = sstrdup(rest);
+    free(tmp);
+}
+
 void headpreheader(struct hthead *head, const char *name, const char *val)
 {
     head->headers = srealloc(head->headers, sizeof(*head->headers) * (head->noheaders + 1));
@@ -116,7 +127,7 @@ int sendreq(int sock, struct hthead *req)
     int pfds[2];
     struct charbuf buf;
     
-    if(socketpair(PF_UNIX, SOCK_DGRAM, 0, pfds))
+    if(socketpair(PF_UNIX, SOCK_STREAM, 0, pfds))
        return(-1);
     bufinit(buf);
     bufcatstr2(buf, req->method);