Navigation

  • index
  • next |
  • previous |
  • webby 3.0 documentation »

In-class Links - Feb 28th, 2012¶

Check out Brendan’s code:

https://github.com/kienlebr/meep/blob/master/serve2.py

Will this work for large requests?

And:

Is socket.sendall guaranteed to succeed?

—

Non-blocking sockets¶

See http://docs.python.org/library/socket.html#socket.socket.setblocking

—

Multiprocessing functionality¶

Grab the code from https://github.com/ctb/meep/tree/master/util/multi

git fetch git://github.com/ctb/meep.git master:multip
git checkout multip

and run it:

cd util/multi/

python threads.py
python forks.py

One uses threads to do parallel processing, the other uses processes (‘fork’). (The second may not work on Windows, come to think of it.)

—

How does POST differ from GET?¶

Well, on one level, it’s really simple – just change forms to use POST instead

<FORM METHOD="POST" ...>
...
</FORM>

See: http://www.jmarshall.com/easy/http/#postmethod for server-side handling.

How does POST differ from GET (take 2)¶

See:

http://www.ietf.org/rfc/rfc1867.txt

Basically, for uploading files, you specify an encoding:

<FORM ENCTYPE="multipart/form-data" METHOD=POST>
...
</FORM>

and then the server needs to handle it specially.

Reading POST data¶

The improper way to read POST data is to do it all at once.

Why is this a problem?

A better way is to read it in a stream.

We’ll talk about this in class a bit.

Table Of Contents

  • In-class Links - Feb 28th, 2012
    • Non-blocking sockets
    • Multiprocessing functionality
    • How does POST differ from GET?
    • How does POST differ from GET (take 2)
    • Reading POST data

Previous topic

Homework 8, due Mar 20th, 2012

Next topic

Homework 7, due Feb 28th, 2012

This Page

  • Show Source

Quick search

Enter search terms or a module, class or function name.

Navigation

  • index
  • next |
  • previous |
  • webby 3.0 documentation »
© Copyright 2012, Titus Brown. Created using Sphinx 1.1.2.