Merge pull request #3005 from dgquintas/head_vs_tails

Fixed wrong creation of metadata in compression.
diff --git a/include/grpc/compression.h b/include/grpc/compression.h
index e35fb03..9924bae 100644
--- a/include/grpc/compression.h
+++ b/include/grpc/compression.h
@@ -67,7 +67,9 @@
                                      grpc_compression_algorithm *algorithm);
 
 /** Updates \a name with the encoding name corresponding to a valid \a
- * algorithm.  Returns 1 upon success, 0 otherwise. */
+ * algorithm. Note that the string returned through \a name upon success is
+ * statically allocated and shouldn't be freed. Returns 1 upon success, 0
+ * otherwise. */
 int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
                                     char **name);
 
diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c
index 20d723b..762a4ed 100644
--- a/src/core/channel/compress_filter.c
+++ b/src/core/channel/compress_filter.c
@@ -216,7 +216,7 @@
                                   [calld->compression_algorithm]));
 
           /* convey supported compression algorithms */
-          grpc_metadata_batch_add_head(
+          grpc_metadata_batch_add_tail(
               &(sop->data.metadata), &calld->accept_encoding_storage,
               GRPC_MDELEM_REF(channeld->mdelem_accept_encoding));