Commit Graph

138 Commits

Author SHA1 Message Date
Stig Bjørlykke 377ea887bb Improved a if-check to avoid a analyzis warning.
svn path=/trunk/; revision=41508
2012-03-12 17:18:54 +00:00
Guy Harris 7e51e80fe0 To quote section "7.2.1 Type" of RFC 2068, "Hypertext Transfer Protocol
-- HTTP/1.1":

   Any HTTP/1.1 message containing an entity-body SHOULD include a
   Content-Type header field defining the media type of that body. If
   and only if the media type is not given by a Content-Type field, the
   recipient MAY attempt to guess the media type via inspection of its
   content and/or the name extension(s) of the URL used to identify the
   resource. If the media type remains unknown, the recipient SHOULD
   treat it as type "application/octet-stream".

To quote section "4. Encoding of Transport Layer" of RFC 2565, "Internet
Printing Protocol/1.0: Encoding and Transport":

   HTTP/1.1 [RFC2068] is the transport layer for this protocol.

	...

   Note: even though port 631 is the IPP default, port 80 remains the
   default for an HTTP URI.  Thus a URI for a printer using port 631
   MUST contain an explicit port, e.g. "http://forest:631/pinetree".  An
   HTTP URI for IPP with no explicit port implicitly reference port 80,
   which is consistent with the rules for HTTP/1.1. Each HTTP operation
   MUST use the POST method where the request-URI is the object target
   of the operation, and where the "Content-Type" of the message-body in
   each request and response MUST be "application/ipp". The message-body
   MUST contain the operation layer and MUST have the syntax described
   in section 3.2 "Syntax of Encoding". A client implementation MUST
   adhere to the rules for a client described for HTTP1.1 [RFC2068]. A
   printer (server) implementation MUST adhere the rules for an origin
   server described for HTTP1.1 [RFC2068].

So, when choosing a subdissector for HTTP request bodies, search based
on the media type first, and only if we *don't* find a dissector for the
media type, do other stuff such as heuristics or choosing a subdissector
based on the port number.

This fixes a number of problems; in particular, it fixes bug 6765
"non-IPP packets to or from port 631 are dissected as IPP" without
requiring the IPP dissector to attempt to determine whether an entity
body looks like IPP.  It also ensures that the default dissector for
HTTP entity bodies, the "media" dissector, will get the media type
passed to it in pinfo->match_string.

Don't use "!str*cmp()" while we're at it - it's valid C, but the "!" can
make it look as if it's checking for something not being the case when,
in fact, you're checking for equality rather than inequality.  (The
str*cmp() routines don't return Boolean results.)

svn path=/trunk/; revision=41025
2012-02-14 06:00:14 +00:00
Chris Maynard 3db18f185e Fix some typos.
svn path=/trunk/; revision=40787
2012-02-01 02:05:19 +00:00
Anders Broman 20881c49bb From Claudio:
linear white space (LWS) not ignored after HTTP header field content.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6591

svn path=/trunk/; revision=40753
2012-01-28 17:04:48 +00:00
Bill Meier dda0d791c9 Use correct reported_length for a tvb_new_subset() (not that it makes a difference in this case).
svn path=/trunk/; revision=40257
2011-12-21 03:44:23 +00:00
Bill Meier a0731cfeb8 Create "Dehunked Entity Body" with O(N) rather than O(N^2) efffort.
[Actually 1 g_malloc() + N tvb_memcpy() instead of
~ N g_malloc()/g_free() + N*(N+1)/2 tvb_memcpy() where N = number of chunks].

svn path=/trunk/; revision=40242
2011-12-18 18:31:30 +00:00
Bill Meier c60d239123 From Claudio: header value always computed twice
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6592

svn path=/trunk/; revision=39975
2011-11-21 17:58:47 +00:00
Bill Meier 794757ae8f For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
Also: remove trailing whitespace for a number of files.

svn path=/trunk/; revision=39503
2011-10-21 02:10:19 +00:00
Bill Meier 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +00:00
Stig Bjørlykke 7714898212 Cleanup the unregister loop to avoid freeing wrong data.
svn path=/trunk/; revision=39268
2011-10-05 11:44:29 +00:00
Stig Bjørlykke 19e87afd9d Free duplicated strings in hf entries.
svn path=/trunk/; revision=39258
2011-10-04 21:06:20 +00:00
Stig Bjørlykke 8c8cd4024c Unregister and delete allocated header fields when updating the UAT.
Avoid double loading the UAT.
Use the post update callback in uat_new for regenerating header_fields_hash.

svn path=/trunk/; revision=39251
2011-10-04 18:40:56 +00:00
Anders Broman 0d89708ab2 Add notes and links on SSDP
svn path=/trunk/; revision=38913
2011-09-07 09:02:09 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Guy Harris a3ae744636 Add port 2710 for the XBT BitTorrent tracker (and note why it's added;
the other unusual ports should be mentioned as well).

