| Line 885... |
Line 885... |
| 885 |
if (!strncmp(bol + rll - 3, "1.0", 3)) c->attr |= HTTP_1_0;
|
885 |
if (!strncmp(bol + rll - 3, "1.0", 3)) c->attr |= HTTP_1_0;
|
| 886 |
if (!strncmp(bol, "GET ", 4)) c->method = METHOD_GET;
|
886 |
if (!strncmp(bol, "GET ", 4)) c->method = METHOD_GET;
|
| 887 |
if (!strncmp(bol, "POST ", 5)) c->method = METHOD_POST;
|
887 |
if (!strncmp(bol, "POST ", 5)) c->method = METHOD_POST;
|
| 888 |
if (!strncmp(bol, "HEAD ", 5)) c->method = METHOD_HEAD;
|
888 |
if (!strncmp(bol, "HEAD ", 5)) c->method = METHOD_HEAD;
|
| 889 |
/* only custom handlers can use other methods */
|
889 |
/* only custom handlers can use other methods */
|
| 890 |
if (!c->method && !strncmp(url, "/custom/", 8)) {
|
890 |
if (!strncmp(url, "/custom/", 8)) {
|
| 891 |
char *mend = url - 1;
|
891 |
char *mend = url - 1;
|
| 892 |
/* we generate a header with the method so it can be passed to the handler */
|
892 |
/* we generate a header with the method so it can be passed to the handler */
|
| 893 |
if (!c->headers)
|
893 |
if (!c->headers)
|
| 894 |
c->headers = alloc_buffer(1024, NULL);
|
894 |
c->headers = alloc_buffer(1024, NULL);
|
| 895 |
/* make sure it fits */
|
895 |
/* make sure it fits */
|
| 896 |
if (c->headers->size - c->headers->length >= 18 + (mend - bol)) {
|
896 |
if (c->headers->size - c->headers->length >= 18 + (mend - bol)) {
|
| 897 |
c->method = METHOD_OTHER;
|
897 |
if (!c->method) c->method = METHOD_OTHER;
|
| 898 |
/* add "Request-Method: xxx" */
|
898 |
/* add "Request-Method: xxx" */
|
| 899 |
memcpy(c->headers->data + c->headers->length, "Request-Method: ", 16);
|
899 |
memcpy(c->headers->data + c->headers->length, "Request-Method: ", 16);
|
| 900 |
c->headers->length += 16;
|
900 |
c->headers->length += 16;
|
| 901 |
memcpy(c->headers->data + c->headers->length, bol, mend - bol);
|
901 |
memcpy(c->headers->data + c->headers->length, bol, mend - bol);
|
| 902 |
c->headers->length += mend - bol;
|
902 |
c->headers->length += mend - bol;
|