Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

handle_file_req handler for crossdomain.xml #4

Closed
wants to merge 1 commit into from

2 participants

@joelwreed

Add a new handler, handle_file_req, to serve up files like /crossdomain.xml from a couchdb instance. For example, you could add:

[httpd_global_handlers]
crossdomain.xml = {couch_httpd_misc_handlers, handle_file_req, "/usr/share/couchdb/www/crossdomain.xml" }

To your local.ini to serve up crossdomain.xml.

@joelwreed joelwreed Add a new handler, handle_file_req, to serve up files like /crossdoma…
…in.xml from a couchdb instance. For example, you could add:

[httpd_global_handlers]
crossdomain.xml = {couch_httpd_misc_handlers, handle_file_req, "/usr/share/couchdb/www/crossdomain.xml" }

To your local.ini to serve up crossdomain.xml.
528c52e
@janl

Hi,

Sorry this has been lingering here for so long!

Until very recently, this wasn't an official way to contribute back to Apache CouchDB.

May we kindly request that you check whether this is still an issue and update the PR accordingly?

We are now prepared and more than happy to accept pull requests :)

Cheers
Jan
--

@apage43 apage43 referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@janl

I have committed this to the master branch. This’ll show up in a CouchDB release near you soon :)

Could you close this PR for us (we currently can't, thanks!)

@joelwreed joelwreed closed this pull request from a commit
@joelwreed joelwreed Add couch_httpd_misc_handlers:handle_file_req
This can be used to serve up files like /crossdomain.xml from a
CouchDB instance. For example, you could add:

    [httpd_global_handlers]
    crossdomain.xml = {couch_httpd_misc_handlers, handle_file_req, "/usr/share/couchdb/www/crossdomain.xml" }

To your local.ini to serve up crossdomain.xml.

Closes #4
2774531
@joelwreed joelwreed closed this in 2774531
@asfgit asfgit referenced this pull request from a commit
@dickolsson dickolsson Correction in the request example for HEAD /db/doc
This closes #4

Signed-off-by: Alexander Shorin <kxepal@apache.org>
1c142b2
@candeira candeira referenced this pull request from a commit in candeira/couchdb
@joelwreed joelwreed Add couch_httpd_misc_handlers:handle_file_req
This can be used to serve up files like /crossdomain.xml from a
CouchDB instance. For example, you could add:

    [httpd_global_handlers]
    crossdomain.xml = {couch_httpd_misc_handlers, handle_file_req, "/usr/share/couchdb/www/crossdomain.xml" }

To your local.ini to serve up crossdomain.xml.

Closes #4
c75c732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 31, 2011
  1. @joelwreed

    Add a new handler, handle_file_req, to serve up files like /crossdoma…

    joelwreed authored
    …in.xml from a couchdb instance. For example, you could add:
    
    [httpd_global_handlers]
    crossdomain.xml = {couch_httpd_misc_handlers, handle_file_req, "/usr/share/couchdb/www/crossdomain.xml" }
    
    To your local.ini to serve up crossdomain.xml.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/couchdb/couch_httpd_misc_handlers.erl
View
6 src/couchdb/couch_httpd_misc_handlers.erl
@@ -50,6 +50,12 @@ handle_favicon_req(#httpd{method='GET'}=Req, DocumentRoot) ->
handle_favicon_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").
+handle_file_req(#httpd{method='GET'}=Req, Document) ->
+ couch_httpd:serve_file(Req, filename:basename(Document), filename:dirname(Document));
+
+handle_file_req(Req, _) ->
+ send_method_not_allowed(Req, "GET,HEAD").
+
handle_utils_dir_req(#httpd{method='GET'}=Req, DocumentRoot) ->
"/" ++ UrlPath = couch_httpd:path(Req),
case couch_httpd:partition(UrlPath) of
Something went wrong with that request. Please try again.