svn path=/trunk/; revision=37952
2011-07-10 18:34:15 +00:00
Jeff Morriss 7ad71a2d78 Treat TVBs as opaque: use the accessor functions instead of accessing the fields
directly.

svn path=/trunk/; revision=37420
2011-05-27 01:57:33 +00:00
Stig Bjørlykke c92938bbc0 Support content-type x-gzip and x-deflate, as described in RFC2616 as
equivalent to gzip and deflate.

This fixes bug 5882.

svn path=/trunk/; revision=36963
2011-05-02 14:06:33 +00:00
Alexis La Goutte 8b61d83f5e Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=36700
2011-04-18 17:38:08 +00:00
Jeff Morriss dd9f86c38d The 'name's passed to tick_stat_node() do not need to be static.
svn path=/trunk/; revision=36341
2011-03-26 01:21:43 +00:00
Jeff Morriss bb61772be7 From Dirk: fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2930 :
Make the image (png, gif, jfif) dissectors "new style" so that they don't
dissect data that does not belong to them.

Modify the HTTP dissector to call heuristic dissectors on the body if the
registered subdissector does not accept/dissect the data.

From me: don't use assert() and don't add a preference to the HTTP dissector
for this behavior: it makes sense to behave like that by default.

svn path=/trunk/; revision=36305
2011-03-24 02:49:05 +00:00
Gerald Combs 1b4d847a90 Add 2869 to the list of HTTP ports: http://support.microsoft.com/kb/886257
svn path=/trunk/; revision=35461
2011-01-10 20:23:21 +00:00
Jaap Keuter 302d4c14df From Julien Kerihuel:
I've just finished to write a ncacn_http dissector for Wireshark which
provides the ability to dissect Outlook anywhere packets properly (as
specified by [MS-RPCH].pdf documentation.

svn path=/trunk/; revision=35259
2010-12-23 23:50:14 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Anders Broman 738813862b From Robert Bullen:
Improve the HTTP dissection of the Response Status Line.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5338

svn path=/trunk/; revision=34712
2010-10-30 14:29:20 +00:00
Guy Harris 17d4d51b7d Make the third argument to a UAT copy callback a size_t (not that any of
the callbacks we have use that argument - is it really needed?).

svn path=/trunk/; revision=34694
2010-10-29 21:11:33 +00:00
Jaap Keuter 3db66ff53e Try to decode the unknown multipart subtype anyway.
svn path=/trunk/; revision=34658
2010-10-27 06:49:18 +00:00
Jeff Morriss 36390c306f From Yaniv Kaul via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5336 :
Attached patch:
1. Adds port 5985 as a HTTP traffic port (used by MS Powershell remoting over
HTTP)
2. Adds dissection of Kerberos authentication to HTTP.


svn path=/trunk/; revision=34641
2010-10-25 02:17:41 +00:00
Jeff Morriss 46ef82837f Add a cast
svn path=/trunk/; revision=34164
2010-09-21 03:06:54 +00:00
Jeff Morriss 79e39c7ecb Use size_t to keep the Windows compiler happy
svn path=/trunk/; revision=34163
2010-09-21 02:41:29 +00:00
Jeff Morriss f2d070f19e From Jakub Zawadzki via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3336 :
We parse host & request page from headers, so we easily can construct full http
uri.

I was thinking about making it as field, so we could filter, print in column
info, or do other fancy stuff, but for now this is imho enough.


From me: add it as a (filterable) item.  Clean up spacing and indentation in a
few places.

svn path=/trunk/; revision=34162
2010-09-21 02:12:21 +00:00
Stig Bjørlykke 42d0e5b2a8 Request-Line can contain an empty Request-URI.
I don't want to change get_token_len() to not skip multiple spaces,
because I don't know if other protocols depends on this behaviour.
We should maybe check this...

This fixes bug 5181.

svn path=/trunk/; revision=34063
2010-09-05 12:16:14 +00:00
Jeff Morriss 729de1a635 As suggested in http://www.wireshark.org/lists/wireshark-dev/200809/msg00075.html
(as referenced in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2907 ) and
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3411 :

Write a new convenience routine for finding a conversation and, if it is not
found, create it.  The frame number and addresses are taken from pinfo (as is
the common case).

Use this function in a bunch of dissectors.

svn path=/trunk/; revision=32790
2010-05-13 18:28:34 +00:00
Jeff Morriss c8cecb9133 From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4758 :
The HTTP dissector uses strtoll() to convert the Content-Length string into a
64bit variable. But that string can contain a number larger (or less) than
64bit, which lets the strtoll() return INT_MAX (or INT_MIN). strtoll() then
indicates this with errno==ERANGE.

The attachted patch checks if errno is set this way and then treats that HTTP
Content-Length as unspecified, since we don't know the real size.

I haven't checked other occurences of strtoll() in the HTTP dissector if they
could benefit from the errno check, or if other dissectors could use it.

svn path=/trunk/; revision=32772
2010-05-12 13:24:42 +00:00
Guy Harris 17865148a1 Squelch compiler warnings. (We know that header.content_length is less
than a value that fits into an int, so we know its value will fit into
an int.)

svn path=/trunk/; revision=32434
2010-04-09 02:00:07 +00:00
Jeff Morriss 873a93c7b1 Use a 64-bit number to store the content length. This fixes:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1958

Of course this doesn't mean we can reassemble that much data.

svn path=/trunk/; revision=32433
2010-04-09 01:42:12 +00:00
Stig Bjørlykke 2f8830b4d0 From LEGO via bug 3459:
Add a callback to UAT to be called after the table has being updated,
use it to renew the snmp_ue_cache.

svn path=/trunk/; revision=32112
2010-03-04 12:50:18 +00:00
Stig Bjørlykke c198fc6546 From Didier Gautheron via bug 4419:
se_alloc and ep_alloc never return NULL and se_alloc0 already initialized
data with 0.

svn path=/trunk/; revision=31654
2010-01-25 11:47:39 +00:00
Kovarththanan Rajaratnam 00810ff199 * Prefer col_append_str instead of col_append_fstr for constant strings
* Remove check_col guards

svn path=/trunk/; revision=30127
2009-09-24 20:21:23 +00:00
Jeff Morriss 5acb182178 Revert 29889 to stop the fuzz failures.
svn path=/trunk/; revision=29902
2009-09-14 17:36:15 +00:00
Anders Broman 120b410ac4 From Didier Gautheron:
optimizations patch http://wiki.wireshark.org/Development/Optimization
'patch.29854.diff.gz"

Use "g_realloc".

svn path=/trunk/; revision=29889
2009-09-14 06:00:53 +00:00
Kovarththanan Rajaratnam 8c48c6835f Rename address_to_str() to ep_address_to_str() because:
1) This indicates that the string has ephemeral lifetime
2) More consistent with its existing seasonal counterpart, se_address_to_str().

