[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: What C structure contains the HTTP Headers

From: Loren Cahlander <loren.cahlander_at_gmail.com>
Date: Thu, 12 Aug 2010 11:49:30 -0500

On Aug 12, 2010, at 11:12 AM, Hyrum K. Wright wrote:

> On Thu, Aug 12, 2010 at 11:07 AM, C. Michael Pilato <cmpilato_at_collab.net> wrote:
>> On 08/12/2010 12:04 PM, Loren Cahlander wrote:
>>> Hello there,
>>>
>>> I am trying to make a change to mod_dav_svn on my server and need to get
>>> a value out of the HTTP headers. I have not developed in C in quite a
>>> while and would appreciate any help by pointing me in the right
>>> direction. I can take it from there, but I do need some help.
>>
>> Apache passes around the request structure (often just called 'r'), and
>> inside that is a table called 'headers_in'. Grep for 'r->headers_in' in,
>> say, subversion/mod_dav_svn/repos.c.
>
> I know next-to-nothing about mod_dav_svn, but why would an Apache
> request appear in libsvn_repos? I thought all that stuff was handled
> higher up, and libsvn_repos was ra-agnostic.
>
> -Hyrum

I am trying to make a hack in mod_dav_svn to get some additional headers from a HTTP put.

I have the following XQuery code:

declare function http:put-basic-auth($url, $content, $username, $password, $header) as node(){

let $credentials := concat($username, ':', $password)
let $encode := util:base64-encode($credentials)
let $value := concat('Basic ', $encode)
let $headers :=
<headers>
   {$header//header}
   <header name="Authorization" value="{$value}"/>
</headers>
let $response := httpclient:put($url, $content, false(), $headers)
return $response
};

Where $header will contain:

<headers>
        <header name="X-SVN-Log" value="This is the commit log message"/>
        <header name="X-SVN-User" value="fred"/>
</headers>

I want to change the following function in subversion/mod_dav_svn/version.c to get those two headers values and set the values for SVN_PROP_REVISION_LOG and SVN_PROP_REVISION_AUTHOR. Is there a simple way to get the request_rec structure from the svn_fs_txn_t or apr_pool_t structures? Another thing that might help is where is the entry into mod_dav_svn for a HTTP PUT request?

svn_error_t *
dav_svn__attach_auto_revprops(svn_fs_txn_t *txn,
                              const char *fs_path,
                              apr_pool_t *pool)
{
  const char *logmsg;
  svn_string_t *logval;
  svn_error_t *serr;

  logmsg = apr_psprintf(pool,
                        "Autoversioning commit: a non-deltaV client made "
                        "a change to\n%s", fs_path);

  logval = svn_string_create(logmsg, pool);
  if ((serr = svn_repos_fs_change_txn_prop(txn, SVN_PROP_REVISION_LOG, logval,
                                           pool)))
    return serr;

  /* Notate that this revision was created by autoversioning. (Tools
     like post-commit email scripts might not care to send an email
     for every autoversioning change.) */
  if ((serr = svn_repos_fs_change_txn_prop(txn,
                                           SVN_PROP_REVISION_AUTOVERSIONED,
                                           svn_string_create("*", pool),
                                           pool)))
    return serr;

  return SVN_NO_ERROR;
}

I thank you for replying to me. I will keep code diving until I find the solution.
Received on 2010-08-12 18:50:09 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.