refactor: Remove debug print statements from POST request handling in TempWebServer
This commit is contained in:
parent
7fc7661dad
commit
f81d89980b
@ -58,12 +58,6 @@ class TempWebServer:
|
|||||||
bytes_read = len(body_so_far.encode('utf-8'))
|
bytes_read = len(body_so_far.encode('utf-8'))
|
||||||
bytes_needed = content_length - bytes_read
|
bytes_needed = content_length - bytes_read
|
||||||
|
|
||||||
# ===== DEBUG: Print body reading info =====
|
|
||||||
print("DEBUG POST: Content-Length = {} bytes".format(content_length))
|
|
||||||
print("DEBUG POST: Already read = {} bytes".format(bytes_read))
|
|
||||||
print("DEBUG POST: Still need = {} bytes".format(bytes_needed))
|
|
||||||
# ===== END DEBUG =====
|
|
||||||
|
|
||||||
# Read remaining body in loop (recv() may not return all at once!)
|
# Read remaining body in loop (recv() may not return all at once!)
|
||||||
if bytes_needed > 0:
|
if bytes_needed > 0:
|
||||||
remaining_parts = []
|
remaining_parts = []
|
||||||
@ -77,21 +71,10 @@ class TempWebServer:
|
|||||||
break
|
break
|
||||||
remaining_parts.append(chunk)
|
remaining_parts.append(chunk)
|
||||||
total_read += len(chunk)
|
total_read += len(chunk)
|
||||||
print("DEBUG POST: Read {} bytes (total: {}/{})".format(
|
|
||||||
len(chunk), total_read, bytes_needed))
|
|
||||||
|
|
||||||
remaining = b''.join(remaining_parts)
|
remaining = b''.join(remaining_parts)
|
||||||
print("DEBUG POST: Read additional {} bytes (expected {})".format(
|
|
||||||
len(remaining), bytes_needed))
|
|
||||||
request = request[:header_end] + body_so_far + remaining.decode('utf-8')
|
request = request[:header_end] + body_so_far + remaining.decode('utf-8')
|
||||||
|
|
||||||
# ===== DEBUG: Print final body length =====
|
|
||||||
final_body = request[header_end:]
|
|
||||||
print("DEBUG POST: Final body length = {} bytes (expected {})".format(
|
|
||||||
len(final_body), content_length))
|
|
||||||
print("DEBUG POST: First 100 chars = {}".format(final_body[:100]))
|
|
||||||
# ===== END DEBUG =====
|
|
||||||
|
|
||||||
if 'POST /update' in request:
|
if 'POST /update' in request:
|
||||||
response = self._handle_update(request, sensors, ac_monitor, heater_monitor, schedule_monitor, config)
|
response = self._handle_update(request, sensors, ac_monitor, heater_monitor, schedule_monitor, config)
|
||||||
# If error page redirects, handle it
|
# If error page redirects, handle it
|
||||||
@ -118,7 +101,6 @@ class TempWebServer:
|
|||||||
for i in range(0, len(response_bytes), chunk_size):
|
for i in range(0, len(response_bytes), chunk_size):
|
||||||
chunk = response_bytes[i:i+chunk_size]
|
chunk = response_bytes[i:i+chunk_size]
|
||||||
conn.sendall(chunk)
|
conn.sendall(chunk)
|
||||||
print("DEBUG: Sent chunk {} ({} bytes)".format(i//chunk_size + 1, len(chunk)))
|
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
print("DEBUG: Schedule editor page sent successfully ({} bytes total)".format(len(response_bytes)))
|
print("DEBUG: Schedule editor page sent successfully ({} bytes total)".format(len(response_bytes)))
|
||||||
@ -1400,8 +1382,6 @@ document.addEventListener('DOMContentLoaded', function() {{
|
|||||||
# Build schedule inputs
|
# Build schedule inputs
|
||||||
schedule_inputs = ""
|
schedule_inputs = ""
|
||||||
for i, schedule in enumerate(schedules[:4]):
|
for i, schedule in enumerate(schedules[:4]):
|
||||||
print("DEBUG: Building HTML for schedule {}...".format(i))
|
|
||||||
|
|
||||||
time_value = schedule.get('time', '')
|
time_value = schedule.get('time', '')
|
||||||
name_value = schedule.get('name', '')
|
name_value = schedule.get('name', '')
|
||||||
heater_value = schedule.get('heater_target', config.get('heater_target'))
|
heater_value = schedule.get('heater_target', config.get('heater_target'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user