fzzzy/pyhttp11 — Issue #1: FromFormat is the wrong method for the incoming data
Author: teh
Created: 2012-02-27 10:34:11+00:00
State: open

Hey, the ragel output is not null-terminated, so FromFormat will break. The following, while not very elegant, works:

- PyDict_SetItem((PyObject *)data, PyString_FromFormat("HTTP_%s", field_name), PyString_FromStringAndSize(field_value, field_value
_size));
+ char field[field_name_len + 5];
+ strncpy(field, "HTTP_", 5);
+ strncpy(field + 5, field_name, field_name_len);
+
+ PyDict_SetItem((PyObject *)data, PyString_FromStringAndSize(field, field_name_len + 5), PyString_FromStringAndSize(field_value,
field_value_size));
}