Skip to content

Commit

Permalink
Added onion_response_get_headers, that return current header dictiona…
Browse files Browse the repository at this point in the history
…ry for user custom management.
  • Loading branch information
davidmoreno committed Aug 1, 2012
1 parent 669eec3 commit 75f5069
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/onion/response.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -411,3 +411,13 @@ void onion_response_set_writer(onion_response *res, onion_write write, void *soc
res->write=write; res->write=write;
res->socket=socket; res->socket=socket;
} }

/**
* @short Returns the headers dictionary, so user can add repeated headers
*
* Only simple use case is to add several coockies; using normal set_header is not possible,
* but accessing the dictionary user can add repeated headers without problem.
*/
onion_dict *onion_response_get_headers(onion_response *res){
return res->headers;
}
2 changes: 2 additions & 0 deletions src/onion/response.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ void onion_response_set_header(onion_response *res, const char *key, const char
void onion_response_set_length(onion_response *res, size_t length); void onion_response_set_length(onion_response *res, size_t length);
/// Sets the return code /// Sets the return code
void onion_response_set_code(onion_response *res, int code); void onion_response_set_code(onion_response *res, int code);
/// Gets the headers dictionary
onion_dict *onion_response_get_headers(onion_response *res);


/// @{ @name Write functions /// @{ @name Write functions
/// Writes all the header to the given fd /// Writes all the header to the given fd
Expand Down

0 comments on commit 75f5069

Please sign in to comment.