+PHP_HTTP_API void _http_parse_headers_default_callback(void **cb_data, char *http_line, size_t line_length, HashTable **headers TSRMLS_DC)
+{
+ zval array;
+ Z_ARRVAL(array) = *headers;
+
+ /* response */
+ if (!strncmp(http_line, "HTTP/1.", lenof("HTTP/1."))) {
+ add_assoc_stringl(&array, "Response Status", http_line + lenof("HTTP/1.x "), line_length - lenof("HTTP/1.x \r\n"), 1);
+ } else
+ /* request */
+ if (!strncmp(http_line + line_length - lenof("HTTP/1.x\r\n"), "HTTP/1.", lenof("HTTP/1."))) {
+ char *sep = strchr(http_line, ' ');
+
+ add_assoc_stringl(&array, "Request Method", http_line, sep - http_line, 1);
+ add_assoc_stringl(&array, "Request Uri", sep + 1, strstr(sep, "HTTP/1.") - sep + 1 + 1, 1);
+ }
+}
+