Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4cbe95cd
Kaydet (Commit)
4cbe95cd
authored
Agu 07, 2004
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[Bug #866222] Update docs to match the module
üst
b839c1f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
libsimplehttp.tex
Doc/lib/libsimplehttp.tex
+15
-7
No files found.
Doc/lib/libsimplehttp.tex
Dosyayı görüntüle @
4cbe95cd
...
@@ -33,7 +33,7 @@ is defined in the module.
...
@@ -33,7 +33,7 @@ is defined in the module.
\begin{memberdesc}
{
extensions
_
map
}
\begin{memberdesc}
{
extensions
_
map
}
A dictionary mapping suffixes into MIME types. Default is signified
A dictionary mapping suffixes into MIME types. Default is signified
by an empty string, and is considered to be
\code
{
text/plain
}
.
by an empty string, and is considered to be
\code
{
application/octet-stream
}
.
The mapping is used case-insensitively, and so should contain only
The mapping is used case-insensitively, and so should contain only
lower-cased keys.
lower-cased keys.
\end{memberdesc}
\end{memberdesc}
...
@@ -51,15 +51,23 @@ headers.
...
@@ -51,15 +51,23 @@ headers.
The request is mapped to a local file by interpreting the request as
The request is mapped to a local file by interpreting the request as
a path relative to the current working directory.
a path relative to the current working directory.
If the request was mapped to a directory, a
\code
{
403
}
respond is output,
If the request was mapped to a directory, the directory is checked for
followed by the explanation
\code
{
'Directory listing not supported'
}
.
a file named
\code
{
index.html
}
or
\code
{
index.htm
}
(in that order).
Any
\exception
{
IOError
}
exception in opening the requested file, is mapped
If found, the file's contents are returned; otherwise a directory
to a
\code
{
404
}
,
\code
{
'File not found'
}
error. Otherwise, the content
listing is generated by calling the
\method
{
list
_
directory()
}
method.
type is guessed using the
\var
{
extensions
_
map
}
variable.
This method uses
\function
{
os.listdir()
}
to scan the directory, and
returns a
\code
{
404
}
error response if the
\function
{
listdir()
}
fails.
If the request was mapped to a file, it is opened and the contents are
returned. Any
\exception
{
IOError
}
exception in opening the requested
file is mapped to a
\code
{
404
}
,
\code
{
'File not found'
}
error. Otherwise, the content type is guessed using the
\var
{
extensions
_
map
}
variable.
A
\code
{
'Content-type:'
}
with the guessed content type is output, and
A
\code
{
'Content-type:'
}
with the guessed content type is output, and
then a blank line, signifying end of headers, and then the contents of
then a blank line, signifying end of headers, and then the contents of
the file. The file is always opened in binary mode.
the file. If the file's MIME type starts with
\code
{
text/
}
the file is
opened in text mode; otherwise binary mode is used.
For example usage, see the implementation of the
\function
{
test()
}
For example usage, see the implementation of the
\function
{
test()
}
function.
function.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment