Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new apache date format for file listings in http sources #4610

Merged
merged 1 commit into from
Jun 11, 2014

Conversation

zipleen
Copy link
Contributor

@zipleen zipleen commented Apr 26, 2014

According to Apache source code ( http://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/generators/mod_autoindex.c ), the date format changed long time ago from "10-jan-2014" to "2014-01-10" .

apr_strftime(time_str, &rv, sizeof(time_str),
                                 "%Y-%m-%d %H:%M  ",
                                 &ts);

Before the date format was: "%d-%b-%Y %H:%M "

I didn't find the specific svn revision where this changed, but Apache 2.2 already had this date format for a long time.

This patch adds a new apache date file format so it's compatible with old and new versions of mod_autoindex.
I added CDateTime::MonthNumToMonthString in order to not touch the rest of the code.

year = reDateTimeApacheNewFormat.GetMatch(1);
hour = reDateTimeApacheNewFormat.GetMatch(4);
minute = reDateTimeApacheNewFormat.GetMatch(5);
}

This comment was marked as spam.

@zipleen
Copy link
Contributor Author

zipleen commented Apr 26, 2014

Sorry about the spaces, Xcode defaults to 4 spaces =)
I added that method to CDateTime in order to not change anything else on the rest of the code. But if this change is acceptable, I guess it's way better than having to convert an int to a string to then be converted back to an int.

Tested this on old apache format and new apache format, seems to work fine.

@jmarshallnz
Copy link
Contributor

Agreed - mayaswell save on the conversion.

@MartijnKaijser MartijnKaijser modified the milestone: Pending for inclusion May 2, 2014
@MartijnKaijser
Copy link
Member

jenkins build this please


if (month.length() > 0) {
monthNum = CDateTime::MonthStringToMonthNum(month);
}

This comment was marked as spam.

This comment was marked as spam.

@jmarshallnz
Copy link
Contributor

Thanks - please squash down to a single commit.

@zipleen
Copy link
Contributor Author

zipleen commented Jun 11, 2014

Squashed. Hope it's all good =)

@jmarshallnz
Copy link
Contributor

Thanks!

jenkins build this please.

jmarshallnz added a commit that referenced this pull request Jun 11, 2014
Add new apache date format for file listings in http sources
@jmarshallnz jmarshallnz merged commit 5601383 into xbmc:master Jun 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants