Re: Fwd: Proxy implementation in WWW4.0

"Seshu Adunuthula " writes:
> I was moving a proxy implemenation from 3.0 libraries  
> to 4.0 and have the following questions.  
> The handling of headers has changed from 3.0 to 4.0.  
> I had noticed that. Previously I set a global  
> variable HTProxyHeaders and made the request.  
> Now the headers are set in the callback set by  
> HTHeaders_addGenerator. I have a large character  
> buffer that has all the headers in it. What  
> call do I make to set the headers before making  
> the request to the origin server.  

Yes, the new method of adding headers to the default set works for all 
applications that want to add extra headers to a HTTP request or response. A
This seems to be a more generic way of adding extra headers. Remember that
(almost) all commonly used headers can be controlled by setting the bitflags
in the request object. The bitflags are controlled by the methods


which you can find in HTReq.html. The APIs provided by the HTHeader module
allows you to both generate and pass extra headers.

> I have tried in the HTPostCallBack   
>   anchor = HTRequest_anchor(request); 
>   HTRequest_setEnHd(request, 0); 
>   HTAnchor_addExtra(anchor, headers_ndwpbps); 
>   HTAnchor_setHeaderParsed(anchor); 
> which does'nt seem to get the POST data right.  

The HTHeader interface only addresses headers - as you rightly says, it
doesn't work for body messages. However, you should be able to use the 
HTPostCallback() function which is a part of the request object. When
a request is generated, the HTTP client module (HTTP.c) looks for whether
there is a post callback function registered and in case there is, this 
function is called in order to produce an output to the network.

This is infact exactly the same method as if you are a client app that
wants to post data from memory, for example after the user has written a
document to post or filled out a form.

Let me know how it works out!