On 8/27/10 5:58 PM, Lawrence D'Oliveiro wrote:
In message
, 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 disk.
In message , 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 header.
--
http://mail.python.org/mailman/listinfo/pyt
In message
, 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 disk.
I assume the JPEG data is received along wi
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
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 wh
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
bette
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)
>>
> s = b.split(':')
>
> You are trying to split bytes with a string, which is impossible.
> Split bytes with bytes, strings with strings.
>
>> Traceback (most r
On 8/26/2010 5:28 PM, Navkirat Singh wrote:
b = b'asdf'
type(b)
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 "", line 1, in
TypeError: Type str doesn't support th
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 probab
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:
>
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 s
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.
>>
>> Her
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 guys,
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
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 incl
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 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,
>>
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,
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 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 encod
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 (.j
Navkirat Singh 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:
>>> 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 encod
Navkirat Singh wrote:
O
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,
deflate\r\nContent
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
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 f
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 f
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 enco
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
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 Singh writes:
>>>
Hey guys,
I am programming a webserver, I receive a jpeg file with the POST
method.The file (.
On 8/26/10 1:25 PM, Navkirat Singh wrote:
On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
Navkirat Singh 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?
-
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 p
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 tha
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
> imag
On 2010-08-26, Navkirat Singh wrote:
>
> On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
>
>> Navkirat Singh 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
On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
> Navkirat Singh 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
Navkirat Singh 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 j3b
Blog:
37 matches
Mail list logo