Uh oh!
There was an error while loading. Please reload this page.
gh-113471: Add custom default Content-Type to http.server - #113475
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
This change need tests.
I am not sure how much useful is this feature. It only allows to override the MIME type of unrecognized types. And would not it be simpler to configure your browser?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…QMpbI.rst Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
encukou
left a comment
There was a problem hiding this comment.
The feature looks useful to me; I've wanted it once or twice before. However, adding it would be a lot work. Not sure if it's worth your time.
The change needs documentation (in Doc/library/http.server.rst, both for the attribute and CLI option).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
donbarbos
commented
Mar 8, 2025
@jcomeauictx are you going to continue working on this PR? |
jcomeauictx
commented
Mar 8, 2025
I've forgotten what else needs to be done. And in any case, nobody else seems interested in it. |
| python -m http.server --default-content-type text/html | ||
| .. versionchanged:: 3.13 |
There was a problem hiding this comment.
| .. versionchanged:: 3.13 | |
| .. versionchanged:: next |
donbarbos
commented
Mar 8, 2025
I'm interested :) |
jcomeauictx
commented
Mar 8, 2025
OK, I'll look into it tomorrow. No idea where to add them, though, or what precisely needs to be tested. |
jcomeauictx
commented
Mar 16, 2025
via email
"move the description of this flag to the right place", what does that
mean? Could you please do it? I just corrected the hyphenation. …On Sun, Mar 16, 2025 at 6:10 AM donBarbos ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Doc/library/http.server.rst
<#113475 (comment)>:
> +By default, the server uses the MIME type ``'application/octet-stream'`` for
+the ``Content-Type`` header when the content type cannot be guessed from the
+URL's extension (if any). The option ``--default-content-type`` overrides
+this default with one of the user's choosing::
+
+ python -m http.server --default-content-type text/html
+
+.. versionchanged:: next
+ Added the ``--default-content-type`` option.
@jcomeauictx <https://github.com/jcomeauictx> we added usage of ..
option:: directory for CLI flags, we also need to move the description of
this flag to the right place, could you move it? (I also forgot the second
- before default-content-type, please add it :)
—
Reply to this email directly, view it on GitHub
<#113475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRUXUAWLKM3YQ2WNDDTZL2UVZ5XAVCNFSM6AAAAABYSPI2O6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMOBYGY3DSNJZGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
-- John Comeau KE5TFZ WSEE965 ***@***.***> ***@***.***>
http://jc.unternet.net/
"A place for everything, and everything all over the place" |
donbarbos
commented
Mar 16, 2025
Sorry I can't. I mean move on to the rest options |
jcomeauictx
commented
Mar 16, 2025
via email
OK, please check that I did it right. …On Sun, Mar 16, 2025 at 7:59 AM donBarbos ***@***.***> wrote:
Sorry I can't. I mean move on to the rest options
—
Reply to this email directly, view it on GitHub
<#113475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRUXV7CQROXHJA4WOQ2N32UWGTPAVCNFSM6AAAAABYSPI2O6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRXGQ4DKNRZHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: donBarbos]*donBarbos* left a comment (python/cpython#113475)
<#113475 (comment)>
Sorry I can't. I mean move on to the rest options
—
Reply to this email directly, view it on GitHub
<#113475 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRUXV7CQROXHJA4WOQ2N32UWGTPAVCNFSM6AAAAABYSPI2O6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRXGQ4DKNRZHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
-- John Comeau KE5TFZ WSEE965 ***@***.***> ***@***.***>
http://jc.unternet.net/
"A place for everything, and everything all over the place" |
This PR is stale because it has been open for 30 days with no activity. |
hugovk
commented
Apr 15, 2026
I've resolved the merge conflict and pushed some minor docs things.
Should Also,
|
jcomeauictx
commented
Apr 15, 2026
I think I had a reason to put it in BaseRequestHandler, but it's been a long time and I've moved on to other things. Do what seems best. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Documentation build overview
8 files changed · |
Uh oh!
There was an error while loading. Please reload this page.
hugovk
commented
Apr 30, 2026
Thanks! |
Uh oh!
There was an error while loading. Please reload this page.