serf.c (289180) | serf.c (298845) |
---|---|
1/* 2 * serf.c : entry point for ra_serf 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file --- 50 unchanged lines hidden (view full) --- 59 SVN_VERSION_BODY; 60} 61 62#define RA_SERF_DESCRIPTION \ 63 N_("Module for accessing a repository via WebDAV protocol using serf.") 64 65#define RA_SERF_DESCRIPTION_VER \ 66 N_("Module for accessing a repository via WebDAV protocol using serf.\n" \ | 1/* 2 * serf.c : entry point for ra_serf 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file --- 50 unchanged lines hidden (view full) --- 59 SVN_VERSION_BODY; 60} 61 62#define RA_SERF_DESCRIPTION \ 63 N_("Module for accessing a repository via WebDAV protocol using serf.") 64 65#define RA_SERF_DESCRIPTION_VER \ 66 N_("Module for accessing a repository via WebDAV protocol using serf.\n" \ |
67 " - using serf %d.%d.%d") | 67 " - using serf %d.%d.%d (compiled with %d.%d.%d)") |
68 69/* Implements svn_ra__vtable_t.get_description(). */ 70static const char * 71ra_serf_get_description(apr_pool_t *pool) 72{ 73 int major, minor, patch; 74 75 serf_lib_version(&major, &minor, &patch); | 68 69/* Implements svn_ra__vtable_t.get_description(). */ 70static const char * 71ra_serf_get_description(apr_pool_t *pool) 72{ 73 int major, minor, patch; 74 75 serf_lib_version(&major, &minor, &patch); |
76 return apr_psprintf(pool, _(RA_SERF_DESCRIPTION_VER), major, minor, patch); | 76 return apr_psprintf(pool, _(RA_SERF_DESCRIPTION_VER), 77 major, minor, patch, 78 SERF_MAJOR_VERSION, 79 SERF_MINOR_VERSION, 80 SERF_PATCH_VERSION 81 ); |
77} 78 79/* Implements svn_ra__vtable_t.get_schemes(). */ 80static const char * const * 81ra_serf_get_schemes(apr_pool_t *pool) 82{ 83 static const char *serf_ssl[] = { "http", "https", NULL }; 84#if 0 --- 419 unchanged lines hidden (view full) --- 504 505 /* todo: reuse serf context across sessions */ 506 serf_sess->context = serf_context_create(serf_sess->pool); 507 508 SVN_ERR(svn_ra_serf__blncache_create(&serf_sess->blncache, 509 serf_sess->pool)); 510 511 | 82} 83 84/* Implements svn_ra__vtable_t.get_schemes(). */ 85static const char * const * 86ra_serf_get_schemes(apr_pool_t *pool) 87{ 88 static const char *serf_ssl[] = { "http", "https", NULL }; 89#if 0 --- 419 unchanged lines hidden (view full) --- 509 510 /* todo: reuse serf context across sessions */ 511 serf_sess->context = serf_context_create(serf_sess->pool); 512 513 SVN_ERR(svn_ra_serf__blncache_create(&serf_sess->blncache, 514 serf_sess->pool)); 515 516 |
512 status = apr_uri_parse(serf_sess->pool, session_URL, &url); 513 if (status) 514 { 515 return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL, 516 _("Illegal URL '%s'"), 517 session_URL); 518 } 519 /* Depending the version of apr-util in use, for root paths url.path 520 will be NULL or "", where serf requires "/". */ 521 if (url.path == NULL || url.path[0] == '\0') 522 { 523 url.path = apr_pstrdup(serf_sess->pool, "/"); 524 } | 517 SVN_ERR(svn_ra_serf__uri_parse(&url, session_URL, serf_sess->pool)); 518 |
525 if (!url.port) 526 { 527 url.port = apr_uri_port_of_scheme(url.scheme); 528 } 529 serf_sess->session_url = url; 530 serf_sess->session_url_str = apr_pstrdup(serf_sess->pool, session_URL); 531 serf_sess->using_ssl = (svn_cstring_casecmp(url.scheme, "https") == 0); 532 --- 203 unchanged lines hidden (view full) --- 736 new_sess->pool)); 737 738 if (new_sess->server_allows_bulk) 739 new_sess->server_allows_bulk = apr_pstrdup(result_pool, 740 new_sess->server_allows_bulk); 741 742 new_sess->repos_root_str = apr_pstrdup(result_pool, 743 new_sess->repos_root_str); | 519 if (!url.port) 520 { 521 url.port = apr_uri_port_of_scheme(url.scheme); 522 } 523 serf_sess->session_url = url; 524 serf_sess->session_url_str = apr_pstrdup(serf_sess->pool, session_URL); 525 serf_sess->using_ssl = (svn_cstring_casecmp(url.scheme, "https") == 0); 526 --- 203 unchanged lines hidden (view full) --- 730 new_sess->pool)); 731 732 if (new_sess->server_allows_bulk) 733 new_sess->server_allows_bulk = apr_pstrdup(result_pool, 734 new_sess->server_allows_bulk); 735 736 new_sess->repos_root_str = apr_pstrdup(result_pool, 737 new_sess->repos_root_str); |
744 status = apr_uri_parse(result_pool, new_sess->repos_root_str, 745 &new_sess->repos_root); 746 if (status) 747 return svn_ra_serf__wrap_err(status, NULL); | 738 SVN_ERR(svn_ra_serf__uri_parse(&new_sess->repos_root, 739 new_sess->repos_root_str, 740 result_pool)); |
748 749 new_sess->session_url_str = apr_pstrdup(result_pool, new_session_url); 750 | 741 742 new_sess->session_url_str = apr_pstrdup(result_pool, new_session_url); 743 |
751 status = apr_uri_parse(result_pool, new_sess->session_url_str, 752 &new_sess->session_url); | 744 SVN_ERR(svn_ra_serf__uri_parse(&new_sess->session_url, 745 new_sess->session_url_str, 746 result_pool)); |
753 | 747 |
754 if (status) 755 return svn_ra_serf__wrap_err(status, NULL); 756 | |
757 /* svn_boolean_t supports_inline_props */ 758 /* supports_rev_rsrc_replay */ 759 760 new_sess->context = serf_context_create(result_pool); 761 762 SVN_ERR(load_config(new_sess, old_sess->config, result_pool)); 763 764 new_sess->conns[0] = apr_pcalloc(result_pool, --- 29 unchanged lines hidden (view full) --- 794/* Implements svn_ra__vtable_t.reparent(). */ 795svn_error_t * 796svn_ra_serf__reparent(svn_ra_session_t *ra_session, 797 const char *url, 798 apr_pool_t *pool) 799{ 800 svn_ra_serf__session_t *session = ra_session->priv; 801 apr_uri_t new_url; | 748 /* svn_boolean_t supports_inline_props */ 749 /* supports_rev_rsrc_replay */ 750 751 new_sess->context = serf_context_create(result_pool); 752 753 SVN_ERR(load_config(new_sess, old_sess->config, result_pool)); 754 755 new_sess->conns[0] = apr_pcalloc(result_pool, --- 29 unchanged lines hidden (view full) --- 785/* Implements svn_ra__vtable_t.reparent(). */ 786svn_error_t * 787svn_ra_serf__reparent(svn_ra_session_t *ra_session, 788 const char *url, 789 apr_pool_t *pool) 790{ 791 svn_ra_serf__session_t *session = ra_session->priv; 792 apr_uri_t new_url; |
802 apr_status_t status; | |
803 804 /* If it's the URL we already have, wave our hands and do nothing. */ 805 if (strcmp(session->session_url_str, url) == 0) 806 { 807 return SVN_NO_ERROR; 808 } 809 810 if (!session->repos_root_str) --- 5 unchanged lines hidden (view full) --- 816 if (!svn_uri__is_ancestor(session->repos_root_str, url)) 817 { 818 return svn_error_createf( 819 SVN_ERR_RA_ILLEGAL_URL, NULL, 820 _("URL '%s' is not a child of the session's repository root " 821 "URL '%s'"), url, session->repos_root_str); 822 } 823 | 793 794 /* If it's the URL we already have, wave our hands and do nothing. */ 795 if (strcmp(session->session_url_str, url) == 0) 796 { 797 return SVN_NO_ERROR; 798 } 799 800 if (!session->repos_root_str) --- 5 unchanged lines hidden (view full) --- 806 if (!svn_uri__is_ancestor(session->repos_root_str, url)) 807 { 808 return svn_error_createf( 809 SVN_ERR_RA_ILLEGAL_URL, NULL, 810 _("URL '%s' is not a child of the session's repository root " 811 "URL '%s'"), url, session->repos_root_str); 812 } 813 |
824 status = apr_uri_parse(pool, url, &new_url); 825 if (status) 826 { 827 return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL, 828 _("Illegal repository URL '%s'"), url); 829 } | 814 SVN_ERR(svn_ra_serf__uri_parse(&new_url, url, pool)); |
830 | 815 |
831 /* Depending the version of apr-util in use, for root paths url.path 832 will be NULL or "", where serf requires "/". */ | |
833 /* ### Maybe we should use a string buffer for these strings so we 834 ### don't allocate memory in the session on every reparent? */ | 816 /* ### Maybe we should use a string buffer for these strings so we 817 ### don't allocate memory in the session on every reparent? */ |
835 if (new_url.path == NULL || new_url.path[0] == '\0') 836 { 837 session->session_url.path = apr_pstrdup(session->pool, "/"); 838 } 839 else 840 { 841 session->session_url.path = apr_pstrdup(session->pool, new_url.path); 842 } | 818 session->session_url.path = apr_pstrdup(session->pool, new_url.path); |
843 session->session_url_str = apr_pstrdup(session->pool, url); 844 845 return SVN_NO_ERROR; 846} 847 848/* Implements svn_ra__vtable_t.get_session_url(). */ 849static svn_error_t * 850svn_ra_serf__get_session_url(svn_ra_session_t *ra_session, --- 282 unchanged lines hidden --- | 819 session->session_url_str = apr_pstrdup(session->pool, url); 820 821 return SVN_NO_ERROR; 822} 823 824/* Implements svn_ra__vtable_t.get_session_url(). */ 825static svn_error_t * 826svn_ra_serf__get_session_url(svn_ra_session_t *ra_session, --- 282 unchanged lines hidden --- |