svn path=/trunk/; revision=29747
2009-09-06 14:25:47 +00:00
Bill Meier 94f28dd8f9 (FWIW) One step towards including stdio.h & stdlib.h only when req'd.
svn path=/trunk/; revision=29568
2009-08-26 19:27:49 +00:00
Bill Meier 1ab1e3889c Don't do dissector_add twice on TCP port 3689;
packet-daap requests registration on that port via http_dissector_add
 and thus packet-http does not need to do a default registration on that port.
Also: fix a typo in a comment.

svn path=/trunk/; revision=29265
2009-08-02 19:09:36 +00:00
Stig Bjørlykke b228488bc0 From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
    for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
    FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero

svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
Jörg Mayer c321f29518 Trivial warning fixes:
- Might be used uninitialized
- not a prototype
- comma at end of enum


svn path=/trunk/; revision=28730
2009-06-15 02:34:53 +00:00
Guy Harris cf91fdf16b Have tap listeners specify whether the "packet" routine requires
a protocol tree;

	the column values.

This includes stats-tree listeners.

Have the routines to build the packet list, and to retap packets, honor
those requirements.  This means that cf_retap_packets() no longer needs
an argument to specify whether to construct the column values or not, so
get rid of that argument.

This also means that there's no need for a tap to have a fake filter
to ensure that the protocol tree will be built, so don't set up a fake
"frame" filter.

While we're at it, clean up some cases where "no filter" was represented
as a null string rather than a null pointer.

Have a routine to return an indication of the number of tap listeners
with filters; use that rather than the global num_tap_filters.

Clean up some indentation and some gboolean vs. gint items.

svn path=/trunk/; revision=28645
2009-06-05 22:42:47 +00:00
Stig Bjørlykke fc3f1b5283 From Artem Tamazov (bug 3472):
Save/Restore pinfo->private_data when used.

svn path=/trunk/; revision=28412
2009-05-19 17:16:14 +00:00
Gerald Combs d797045341 From Abhik Sarkar via bug 3242:
Add a UAT for custom HTTP header fields.
  
From me:

  Use se_alloc0 to initialize a struct. Use g_strdup(...) instead of
  g_strdup_printf("%s"...). Add a missing UAT_END_FIELDS.

svn path=/trunk/; revision=28406
2009-05-19 00:17:23 +00:00
Anders Broman c91a384702 Apply some of the patches from:
http://wiki.wireshark.org/Development/Optimization

svn path=/trunk/; revision=28356
2009-05-13 19:46:11 +00:00
Gerald Combs ef0e74e533 More size_t casts.
svn path=/trunk/; revision=27897
2009-03-30 18:40:33 +00:00