if (!type || !path || !version)
return CLIENT_STATE_DONE;
- memset(&cl->request, 0, sizeof(cl->request));
- req->url = path;
+ blobmsg_add_string(&cl->hdr, "URL", path);
+ memset(&cl->request, 0, sizeof(cl->request));
h_method = find_idx(http_methods, ARRAY_SIZE(http_methods), type);
h_version = find_idx(http_versions, ARRAY_SIZE(http_versions), version);
if (h_method < 0 || h_version < 0) {
*newline = 0;
blob_buf_init(&cl->hdr, 0);
- blobmsg_add_string(&cl->hdr, "REQUEST", buf);
+ cl->state = client_parse_request(cl, buf);
ustream_consume(cl->us, newline + 2 - buf);
- cl->state = client_parse_request(cl, (char *) blobmsg_data(blob_data(cl->hdr.head)));
if (cl->state == CLIENT_STATE_DONE)
uh_header_error(cl, 400, "Bad Request");
void uh_handle_request(struct client *cl)
{
struct dispatch_handler *d;
- const char *url = cl->request.url;
+ const char *url = blobmsg_data(blob_data(cl->hdr.head));;
d = dispatch_find(url, NULL);
if (d) {
__handle_file_request(cl, conf.error_handler))
return;
- uh_client_error(cl, 404, "Not Found", "The requested URL %s was not found on this server.", cl->request.url);
+ uh_client_error(cl, 404, "Not Found", "The requested URL %s was not found on this server.", url);
}
struct blob_attr *data = cl->hdr.head;
struct env_var *vars = (void *) uh_buf;
struct blob_attr *tb[__HDR_MAX];
+ const char *url;
int len;
int i;
+ url = blobmsg_data(blob_data(cl->hdr.head));
len = ARRAY_SIZE(proc_header_env);
len += ARRAY_SIZE(extra_vars);
len *= sizeof(struct env_var);
extra_vars[VAR_SCRIPT_FILE].value = pi->phys;
extra_vars[VAR_DOCROOT].value = pi->root;
extra_vars[VAR_QUERY].value = pi->query ? pi->query : "";
- extra_vars[VAR_REQUEST].value = req->url;
+ extra_vars[VAR_REQUEST].value = url;
extra_vars[VAR_PROTO].value = http_versions[req->version];
extra_vars[VAR_METHOD].value = http_methods[req->method];
extra_vars[VAR_PATH_INFO].value = pi->info;
int content_length;
bool expect_cont;
uint8_t transfer_chunked;
- const char *url;
const struct auth_realm *realm;
};