Robert Kern wrote:
Please
follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 argument to
make sure that you do not split on spurious b'\r\n\r\n' sequences inside the
JPEG body. Do not decode the bytes.
Correct, and I'll add that this is a case where we might want to be
better
On Thu, 26 Aug 2010 23:56:26 -0700, Bryan wrote:
follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1
argument to make sure that you do not split on spurious b'\r\n\r\n'
sequences inside the JPEG body. Do not decode the bytes.
Correct, and I'll add that this is a case where we
Nobody wrote:
Bryan wrote:
this is a case where we might want to be better
than correct. BaseHTTPRequestHandler in the Python standard library
accommodates clients that incorrectly omit the '\r' and end header lines
with just '\n'. Such apps have been seen in the wild. Since bare '\n'
In message
mailman.64.1282843346.29448.python-l...@python.org, Navkirat Singh wrote:
I receive a jpeg file with the POST method.The file (.jpeg) is encoded in
bytes, I parse the bytes by decoding them to a string. I wanted to know
how i could write the file (now a string) as a jpeg image on
In message mailman.71.1282852048.29448.python-l...@python.org, Navkirat
Singh wrote:
The image bytes are a part of a HTTP header content ( not the message body
).
In which case, won’t they be in some encoding like Base-64? I don’t think
you’re allowed arbitrary binary bytes in an HTTP
On 8/27/10 5:58 PM, Lawrence D'Oliveiro wrote:
In message
mailman.64.1282843346.29448.python-l...@python.org, Navkirat Singh wrote:
I receive a jpeg file with the POST method.The file (.jpeg) is encoded in
bytes, I parse the bytes by decoding them to a string. I wanted to know
how i could
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST method.The
file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a
string. I wanted to know how i could write the file (now a string) as a jpeg
image on disk. When I try to encode the same string to a
Navkirat Singh navkir...@gmail.com writes:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string.
Why?
--
John Bokma
On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
Navkirat Singh navkir...@gmail.com writes:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string.
Why?
--
John Bokma
On 2010-08-26, Navkirat Singh navkir...@gmail.com wrote:
On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
Navkirat Singh navkir...@gmail.com writes:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes
Hi Navkirat,
On 2010-08-26 19:22, Navkirat Singh wrote:
I am programming a webserver, I receive a jpeg file with
the POST method.The file (.jpeg) is encoded in bytes, I
parse the bytes by decoding them to a string. I wanted to
know how i could write the file (now a string) as a jpeg
image on
I am sorry, maybe I was not elaborate in what I was having trouble with. I am
using a jpegcam library, which on my web page captures a webcam image and sends
it to the server via the POST method. On the Server side (python 3), I receive
this image as a part of header content in bytes (I know
On 26/08/2010 19:57, Navkirat Singh wrote:
I am sorry, maybe I was not elaborate in what I was having trouble
with. I am using a jpegcam library, which on my web page captures a
webcam image and sends it to the server via the POST method. On the
Server side (python 3), I receive this image as a
On 8/26/10 1:25 PM, Navkirat Singh wrote:
On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
Navkirat Singhnavkir...@gmail.com writes:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to
On 27-Aug-2010, at 1:10 AM, Robert Kern wrote:
On 8/26/10 1:25 PM, Navkirat Singh wrote:
On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
Navkirat Singhnavkir...@gmail.com writes:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is
On 27-Aug-2010, at 12:45 AM, MRAB wrote:
On 26/08/2010 19:57, Navkirat Singh wrote:
I am sorry, maybe I was not elaborate in what I was having trouble
with. I am using a jpegcam library, which on my web page captures a
webcam image and sends it to the server via the POST method. On the
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST method.The
file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a
string. I wanted to know how i could write the file (now a string) as a jpeg
image on disk. When I try to
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST method.The
file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a
string. I wanted to know how i could write the file (now a
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST method.The
file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a
string. I wanted to know how i could write the file (now a
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string. I wanted to
Navkirat Singh wrote:
O
snip
I am using Python3 and I receive a byte stream with a jpeg attached sent by the
web browser over a socket, which looks like this:
b': image/jpeg\r\nAccept: text/*\r\nReferer:
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip,
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the
Navkirat Singh navkir...@gmail.com writes:
I am using Python3 and I receive a byte stream with a jpeg attached sent
by the web browser over a socket, which looks like this:
b': image/jpeg\r\nAccept: text/*\r\nReferer:
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
On 8/26/10 3:47 PM, Navkirat Singh wrote:
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the
On 26/08/2010 21:47, Navkirat Singh wrote:
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file
On 27-Aug-2010, at 2:40 AM, Robert Kern wrote:
On 8/26/10 3:47 PM, Navkirat Singh wrote:
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver,
On 27-Aug-2010, at 2:48 AM, MRAB wrote:
On 26/08/2010 21:47, Navkirat Singh wrote:
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey guys,
I am programming a webserver, I
On 8/26/10 4:17 PM, Navkirat Singh wrote:
Here is what I needed to do:
a) Separate image content from header content of the byte stream received from
the web browser.
b) Save the image content to disk for further use.
Here is what I did. Following is just a snippet:
On 8/26/10 4:25 PM, Navkirat Singh wrote:
@Robert - Thanks a lot for your time :-) , I did know that the body starts after
the occurrence two CRLF sequences, but I was following RFC2616 as a guide, which
specifically mentions:
The presence of a message-body in a request is signaled by the
On 27-Aug-2010, at 2:58 AM, Navkirat Singh wrote:
On 27-Aug-2010, at 2:48 AM, MRAB wrote:
On 26/08/2010 21:47, Navkirat Singh wrote:
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh
On 8/26/10 4:28 PM, Navkirat Singh wrote:
On 27-Aug-2010, at 2:48 AM, MRAB wrote:
On 26/08/2010 21:47, Navkirat Singh wrote:
On 27-Aug-2010, at 1:57 AM, MRAB wrote:
On 26/08/2010 21:14, Navkirat Singh wrote:
On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
Navkirat Singh wrote:
Hey
On 27-Aug-2010, at 3:02 AM, Robert Kern wrote:
On 8/26/10 4:17 PM, Navkirat Singh wrote:
Here is what I needed to do:
a) Separate image content from header content of the byte stream received
from the web browser.
b) Save the image content to disk for further use.
Here is what I
On 8/26/10 4:17 PM, Navkirat Singh wrote:
#-HERE IS WHERE I RECEIVE THE DATA
while True:
buff = socket.recv(8192)
byteStr +=buff
if not buff: break
Also, you probably shouldn't bother writing an HTTP server using raw
On 27-Aug-2010, at 3:04 AM, Robert Kern wrote:
On 8/26/10 4:25 PM, Navkirat Singh wrote:
@Robert - Thanks a lot for your time :-) , I did know that the body starts
after
the occurrence two CRLF sequences, but I was following RFC2616 as a guide,
which
specifically mentions:
The
On 27-Aug-2010, at 3:15 AM, Robert Kern wrote:
On 8/26/10 4:17 PM, Navkirat Singh wrote:
#-HERE IS WHERE I RECEIVE THE DATA
while True:
buff = socket.recv(8192)
byteStr +=buff
if not buff: break
Also, you probably shouldn't
On 8/26/2010 5:28 PM, Navkirat Singh wrote:
b = b'asdf'
type(b)
class 'bytes'
s = b.split(':')
You are trying to split bytes with a string, which is impossible.
Split bytes with bytes, strings with strings.
Traceback (most recent call last):
File stdin, line 1, inmodule
TypeError: Type
On 27-Aug-2010, at 4:23 AM, Terry Reedy wrote:
On 8/26/2010 5:28 PM, Navkirat Singh wrote:
b = b'asdf'
type(b)
class 'bytes'
s = b.split(':')
You are trying to split bytes with a string, which is impossible.
Split bytes with bytes, strings with strings.
Traceback (most recent call
38 matches
Mail list logo