Commit graph

335 commits

Author SHA1 Message Date
Bond_009 15634a1913 Merge branch 'master' into websocket 2020-05-02 00:54:04 +02:00
Vasily 5922c35d69
Merge pull request #2920 from Bond-009/tests2
Add some simple tests
2020-04-29 12:17:01 +03:00
gion 083d3272d0 Refactor and other minor changes 2020-04-27 22:39:37 +02:00
gion aad5058d25 Implement KeepAlive for WebSockets 2020-04-27 22:39:37 +02:00
Vasily 655208d375 Now parse date in header correctly as being in UTC 2020-04-27 19:03:42 +03:00
Mark Monteiro 93649ad77b Merge remote-tracking branch 'upstream/master' into simplify-https-config 2020-04-26 11:44:42 -04:00
Bond-009 07326c1d9b
Merge branch 'master' into fix-auth-response-codes 2020-04-22 13:16:08 +02:00
Bond_009 7f4a229cd2 Add some simple tests 2020-04-20 10:18:12 +02:00
dkanada d62bd7fecd
fix spelling error 2020-04-19 11:46:22 +09:00
Bond_009 6b959f40ac Fix build 2020-04-17 20:01:25 +02:00
Bond_009 f055995a1f Use System.Buffers in RangeRequestWriter 2020-04-17 14:21:15 +02:00
Vasily 95dc99fdbd
Update Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
Co-Authored-By: Bond-009 <bond.009@outlook.com>
2020-04-16 01:03:29 +03:00
Vasily 9df49cc796 Make Last-Modified and If-Modified-Since headers follow the spec 2020-04-14 01:52:43 +03:00
Mark Monteiro 8b4b4b4127 Do not return the exception message to the client for AuthenticationExceptions 2020-04-13 16:10:55 -04:00
Mark Monteiro a8c3951c17 Only show developer exception page for 500 server exceptions
Other response codes should be returned as normal
2020-04-13 15:26:49 -04:00
Mark Monteiro 53380689ad Return correct status codes for authentication and authorization errors
- Use AuthenticatonException to return 401
- Use SecurityException to return 403
- Update existing throws to throw the correct exception for the circumstance
2020-04-13 13:17:46 -04:00
Mark Monteiro 6d35dd6b32 Clean up SecurityException
- Remove unused SecurityExceptionType
- Add missing constructor for InnerException
- Add missing documentation
2020-04-13 13:13:48 -04:00
Vasily 3bdb5e80a5 More consise error messages 2020-04-13 00:57:11 +03:00
Vasily 058c35e739 Fix log highlithing 2020-04-12 23:40:34 +03:00
Vasily 30f4392872 Fix condition flipped by https://github.com/jellyfin/jellyfin/pull/2635 2020-04-12 23:35:41 +03:00
Vasily 61d9c9df5b Addressing review feedback 2020-04-12 23:26:45 +03:00
Vasily 71d8e66d9f Add logging of URL being processed when logging an error
This might help diagnosing stuff like "Operation was cancelled"
2020-04-06 14:42:41 +03:00
Mark Monteiro 387fa474aa Document HTTPS configuration options 2020-04-02 17:45:33 -04:00
Mark Monteiro ca71ac72ab Replace EnableHttps and SupportsHttps with ListenWithHttps and CanConnectWithHttps 2020-04-02 17:45:04 -04:00
Mark Monteiro de634203d8 Put Boolean operators at beginning of lines instead of the end 2020-04-02 14:31:56 -04:00
Mark Monteiro eadad73117 Merge branch 'master' into use-development-exception-page 2020-04-02 13:51:53 -04:00
Mark Monteiro 123bfbcf19 Merge remote-tracking branch 'upstream/master' into use-development-exception-page 2020-04-01 23:09:55 +02:00
Mark Monteiro 5b1091db27 Merge remote-tracking branch 'upstream/master' into do-not-instantiate-services-at-startup 2020-04-01 23:05:36 +02:00
Bond-009 f31efce52d
Merge branch 'master' into usings 2020-04-01 22:42:43 +02:00
Bond_009 e9d1eabd53 Remove unused usings 2020-03-24 16:12:06 +01:00
Mark Monteiro 72c822513f Create ServiceController via DI instead of manual construction 2020-03-21 23:18:41 +01:00
Mark Monteiro dc140429fe Do not create unnecessary instances of IService at server startup 2020-03-21 23:17:30 +01:00
Mark Monteiro 842ec04828 Do not handle exceptions manually when in development mode 2020-03-21 21:06:01 +01:00
Mark Monteiro 92628c4033 Clean up HTTP listener exception handling 2020-03-21 21:04:16 +01:00
Mark Monteiro e2685c51ec Merge remote-tracking branch 'upstream/master' into support-running-without-web-content 2020-03-15 18:07:02 +01:00
Mark Monteiro 6fbdf0d6a2 Construct ApplicationHost with DI framework instead of manually 2020-03-15 15:28:29 +01:00
Bond-009 94fe9b8f6d
Merge branch 'master' into warn17 2020-03-11 20:26:43 +01:00
Mark Monteiro 3f4b9e9a81 Add new 'nowebcontent' configuration flag 2020-02-28 20:40:45 +01:00
Mark Monteiro 3043b7323b Use constants for settings keys 2020-02-28 17:57:38 +01:00
Bond_009 07cc4be6a7 Fix some warnings
* Add analyzers to MediaBrowser.XbmcMetadata
* Enable TreatWarningsAsErrors for MediaBrowser.XbmcMetadata
* Add analyzers to MediaBrowser.WebDashboard
* Enable TreatWarningsAsErrors for MediaBrowser.WebDashboard
* Disable SA1600 in favor of CS1591
2020-02-23 12:11:43 +01:00
Bond_009 7060934792 Fix some warnings in Emby.Server.Implementations 2020-02-06 15:21:38 +01:00
Bond_009 c751ba9f70 Fix build 2020-01-22 22:27:03 +01:00
Bond-009 c8409d2ea1 Remove FileSystem.GetStream 2020-01-22 22:20:35 +01:00
Bond-009 ee964f8a58 Don't log message info 2020-01-13 20:06:08 +01:00
Bond-009 d01ba49be3 Fix space 2020-01-13 20:06:08 +01:00
Bond-009 f89e18ea26 Improve error handling 2020-01-13 20:06:08 +01:00
Bond-009 bdd823d22f Handle unexpected disconnect 2020-01-13 20:06:08 +01:00
Bond-009 8865b3ea3d Remove dead code and improve logging 2020-01-13 20:06:08 +01:00
Bond-009 4d311870d2 Fix websocket handling 2020-01-13 20:06:08 +01:00
Bond_009 5ca68f9623 Fix nullref exception and added logging 2020-01-13 20:06:08 +01:00
Bond_009 976459d3e8 Rewrite WebSocket handling code 2020-01-13 20:06:08 +01:00
Bond_009 2ef4ffd698 More warnings (removed) 2019-12-11 00:13:57 +01:00
Bond-009 affb58ef9e
Apply suggestions from code review
Co-Authored-By: dkanada <dkanada@users.noreply.github.com>
2019-12-10 16:22:03 +01:00
Bond_009 42ffddc269 Fix more warnings 2019-11-27 16:29:56 +01:00
Vasily 5263aaa026
Merge pull request #1503 from cvium/webapi_v2
Move StartupWizard to ASP.NET Web Api
2019-11-27 11:50:06 +03:00
Claus Vium 2af5922af0 Fix review comments 2019-11-24 18:25:43 +01:00
Claus Vium 27e3cf1558 Move appbuilder and service collection to Jellyfin.Server 2019-11-24 15:27:58 +01:00
Claus Vium 3f651de24c Add authentication and remove versioning 2019-11-23 16:31:02 +01:00
Bond-009 b477b3874e Fix some warnings 2019-11-22 16:15:31 +01:00
Bond-009 b14d6d0417 Fix GetPathValue function 2019-11-13 16:32:33 +01:00
Vasily 6b6fede2e0 Address review comments 2019-10-16 16:13:59 +03:00
Vasily 82f8345aa5 Log to debug all HTTP 500 response urls 2019-10-14 13:22:53 +03:00
Vasily 1176749f14
Merge pull request #1863 from joshuaboniface/fix-baseurl-issues
Fix inconsistent BaseUrl behavior
2019-10-09 19:24:41 +03:00
Joshua Boniface b96079fee6 Make NormalizeUrlPath static 2019-10-09 09:22:55 -04:00
Vasily 03450f383f Fix template for logging 2019-10-09 14:05:32 +03:00
Vasily 8109c7eb30 Always log at least error message when error happens during request processing 2019-10-09 14:00:22 +03:00
Vasily 33b69a7099 Set response length and mime type correctly when reporting an error 2019-10-09 13:54:05 +03:00
Joshua Boniface 2a79ae0a6e Normalize baseUrl behaviour
Fully normalizes the baseUrl behaviour to better match how this sort of
feature works in other programs.

