+ if (!HTTP_G->request.headers) {
+ ALLOC_HASHTABLE(HTTP_G->request.headers);
+ zend_hash_init(HTTP_G->request.headers, 0, NULL, ZVAL_PTR_DTOR, 0);
+
+#ifdef ZEND_ENGINE_2
+ zend_is_auto_global("_SERVER", lenof("_SERVER") TSRMLS_CC);
+#endif
+
+ if (SUCCESS == zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void *) &hsv) && Z_TYPE_PP(hsv) == IS_ARRAY) {
+ FOREACH_KEY(pos, *hsv, key) {
+ if (key.type == HASH_KEY_IS_STRING && key.len > 6 && !strncmp(key.str, "HTTP_", 5)) {
+ key.len -= 5;
+ key.str = pretty_key(estrndup(key.str + 5, key.len - 1), key.len - 1, 1, 1);
+
+ zend_hash_get_current_data_ex(Z_ARRVAL_PP(hsv), (void *) &header, &pos);
+ ZVAL_ADDREF(*header);
+ zend_hash_add(HTTP_G->request.headers, key.str, key.len, (void *) header, sizeof(zval *), NULL);
+
+ efree(key.str);