diff options
author | Adam Chlipala <adamc@hcoop.net> | 2010-01-05 15:53:35 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2010-01-05 15:53:35 -0500 |
commit | 5b7e350bbb440255b866a14d59b69f9d8e411f36 (patch) | |
tree | b67a5a5e5e99fc172550dd57daf21aac3ddd5f10 /src | |
parent | b47fbe59f61f0caca02e370c983f12a1ff3bf6d0 (diff) |
Basis.textBlob; support HTTP requests with no headers
Diffstat (limited to 'src')
-rw-r--r-- | src/c/http.c | 5 | ||||
-rw-r--r-- | src/c/urweb.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/c/http.c b/src/c/http.c index 70001961..b070ef0f 100644 --- a/src/c/http.c +++ b/src/c/http.c @@ -147,12 +147,17 @@ static void *worker(void *data) { } } + body[-4] = '\r'; + body[-3] = '\n'; + if (!(s = strstr(buf, "\r\n"))) { fprintf(stderr, "No newline in request\n"); close(sock); goto done; } + body[-4] = body[-3] = 0; + *s = 0; headers = s + 2; method = s = buf; diff --git a/src/c/urweb.c b/src/c/urweb.c index f52fc459..e63b2060 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -3131,6 +3131,12 @@ uw_Basis_int uw_Basis_blobSize(uw_context ctx, uw_Basis_blob b) { return b.size; } +uw_Basis_blob uw_Basis_textBlob(uw_context ctx, uw_Basis_string s) { + uw_Basis_blob b = {strlen(s), s}; + + return b; +} + uw_Basis_blob uw_Basis_fileData(uw_context ctx, uw_Basis_file f) { return f.data; } |