1. The baseUrl is always appended to paths, even the built-in `/emby`
and `/mediabrowser` paths.
2. The baseUrl is set statically at class instance creation, to ensure
it persists through changes until the next restart.
3. Configuration is normalized using a function when set, to ensure it's
in a standard `/mypath` format with leading `/`.
4. Cleans up the conditionals around default redirects. For sanity after
changing the URL, it will match *any* path that doesn't match the
current baseUrl and redirect it back to the main page (with baseUrl).
5. Adds a second method, NormalizeUrlPath, to avoid lots of `+ "/" +`
string manipulations which are unclean - we should always have a leading
slash.
6. Sets the default baseUrl to an empty string to avoid unexpected
behaviour, though this would be worked-around automatically.
7. Adds some debug logs whenever a URL is normalized, to help track down
issues with this code (if any arise).
2019-10-08 18:06:03 -04:00
Vasily fc99f1f563
Merge pull request #1785 from dkanada/compat
Add mediabrowser route back for now
2019-09-25 14:18:21 +03:00
dkanada b5b7db1f32 add an exception to logging 2019-09-24 23:59:24 +09:00
dkanada ab7e697f30 add mediabrowser route back for now 2019-09-24 23:59:24 +09:00
Bond_009 c9820d30ed Fix multiple mistakes and warnings 2019-09-23 20:32:44 +02:00
Erik Larsson 74864832ca Set log level to debug for HTTP range requests
This removes some spam when a DLNA renderer uses byte seeking.
2019-09-18 18:29:15 +02:00
Bond-009 ee637e8fec Fix warnings, improve performance (#1665)
* Fix warnings, improve performance

`QueryResult.Items` is now a `IReadOnlyList` so we don't need to
allocate a new `Array` when we have a `List` (and `Items` shouldn't need to
be mutable anyway)

* Update Providers .csproj to latest C#

* Remove extra newline from DtoService.cs

* Remove extra newline from UserLibraryService.cs
2019-09-02 02:19:29 -04:00
dkanada 97d6c2db6b keep old base url for now 2019-08-11 00:35:18 -07:00
dkanada d521e5c36a add base url to server configuration 2019-08-11 00:35:18 -07:00
dkanada c987203f5a remove old routes from http server 2019-08-11 00:33:13 -07:00
Bond_009 9fff4b060e Replace custom code with Asp.Net Core code 2019-08-09 22:36:20 +02:00
Erik Larsson 0e6417c9fa Set log level to debug for HTTP range requests 2019-08-03 12:37:02 +02:00
Bond-009 ce1fa42f9d
Merge branch 'master' into tasks 2019-06-01 17:06:01 +02:00
Joshua M. Boniface 2bc378a9c3
Merge pull request #1337 from jellyfin/release-10.3.z
Backmerge for 10.3.2 release
2019-04-30 23:35:11 -04:00
Bond-009 61d7bed181
Merge pull request #1304 from jellyfin/release-10.3.z
Backmerge 10.3.1
2019-04-25 07:27:37 +02:00
Bond_009 71479286e9 Fix #1234 2019-04-24 19:56:57 +02:00
Claus Vium 28c2ac528d Re-add content length, semi revert of changes in #1010 (#1287)
* Re-add content length, semi revert of changes in #1010
2019-04-24 14:06:54 +02:00
Bond-009 a8da122fb3
Merge pull request #1252 from jellyfin/release-10.3.z
Backmerge release 10.3.0
2019-04-20 12:25:29 +02:00
Joshua Boniface 250e0c75df Add MethodNotAllowedException with code 405 2019-04-17 22:31:06 -04:00
Joshua M. Boniface c3532b92f7
Merge pull request #1158 from Bond-009/httpclean
Reduce complexity http routes
2019-04-17 22:12:17 -04:00
Bond-009 a332092769 Reduce complexity http routes 2019-03-26 19:20:40 +01:00
Bond-009 b44a70ff36 Simplify/remove/clean code
* Remove useless runtime check (we only support one)
* Remove unused args
* Remove a global constant

And ofc fix some warnings ;)
2019-03-25 22:25:32 +01:00
Bond_009 2696ac5eac Lower the amount of running tasks 2019-03-25 21:33:48 +01:00
Bill Thornton 4cd8903abc Fix default value for Expires header 2019-03-19 23:13:02 -04:00
Bond-009 e64aaebbac Improvements around streams
* Use ArrayPool instead of allocating new buffers each time
* Remove NetworkStream copy
* Remove some dead code
2019-03-13 21:11:01 +01:00
Claus Vium e3b844b5aa Add urlprefixes during init 2019-03-07 22:49:41 +01:00
Claus Vium 3fa43a1e08 Don't set status code if response is closed 2019-03-07 22:26:23 +01:00
Claus Vium dfff68b2f4 Make SkipLogExtensions static 2019-03-07 19:05:53 +01:00
Claus Vium bba049c987 Make FileSystem readonly 2019-03-06 19:29:25 +01:00
Claus Vium 446f9bf81f Remove more Content-Length references 2019-03-05 20:48:04 +01:00
Claus Vium 913e80fd55 Add ProcessWebSocketRequest to IHttpListener 2019-03-05 20:35:07 +01:00
Claus Vium 9a4a01fb0e Fix DI in FileWriter.TransmitFile 2019-03-05 19:32:22 +01:00
Claus Vium 78742b8e4c Switch to HeaderNames instead of hardcoded strings (and other header related fixes) 2019-03-05 19:20:28 +01:00
Claus Vium bc00617df7 Remove unused Brotli compressor 2019-03-05 10:26:43 +01:00
Claus Vium 51648a2a21 Remove unused _listener 2019-03-05 08:05:42 +01:00
Claus Vium 0250204f14 Expand todo 2019-03-04 22:26:57 +01:00
Claus Vium 9020f68ce1 Use QueryHelpers.AddQueryString 2019-03-04 20:08:54 +01:00
Claus Vium e823c11b46 Add certificate to https and minor cleanup 2019-03-03 08:29:23 +01:00
Claus Vium fb1de5a921 Remove more cruft and add the beginnings of a socket middleware 2019-02-27 23:22:55 +01:00
Claus Vium c0b95dbc79 Fix query log for real 2019-02-27 20:11:40 +01:00
Claus Vium 647adc51c8 Fix query log 2019-02-27 19:55:25 +01:00
Claus Vium 27e7e792b3 Replace some usage of QueryParamCollection 2019-02-27 14:23:39 +01:00
Claus Vium 333bd2107a Remove HttpUtility 2019-02-27 12:40:18 +01:00
Claus Vium 848cfc32cc More cleanup 2019-02-26 22:57:59 +01:00
Claus Vium e342b7bc71 Extend the IHttpServer interface to avoid the typecasting 2019-02-26 22:11:21 +01:00
Claus Vium f1c93ae618 Remove SetContentLength and company 2019-02-26 22:11:21 +01:00
Claus Vium 4e8de67aca Remove SocketSharp from Jellyfin.Server and some other cleanup 2019-02-26 22:11:21 +01:00
Claus Vium a85488cd20 Fix websockets array index out of bounds and some cleanup 2019-02-26 22:11:21 +01:00
Claus Vium f3e7bc0573 Replace some todos with http extensions and prepare some socket work 2019-02-26 22:11:21 +01:00
Claus Vium 852460b991 kestrel init 2019-02-26 22:11:21 +01:00
Claus Vium 4db31acff9 Begin removing System.Net sources 2019-02-26 22:11:21 +01:00
Bond-009 0804bed66d Log time in a standardized way 2019-02-26 19:40:23 +01:00
Bond_009 0f9006c81f Use stopwatch for more accurate measurements and reduce log spam
DateTime.Now is suitible for small timespans
Replaced the needlessly complex and verbose logging for the httpserver
2019-02-25 18:26:17 +01:00
Joshua M. Boniface 89d4ce309d
Merge pull request #848 from Bond-009/perf
Minor changes to reduce allocations
2019-02-19 21:24:51 -05:00
Vasily 13f2783a8e
Merge pull request #887 from wtayl0r/replace-primitives-with-iconfiguration
Replace primitive injection with IConfiguration
2019-02-18 19:30:11 +03:00
William Taylor 18ae107ce4 Removed unnecessary configuration options and reduced primitive dependencies 2019-02-17 14:09:52 +00:00
Claus Vium c720504e39 Drop ETag and use Last-Modified header (#890)
Drop ETag and use Last-Modified since performance is much better
2019-02-13 21:08:59 +01:00
Bond-009 3f13851be5 Address comments 2019-02-12 21:06:47 +01:00
Bond_009 8d98885cda Less string allocations 2019-02-12 21:06:47 +01:00
Bond_009 a709cbdc64 Fix more analyzer warnings 2019-01-27 12:12:44 +01:00
Claus Vium df5e87409a Fix trim input 2019-01-22 22:40:06 +01:00
Claus Vium 94789860b1 Trim quotes from If-None-Match 2019-01-22 22:37:26 +01:00
Claus Vium fd6d35e1d0 Remove unconditional caching, modified since header and use ETags 2019-01-22 21:18:48 +01:00
William Taylor 65cd3ed597 Replaced injections of ILogger with ILoggerFactory
This makes resolving dependencies from the container much easier as
you cannot resolve with primitives parameters in a way that is any
more readable.

The aim of this commit is to change as little as possible with the end
result, loggers that were newed up for the parent object were given the same
name. Objects that used the base or app loggers, were given a new logger with
an appropriate name.

Also removed some unused dependencies.
2019-01-20 21:05:12 +00:00
cvium b35dcbb9f0 Remove MediaBrowser.Text since it violates licenses and is overall hacky 2019-01-20 06:30:50 +01:00
Erwin de Haan e63b18f17d Reformat JustAMan review second pass changes. 2019-01-19 14:30:23 +01:00
Erwin de Haan d116efe1f7 Merge branch 'dev' into reformat 2019-01-18 17:04:01 +01:00
Erwin de Haan 321c440739 Reformat JustAMan review pt1 changes
Refs #575
2019-01-17 20:24:01 +01:00
Bond-009 d0980f0da5 Update HttpListenerHost.cs 2019-01-16 19:13:13 +01:00
Bond-009 900dc851e6 Merge branch 'dev' into cleanup 2019-01-16 19:10:42 +01:00
Erwin de Haan 49b61f238e Merge branch 'dev' into reformat
# Conflicts:
#	Emby.Server.Implementations/ApplicationHost.cs
#	Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
#	Emby.Server.Implementations/LiveTv/LiveTvManager.cs
#	Emby.Server.Implementations/Security/MBLicenseFile.cs
#	Emby.Server.Implementations/Security/PluginSecurityManager.cs
#	Emby.Server.Implementations/Security/RegRecord.cs
#	MediaBrowser.Api/PluginService.cs
#	MediaBrowser.Api/System/SystemService.cs
#	MediaBrowser.Common/Security/IRequiresRegistration.cs
#	MediaBrowser.Common/Security/ISecurityManager.cs
#	MediaBrowser.Common/Security/PaymentRequiredException.cs
#	MediaBrowser.Model/Entities/MBRegistrationRecord.cs
#	MediaBrowser.Model/Entities/PluginSecurityInfo.cs
#	deployment/win-generic/build-jellyfin.ps1
2019-01-15 17:34:39 +01:00
Claus Vium eca3c099d9 removed a bunch of validation, security, registration, premiere, whatever bs 2019-01-15 16:48:21 +01:00
Erwin de Haan e867446437 ReSharper format: conform inline 'out' parameters. 2019-01-13 21:46:33 +01:00
Erwin de Haan 65bd052f3e ReSharper conform to 'var' settings 2019-01-13 21:37:13 +01:00
Erwin de Haan e566d9a231 Find+Sed BOM removal *.cs: BDInfo-Emby.XmlTv 2019-01-13 20:54:44 +01:00
Erwin de Haan c5c7a3c4ee Visual Studio Reformat: Emby.Server.Implementations Part De-H 2019-01-13 20:20:41 +01:00
Erwin de Haan e2751d42e8 Merge branch 'dev' into code-cleanup 2019-01-11 12:50:36 +01:00
Erwin de Haan ec1f5dc317 Mayor code cleanup
Add Argument*Exceptions now use proper nameof operators.

Added exception messages to quite a few Argument*Exceptions.

Fixed rethorwing to be proper syntax.

Added a ton of null checkes. (This is only a start, there are about 500 places that need proper null handling)

Added some TODOs to log certain exceptions.

Fix sln again.

Fixed all AssemblyInfo's and added proper copyright (where I could find them)

We live in *current year*.

Fixed the use of braces.

Fixed a ton of properties, and made a fair amount of functions static that should be and can be static.

Made more Methods that should be static static.

You can now use static to find bad functions!

Removed unused variable. And added one more proper XML comment.
2019-01-10 20:38:53 +01:00
hawken bd169e4fd4 remove trailing whitespace 2019-01-07 23:27:46 +00:00
Bond_009 07a8e49c4b Cleanup some small things 2019-01-06 20:35:36 +01:00
Bond_009 a997bb609f Remove unnecessary using statements 2019-01-05 01:49:52 +03:00
Bond_009 391b48614d Remove FireEventIfNotNull
It's a pretty useless "helper" class
2019-01-05 01:49:52 +03:00
Bond_009 ea4c914123 Fix exception logging 2018-12-30 22:44:39 +01:00