#7 http.py seems to set header field length improperly

open
None
5
2012-09-14
2007-08-29
William Mills
No

http.py sets the bytes field to 64k, but later when the inherited pcs field class is working on the daya it's trying to decode that field and the length is wrong so it throws an exception. Including the diffs inline here that let http_get.py from scripts run correctly.

private 11:24:17 /home/wmills/pcs-repo-sync/PCS $ hg diff pcs/packets/http.py
diff -r 6468e851e9f1 pcs/packets/http.py
--- a/pcs/packets/http.py Sun Aug 19 13:03:32 2007 +0900
+++ b/pcs/packets/http.py Wed Aug 29 11:24:27 2007 -0700
@@ -35,6 +35,7 @@
# Description: A class that describes a TCP packet.

import pcs
+import inspect

class http(pcs.Packet):
"""HTTP"""
@@ -44,7 +45,7 @@ class http(pcs.Packet):
"""initialize a TCP packet"""
# XXX: Right now we just have a 64K request. Need to augment
# from the RFC as this gets fleshed out.
- request = pcs.StringField("request", 655358)
+ request = pcs.StringField("request", len(bytes)
8)
pcs.Packet.init(self, [request],
bytes = bytes)
self.description = inspect.getdoc(self)

Discussion

  • William Mills
    William Mills
    2007-08-29

    Logged In: YES
    user_id=290850
    Originator: YES

    File Added: http_py_patch.txt

     
  • William Mills
    William Mills
    2007-08-29

    diff file in readable format

     
    Attachments
  • Logged In: YES
    user_id=767347
    Originator: NO

    Thanks, I'll be checking in an update soon.