justinpaulson / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

Batch sub-requests supply redundant headers. #232

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

I imagine there are better ways to view the raw output of a batch request, but 
here's my approach in case it helps:

1. Use netcat to listen on localhost:8080.
2. Create a batch request, batch_req.
3. Redefine batch_req.batch_uri = 'http://localhost:8080'.
4. Execute the batch request.

-----------------------------------------------------
What is the expected output? What do you see instead?

Each sub-request supplies redundant headers that would probably be ignored even 
if they differed from the top-level headers. I'm not certain about which 
sub-request headers are guaranteed to be ignored, but I issued successful 
requests that excluded the following:

* user-agent
* host
* authorization
* accept-encoding
* MIME-Version

A cursory search yielded Section 7.2 of RFC 1341, which might be relevant:

  The only header fields that have defined meaning for body parts are those the
  names of which begin with "Content-". All other header fields are generally
  to be ignored in body parts. Although they should generally be retained in
  mail processing, they may be discarded by gateways if necessary. Such other
  fields are permitted to appear in body parts but should not be depended on.
  "X-" fields may be created for experimental or private purposes, with the
  recognition that the information they contain may be lost at some gateways.

http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

--------------------------------------------------------------------
What version of the product are you using? On what operating system?

apiclient: 1.0
Python: 2.7
OS: Ubuntu

Original issue reported on code.google.com by yova...@google.com on 24 Jan 2013 at 8:00

GoogleCodeExporter commented 8 years ago
User-agent and host could probably be dropped, but Authorization and 
Accept-Encoding could definitely be different for different parts of a batch 
and so should not be stripped.

For example, you can batch requests that are authorized for different users. 
You could also batch a JSON and an XML request together.

Original comment by jcgregorio@google.com on 24 Jan 2013 at 8:17

GoogleCodeExporter commented 8 years ago
Can you currently batch requests with varying auth?

Original comment by nherr...@google.com on 28 Jan 2013 at 9:49

GoogleCodeExporter commented 8 years ago
Yes, varying requests by Auth should work. 

Going to close this out as won't fix because I don't believe the extra code 
complexity is worth the few extra bytes saved.

Original comment by jcgregorio@google.com on 8 Feb 2013 at 4:01