[Prev][Next][Index][Thread]

Re: Making POST (and PUT) requests



Erik Selberg writes:
> Didn't need to hack the library... here are some code snippets. I use
> a class "URLClass" which has a bunch of spiffy methods, like
> isPostURL() etc. Looks like the java class, acually. Anyway, here's
> basically how I do a GET/POST.
> 
> DANGER DANGER DANGER DANGER!
> 
> I encountered two bugs in the library (4.0) which cause this code NOT
> to work. The first is in streampipe(), which causes the output stream
> of anything but a GET request to be HTBlackHole (i.e. /dev/null!)

This is correct and it has been fixed in the latest version 4.0C

> the
> second being in HTMIME_put_block which causes anything using the
> content_length field (like POST requests) to stop reading after
> you've _read_ content_length bytes (the content_length is used for
> telling the server how many bytes you're writing). I'm assuming Henrik
> will have patches for these in a day or so.

This is a problem as long as you use the same anchor for both data objects. By 
using two anchors - one that represents the form data which you keep in memory 
and one which represents what you get back from the remote server then this is 
not a problem. This is how it works while using PUT or POST from a local file, 
for example and this is how I imagined it to work on memory buffers as well.
 

-- 

Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA





Follow-Ups: