<commit_before>Introduction
____________

Apple's Software Update service has the ability to offer the "correct" catalog to a client that requests simply "index.sucatalog". This ability was first added with OS X Server 10.6.6, and involved the use of Apache's mod_rewrite.

This feature is handy, as it greatly simplifies client configuration. You no longer need to take client OS version into consideration when setting the CatalogURL for the client.

Lion Server's Software Update service has a similar capability, but this is done via a CGI instead.

Since Reposado doesn't handle the web-serving part of offering Apple software updates, Reposado itself cannot provide a similar feature: instead you must configure your web server to do URL rewrites, or write your own CGI to provide this functionality.

mod_rewrite example
___________________

If you are using Apache2 as your webserver, you may be able to configure mod_rewrite to return the "correct" OS-specific sucatalog:

Here is an example .htaccess file you could place at the root of your Reposado repo:

RewriteEngine On
Options FollowSymLinks
RewriteBase  /
RewriteCond %{HTTP_USER_AGENT} Darwin/8
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/index$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/9
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/10
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-leopard-snowleopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/11
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]

(This requires Apache2 to be configured to actually pay attention to mod_rewrite rules in .htaccess files. See your Apache and mod_rewrite documentation for details.)

(Note that the format for these rules is specific for use in an .htaccess file. The rules would need to be changed if in the main Apache config file.)

Non-Apache servers
------------------

Other web servers support URL rewriting; the specifics are slightly different, but the general concepts are similar.

Heig Gregorian has contributed this example of an Nginx configuration. This is an excerpt from the 'server' section of his Nginx config:

## 10.4.x - Tiger
if ( $http_user_agent ~ "Darwin/8" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/index$1.sucatalog last;
}
## 10.5.x - Leopard
if ( $http_user_agent ~ "Darwin/9" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-leopard.merged-1$1.sucatalog last;
}
## 10.6.x - Snow Leopard
if ( $http_user_agent ~ "Darwin/10" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-leopard-snowleopard.merged-1$1.sucatalog last;
}
## 10.7.x - Lion
if ( $http_user_agent ~ "Darwin/11" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1.sucatalog last;
}
## 10.8.x - Mountain Lion
if ( $http_user_agent ~ "Darwin/12" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog last;
}

Again, consult Nginx documentation for further information about URL rewriting.

Testing
_______<commit_msg>Update URL rewrites docs for unreleased version of OS X.<commit_after>Introduction
____________

Apple's Software Update service has the ability to offer the "correct" catalog to a client that requests simply "index.sucatalog". This ability was first added with OS X Server 10.6.6, and involved the use of Apache's mod_rewrite.

This feature is handy, as it greatly simplifies client configuration. You no longer need to take client OS version into consideration when setting the CatalogURL for the client.

Lion Server's Software Update service has a similar capability, but this is done via a CGI instead.

Since Reposado doesn't handle the web-serving part of offering Apple software updates, Reposado itself cannot provide a similar feature: instead you must configure your web server to do URL rewrites, or write your own CGI to provide this functionality.

mod_rewrite example
___________________

If you are using Apache2 as your webserver, you may be able to configure mod_rewrite to return the "correct" OS-specific sucatalog:

Here is an example .htaccess file you could place at the root of your Reposado repo:

RewriteEngine On
Options FollowSymLinks
RewriteBase  /
RewriteCond %{HTTP_USER_AGENT} Darwin/8
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/index$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/9
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/10
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-leopard-snowleopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/11
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/12
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]
RewriteCond %{HTTP_USER_AGENT} Darwin/13
RewriteRule ^index(.*)\.sucatalog$ content/catalogs/others/index-10.9-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog [L]


(This requires Apache2 to be configured to actually pay attention to mod_rewrite rules in .htaccess files. See your Apache and mod_rewrite documentation for details.)

(Note that the format for these rules is specific for use in an .htaccess file. The rules would need to be changed if in the main Apache config file.)

Non-Apache servers
------------------

Other web servers support URL rewriting; the specifics are slightly different, but the general concepts are similar.

Heig Gregorian has contributed this example of an Nginx configuration. This is an excerpt from the 'server' section of his Nginx config:

## 10.4.x - Tiger
if ( $http_user_agent ~ "Darwin/8" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/index$1.sucatalog last;
}
## 10.5.x - Leopard
if ( $http_user_agent ~ "Darwin/9" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-leopard.merged-1$1.sucatalog last;
}
## 10.6.x - Snow Leopard
if ( $http_user_agent ~ "Darwin/10" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-leopard-snowleopard.merged-1$1.sucatalog last;
}
## 10.7.x - Lion
if ( $http_user_agent ~ "Darwin/11" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-lion-snowleopard-leopard.merged-1$1.sucatalog last;
}
## 10.8.x - Mountain Lion
if ( $http_user_agent ~ "Darwin/12" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog last;
}
## 10.9.x - Mavericks
if ( $http_user_agent ~ "Darwin/13" ){
  rewrite ^/index(.*)\.sucatalog$ /content/catalogs/others/index-10.9-mountainlion-lion-snowleopard-leopard.merged-1$1.sucatalog last;
}

Again, consult Nginx documentation for further information about URL rewriting.

Testing
_______
{'fraction_non_alphanumeric': 0.10611907386990077, 'fraction_numerical': 0.017502756339581035, 'mean_word_length': 4.764098490865766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '771143', 'n_tokens_mistral': 2495, 'n_tokens_neox': 2258, 'n_words': 731}